From c0af5c5c9c4163ee166fba14f7ab8e816753b50a Mon Sep 17 00:00:00 2001 From: Ben Clayton Date: Thu, 2 Jun 2022 14:36:10 +0000 Subject: [PATCH] tint: Add builtin tests for arguments passed by var Change-Id: I81b69d23e40675d7f525e6369afec9aa0659d043 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/92321 Reviewed-by: Dan Sinclair Commit-Queue: Ben Clayton Reviewed-by: Antonio Maiorano Kokoro: Kokoro --- src/tint/intrinsics.def | 60 ++--- src/tint/resolver/intrinsic_table.inl | 60 ++--- test/tint/builtins/gen/gen.wgsl.tmpl | 41 +-- .../gen/literal/textureGather/01305f.wgsl | 47 ---- .../textureGather/01305f.wgsl.expected.glsl | 55 ---- .../textureGather/01305f.wgsl.expected.hlsl | 33 --- .../textureGather/01305f.wgsl.expected.msl | 33 --- .../textureGather/01305f.wgsl.expected.spvasm | 89 ------- .../textureGather/01305f.wgsl.expected.wgsl | 23 -- .../gen/literal/textureGather/06030a.wgsl | 47 ---- .../textureGather/06030a.wgsl.expected.glsl | 55 ---- .../textureGather/06030a.wgsl.expected.hlsl | 33 --- .../textureGather/06030a.wgsl.expected.msl | 33 --- .../textureGather/06030a.wgsl.expected.spvasm | 88 ------- .../textureGather/06030a.wgsl.expected.wgsl | 23 -- .../gen/literal/textureGather/15d79c.wgsl | 47 ---- .../textureGather/15d79c.wgsl.expected.glsl | 55 ---- .../textureGather/15d79c.wgsl.expected.hlsl | 33 --- .../textureGather/15d79c.wgsl.expected.msl | 33 --- .../textureGather/15d79c.wgsl.expected.spvasm | 86 ------- .../textureGather/15d79c.wgsl.expected.wgsl | 23 -- .../gen/literal/textureGather/1f7f6b.wgsl | 47 ++++ .../textureGather/1f7f6b.wgsl.expected.glsl | 55 ++++ .../textureGather/1f7f6b.wgsl.expected.hlsl | 33 +++ .../textureGather/1f7f6b.wgsl.expected.msl | 33 +++ .../textureGather/1f7f6b.wgsl.expected.spvasm | 86 +++++++ .../textureGather/1f7f6b.wgsl.expected.wgsl | 23 ++ .../gen/literal/textureGather/22e930.wgsl | 47 ++++ .../textureGather/22e930.wgsl.expected.glsl | 55 ++++ .../textureGather/22e930.wgsl.expected.hlsl | 33 +++ .../textureGather/22e930.wgsl.expected.msl | 33 +++ .../textureGather/22e930.wgsl.expected.spvasm | 86 +++++++ .../textureGather/22e930.wgsl.expected.wgsl | 23 ++ .../gen/literal/textureGather/2cc066.wgsl | 47 ++++ .../textureGather/2cc066.wgsl.expected.glsl | 55 ++++ .../textureGather/2cc066.wgsl.expected.hlsl | 33 +++ .../textureGather/2cc066.wgsl.expected.msl | 33 +++ .../textureGather/2cc066.wgsl.expected.spvasm | 89 +++++++ .../textureGather/2cc066.wgsl.expected.wgsl | 23 ++ .../gen/literal/textureGather/3112e8.wgsl | 47 ---- .../textureGather/3112e8.wgsl.expected.glsl | 78 ------ .../textureGather/3112e8.wgsl.expected.hlsl | 33 --- .../textureGather/3112e8.wgsl.expected.msl | 33 --- .../textureGather/3112e8.wgsl.expected.spvasm | 86 ------- .../textureGather/3112e8.wgsl.expected.wgsl | 23 -- .../gen/literal/textureGather/32c4e8.wgsl | 47 ++++ .../textureGather/32c4e8.wgsl.expected.glsl | 55 ++++ .../textureGather/32c4e8.wgsl.expected.hlsl | 33 +++ .../textureGather/32c4e8.wgsl.expected.msl | 33 +++ .../textureGather/32c4e8.wgsl.expected.spvasm | 84 ++++++ .../textureGather/32c4e8.wgsl.expected.wgsl | 23 ++ .../gen/literal/textureGather/3b32cc.wgsl | 47 ++++ .../textureGather/3b32cc.wgsl.expected.glsl | 55 ++++ .../textureGather/3b32cc.wgsl.expected.hlsl | 33 +++ .../textureGather/3b32cc.wgsl.expected.msl | 33 +++ .../textureGather/3b32cc.wgsl.expected.spvasm | 87 +++++++ .../textureGather/3b32cc.wgsl.expected.wgsl | 23 ++ .../gen/literal/textureGather/3c527e.wgsl | 47 ---- .../textureGather/3c527e.wgsl.expected.glsl | 78 ------ .../textureGather/3c527e.wgsl.expected.hlsl | 33 --- .../textureGather/3c527e.wgsl.expected.msl | 33 --- .../textureGather/3c527e.wgsl.expected.spvasm | 89 ------- .../textureGather/3c527e.wgsl.expected.wgsl | 23 -- .../gen/literal/textureGather/49b07f.wgsl | 47 ++++ .../textureGather/49b07f.wgsl.expected.glsl | 55 ++++ .../textureGather/49b07f.wgsl.expected.hlsl | 33 +++ .../textureGather/49b07f.wgsl.expected.msl | 33 +++ .../textureGather/49b07f.wgsl.expected.spvasm | 89 +++++++ .../textureGather/49b07f.wgsl.expected.wgsl | 23 ++ .../gen/literal/textureGather/4b8103.wgsl | 47 ++++ .../textureGather/4b8103.wgsl.expected.glsl | 55 ++++ .../textureGather/4b8103.wgsl.expected.hlsl | 33 +++ .../textureGather/4b8103.wgsl.expected.msl | 33 +++ .../textureGather/4b8103.wgsl.expected.spvasm | 88 +++++++ .../textureGather/4b8103.wgsl.expected.wgsl | 23 ++ .../gen/literal/textureGather/4f2350.wgsl | 47 ---- .../textureGather/4f2350.wgsl.expected.glsl | 55 ---- .../textureGather/4f2350.wgsl.expected.hlsl | 33 --- .../textureGather/4f2350.wgsl.expected.msl | 33 --- .../textureGather/4f2350.wgsl.expected.spvasm | 90 ------- .../textureGather/4f2350.wgsl.expected.wgsl | 23 -- .../gen/literal/textureGather/51cf0b.wgsl | 47 ---- .../textureGather/51cf0b.wgsl.expected.glsl | 55 ---- .../textureGather/51cf0b.wgsl.expected.hlsl | 33 --- .../textureGather/51cf0b.wgsl.expected.msl | 33 --- .../textureGather/51cf0b.wgsl.expected.spvasm | 88 ------- .../textureGather/51cf0b.wgsl.expected.wgsl | 23 -- .../gen/literal/textureGather/5266da.wgsl | 47 ++++ .../textureGather/5266da.wgsl.expected.glsl | 55 ++++ .../textureGather/5266da.wgsl.expected.hlsl | 33 +++ .../textureGather/5266da.wgsl.expected.msl | 33 +++ .../textureGather/5266da.wgsl.expected.spvasm | 84 ++++++ .../textureGather/5266da.wgsl.expected.wgsl | 23 ++ .../gen/literal/textureGather/53ece6.wgsl | 47 ---- .../textureGather/53ece6.wgsl.expected.glsl | 55 ---- .../textureGather/53ece6.wgsl.expected.hlsl | 33 --- .../textureGather/53ece6.wgsl.expected.msl | 33 --- .../textureGather/53ece6.wgsl.expected.spvasm | 89 ------- .../textureGather/53ece6.wgsl.expected.wgsl | 23 -- .../gen/literal/textureGather/57bfc6.wgsl | 47 ---- .../textureGather/57bfc6.wgsl.expected.glsl | 55 ---- .../textureGather/57bfc6.wgsl.expected.hlsl | 33 --- .../textureGather/57bfc6.wgsl.expected.msl | 33 --- .../textureGather/57bfc6.wgsl.expected.spvasm | 84 ------ .../textureGather/57bfc6.wgsl.expected.wgsl | 23 -- .../gen/literal/textureGather/587ba3.wgsl | 47 ---- .../textureGather/587ba3.wgsl.expected.glsl | 55 ---- .../textureGather/587ba3.wgsl.expected.hlsl | 33 --- .../textureGather/587ba3.wgsl.expected.msl | 33 --- .../textureGather/587ba3.wgsl.expected.spvasm | 86 ------- .../textureGather/587ba3.wgsl.expected.wgsl | 23 -- .../gen/literal/textureGather/5ba85f.wgsl | 47 ++++ .../textureGather/5ba85f.wgsl.expected.glsl | 55 ++++ .../textureGather/5ba85f.wgsl.expected.hlsl | 33 +++ .../textureGather/5ba85f.wgsl.expected.msl | 33 +++ .../textureGather/5ba85f.wgsl.expected.spvasm | 86 +++++++ .../textureGather/5ba85f.wgsl.expected.wgsl | 23 ++ .../gen/literal/textureGather/5bd491.wgsl | 47 ++++ .../textureGather/5bd491.wgsl.expected.glsl | 55 ++++ .../textureGather/5bd491.wgsl.expected.hlsl | 33 +++ .../textureGather/5bd491.wgsl.expected.msl | 33 +++ .../textureGather/5bd491.wgsl.expected.spvasm | 87 +++++++ .../textureGather/5bd491.wgsl.expected.wgsl | 23 ++ .../gen/literal/textureGather/69e0fb.wgsl | 47 ---- .../textureGather/69e0fb.wgsl.expected.glsl | 55 ---- .../textureGather/69e0fb.wgsl.expected.hlsl | 33 --- .../textureGather/69e0fb.wgsl.expected.msl | 33 --- .../textureGather/69e0fb.wgsl.expected.spvasm | 88 ------- .../textureGather/69e0fb.wgsl.expected.wgsl | 23 -- .../gen/literal/textureGather/751f8a.wgsl | 47 ++++ .../textureGather/751f8a.wgsl.expected.glsl | 78 ++++++ .../textureGather/751f8a.wgsl.expected.hlsl | 33 +++ .../textureGather/751f8a.wgsl.expected.msl | 33 +++ .../textureGather/751f8a.wgsl.expected.spvasm | 86 +++++++ .../textureGather/751f8a.wgsl.expected.wgsl | 23 ++ .../gen/literal/textureGather/7c3828.wgsl | 47 ++++ .../textureGather/7c3828.wgsl.expected.glsl | 55 ++++ .../textureGather/7c3828.wgsl.expected.hlsl | 33 +++ .../textureGather/7c3828.wgsl.expected.msl | 33 +++ .../textureGather/7c3828.wgsl.expected.spvasm | 88 +++++++ .../textureGather/7c3828.wgsl.expected.wgsl | 23 ++ .../gen/literal/textureGather/8b754c.wgsl | 47 ++++ .../textureGather/8b754c.wgsl.expected.glsl | 55 ++++ .../textureGather/8b754c.wgsl.expected.hlsl | 33 +++ .../textureGather/8b754c.wgsl.expected.msl | 33 +++ .../textureGather/8b754c.wgsl.expected.spvasm | 88 +++++++ .../textureGather/8b754c.wgsl.expected.wgsl | 23 ++ .../gen/literal/textureGather/93003d.wgsl | 47 ---- .../textureGather/93003d.wgsl.expected.glsl | 55 ---- .../textureGather/93003d.wgsl.expected.hlsl | 33 --- .../textureGather/93003d.wgsl.expected.msl | 33 --- .../textureGather/93003d.wgsl.expected.spvasm | 89 ------- .../textureGather/93003d.wgsl.expected.wgsl | 23 -- .../gen/literal/textureGather/9efca2.wgsl | 47 ---- .../textureGather/9efca2.wgsl.expected.glsl | 55 ---- .../textureGather/9efca2.wgsl.expected.hlsl | 33 --- .../textureGather/9efca2.wgsl.expected.msl | 33 --- .../textureGather/9efca2.wgsl.expected.spvasm | 86 ------- .../textureGather/9efca2.wgsl.expected.wgsl | 23 -- .../gen/literal/textureGather/af55b3.wgsl | 47 ++++ .../textureGather/af55b3.wgsl.expected.glsl | 55 ++++ .../textureGather/af55b3.wgsl.expected.hlsl | 33 +++ .../textureGather/af55b3.wgsl.expected.msl | 33 +++ .../textureGather/af55b3.wgsl.expected.spvasm | 86 +++++++ .../textureGather/af55b3.wgsl.expected.wgsl | 23 ++ .../gen/literal/textureGather/bb3ac5.wgsl | 47 ++++ .../textureGather/bb3ac5.wgsl.expected.glsl | 55 ++++ .../textureGather/bb3ac5.wgsl.expected.hlsl | 33 +++ .../textureGather/bb3ac5.wgsl.expected.msl | 33 +++ .../textureGather/bb3ac5.wgsl.expected.spvasm | 86 +++++++ .../textureGather/bb3ac5.wgsl.expected.wgsl | 23 ++ .../gen/literal/textureGather/bd0b1e.wgsl | 47 ---- .../textureGather/bd0b1e.wgsl.expected.glsl | 55 ---- .../textureGather/bd0b1e.wgsl.expected.hlsl | 33 --- .../textureGather/bd0b1e.wgsl.expected.msl | 33 --- .../textureGather/bd0b1e.wgsl.expected.spvasm | 84 ------ .../textureGather/bd0b1e.wgsl.expected.wgsl | 23 -- .../gen/literal/textureGather/c0640c.wgsl | 47 ++++ .../textureGather/c0640c.wgsl.expected.glsl | 78 ++++++ .../textureGather/c0640c.wgsl.expected.hlsl | 33 +++ .../textureGather/c0640c.wgsl.expected.msl | 33 +++ .../textureGather/c0640c.wgsl.expected.spvasm | 88 +++++++ .../textureGather/c0640c.wgsl.expected.wgsl | 23 ++ .../gen/literal/textureGather/c409ae.wgsl | 47 ---- .../textureGather/c409ae.wgsl.expected.glsl | 55 ---- .../textureGather/c409ae.wgsl.expected.hlsl | 33 --- .../textureGather/c409ae.wgsl.expected.msl | 33 --- .../textureGather/c409ae.wgsl.expected.spvasm | 86 ------- .../textureGather/c409ae.wgsl.expected.wgsl | 23 -- .../gen/literal/textureGather/c55822.wgsl | 47 ---- .../textureGather/c55822.wgsl.expected.glsl | 78 ------ .../textureGather/c55822.wgsl.expected.hlsl | 33 --- .../textureGather/c55822.wgsl.expected.msl | 33 --- .../textureGather/c55822.wgsl.expected.spvasm | 88 ------- .../textureGather/c55822.wgsl.expected.wgsl | 23 -- .../gen/literal/textureGather/d1f187.wgsl | 47 ++++ .../textureGather/d1f187.wgsl.expected.glsl | 55 ++++ .../textureGather/d1f187.wgsl.expected.hlsl | 33 +++ .../textureGather/d1f187.wgsl.expected.msl | 33 +++ .../textureGather/d1f187.wgsl.expected.spvasm | 91 +++++++ .../textureGather/d1f187.wgsl.expected.wgsl | 23 ++ .../gen/literal/textureGather/d90605.wgsl | 47 ++++ .../textureGather/d90605.wgsl.expected.glsl | 55 ++++ .../textureGather/d90605.wgsl.expected.hlsl | 33 +++ .../textureGather/d90605.wgsl.expected.msl | 33 +++ .../textureGather/d90605.wgsl.expected.spvasm | 89 +++++++ .../textureGather/d90605.wgsl.expected.wgsl | 23 ++ .../gen/literal/textureGather/e1b67d.wgsl | 47 ---- .../textureGather/e1b67d.wgsl.expected.glsl | 55 ---- .../textureGather/e1b67d.wgsl.expected.hlsl | 33 --- .../textureGather/e1b67d.wgsl.expected.msl | 33 --- .../textureGather/e1b67d.wgsl.expected.spvasm | 87 ------- .../textureGather/e1b67d.wgsl.expected.wgsl | 23 -- .../gen/literal/textureGather/e9d390.wgsl | 47 ++++ .../textureGather/e9d390.wgsl.expected.glsl | 55 ++++ .../textureGather/e9d390.wgsl.expected.hlsl | 33 +++ .../textureGather/e9d390.wgsl.expected.msl | 33 +++ .../textureGather/e9d390.wgsl.expected.spvasm | 90 +++++++ .../textureGather/e9d390.wgsl.expected.wgsl | 23 ++ .../gen/literal/textureGather/e9eff6.wgsl | 47 ---- .../textureGather/e9eff6.wgsl.expected.glsl | 55 ---- .../textureGather/e9eff6.wgsl.expected.hlsl | 33 --- .../textureGather/e9eff6.wgsl.expected.msl | 33 --- .../textureGather/e9eff6.wgsl.expected.spvasm | 87 ------- .../textureGather/e9eff6.wgsl.expected.wgsl | 23 -- .../gen/literal/textureGather/f2c6e3.wgsl | 47 ++++ .../textureGather/f2c6e3.wgsl.expected.glsl | 78 ++++++ .../textureGather/f2c6e3.wgsl.expected.hlsl | 33 +++ .../textureGather/f2c6e3.wgsl.expected.msl | 33 +++ .../textureGather/f2c6e3.wgsl.expected.spvasm | 89 +++++++ .../textureGather/f2c6e3.wgsl.expected.wgsl | 23 ++ .../gen/literal/textureGather/f5f3ba.wgsl | 47 ---- .../textureGather/f5f3ba.wgsl.expected.glsl | 55 ---- .../textureGather/f5f3ba.wgsl.expected.hlsl | 33 --- .../textureGather/f5f3ba.wgsl.expected.msl | 33 --- .../textureGather/f5f3ba.wgsl.expected.spvasm | 91 ------- .../textureGather/f5f3ba.wgsl.expected.wgsl | 23 -- .../gen/literal/textureGather/f7995a.wgsl | 47 ---- .../textureGather/f7995a.wgsl.expected.glsl | 55 ---- .../textureGather/f7995a.wgsl.expected.hlsl | 33 --- .../textureGather/f7995a.wgsl.expected.msl | 33 --- .../textureGather/f7995a.wgsl.expected.spvasm | 86 ------- .../textureGather/f7995a.wgsl.expected.wgsl | 23 -- .../literal/textureGatherCompare/313add.wgsl | 47 ++++ .../313add.wgsl.expected.glsl | 55 ++++ .../313add.wgsl.expected.hlsl | 33 +++ .../313add.wgsl.expected.msl | 33 +++ .../313add.wgsl.expected.spvasm | 85 ++++++ .../313add.wgsl.expected.wgsl | 23 ++ .../literal/textureGatherCompare/6f1267.wgsl | 47 ---- .../6f1267.wgsl.expected.glsl | 55 ---- .../6f1267.wgsl.expected.hlsl | 33 --- .../6f1267.wgsl.expected.msl | 33 --- .../6f1267.wgsl.expected.spvasm | 88 ------- .../6f1267.wgsl.expected.wgsl | 23 -- .../literal/textureGatherCompare/a5f587.wgsl | 47 ---- .../a5f587.wgsl.expected.glsl | 55 ---- .../a5f587.wgsl.expected.hlsl | 33 --- .../a5f587.wgsl.expected.msl | 33 --- .../a5f587.wgsl.expected.spvasm | 85 ------ .../a5f587.wgsl.expected.wgsl | 23 -- .../literal/textureGatherCompare/f585cc.wgsl | 47 ++++ .../f585cc.wgsl.expected.glsl | 55 ++++ .../f585cc.wgsl.expected.hlsl | 33 +++ .../f585cc.wgsl.expected.msl | 33 +++ .../f585cc.wgsl.expected.spvasm | 88 +++++++ .../f585cc.wgsl.expected.wgsl | 23 ++ .../gen/literal/textureSample/02aa9b.wgsl | 36 --- .../textureSample/02aa9b.wgsl.expected.glsl | 17 -- .../textureSample/02aa9b.wgsl.expected.hlsl | 11 - .../textureSample/02aa9b.wgsl.expected.msl | 12 - .../textureSample/02aa9b.wgsl.expected.spvasm | 54 ---- .../textureSample/02aa9b.wgsl.expected.wgsl | 12 - .../gen/literal/textureSample/0dff6c.wgsl | 36 +++ .../textureSample/0dff6c.wgsl.expected.glsl | 17 ++ .../textureSample/0dff6c.wgsl.expected.hlsl | 11 + .../textureSample/0dff6c.wgsl.expected.msl | 12 + .../textureSample/0dff6c.wgsl.expected.spvasm | 52 ++++ .../textureSample/0dff6c.wgsl.expected.wgsl | 12 + .../gen/literal/textureSample/100dc0.wgsl | 36 --- .../textureSample/100dc0.wgsl.expected.glsl | 17 -- .../textureSample/100dc0.wgsl.expected.hlsl | 11 - .../textureSample/100dc0.wgsl.expected.msl | 12 - .../textureSample/100dc0.wgsl.expected.spvasm | 51 ---- .../textureSample/100dc0.wgsl.expected.wgsl | 12 - .../gen/literal/textureSample/17e988.wgsl | 36 +++ .../textureSample/17e988.wgsl.expected.glsl | 17 ++ .../textureSample/17e988.wgsl.expected.hlsl | 11 + .../textureSample/17e988.wgsl.expected.msl | 12 + .../textureSample/17e988.wgsl.expected.spvasm | 54 ++++ .../textureSample/17e988.wgsl.expected.wgsl | 12 + .../gen/literal/textureSample/2149ec.wgsl | 36 +++ .../textureSample/2149ec.wgsl.expected.glsl | 17 ++ .../textureSample/2149ec.wgsl.expected.hlsl | 11 + .../textureSample/2149ec.wgsl.expected.msl | 12 + .../textureSample/2149ec.wgsl.expected.spvasm | 51 ++++ .../textureSample/2149ec.wgsl.expected.wgsl | 12 + .../gen/literal/textureSample/60bf45.wgsl | 36 +++ .../textureSample/60bf45.wgsl.expected.glsl | 26 ++ .../textureSample/60bf45.wgsl.expected.hlsl | 11 + .../textureSample/60bf45.wgsl.expected.msl | 12 + .../textureSample/60bf45.wgsl.expected.spvasm | 55 ++++ .../textureSample/60bf45.wgsl.expected.wgsl | 12 + .../gen/literal/textureSample/667d76.wgsl | 36 --- .../textureSample/667d76.wgsl.expected.glsl | 17 -- .../textureSample/667d76.wgsl.expected.hlsl | 11 - .../textureSample/667d76.wgsl.expected.msl | 12 - .../textureSample/667d76.wgsl.expected.spvasm | 52 ---- .../textureSample/667d76.wgsl.expected.wgsl | 12 - .../gen/literal/textureSample/7c3baa.wgsl | 36 --- .../textureSample/7c3baa.wgsl.expected.glsl | 17 -- .../textureSample/7c3baa.wgsl.expected.hlsl | 11 - .../textureSample/7c3baa.wgsl.expected.msl | 12 - .../textureSample/7c3baa.wgsl.expected.spvasm | 51 ---- .../textureSample/7c3baa.wgsl.expected.wgsl | 12 - .../gen/literal/textureSample/8522e7.wgsl | 36 --- .../textureSample/8522e7.wgsl.expected.glsl | 26 -- .../textureSample/8522e7.wgsl.expected.hlsl | 11 - .../textureSample/8522e7.wgsl.expected.msl | 12 - .../textureSample/8522e7.wgsl.expected.spvasm | 55 ---- .../textureSample/8522e7.wgsl.expected.wgsl | 12 - .../gen/literal/textureSample/85c4ba.wgsl | 36 +++ .../textureSample/85c4ba.wgsl.expected.glsl | 17 ++ .../textureSample/85c4ba.wgsl.expected.hlsl | 11 + .../textureSample/85c4ba.wgsl.expected.msl | 12 + .../textureSample/85c4ba.wgsl.expected.spvasm | 51 ++++ .../textureSample/85c4ba.wgsl.expected.wgsl | 12 + .../gen/literal/textureSampleBias/594824.wgsl | 36 +++ .../594824.wgsl.expected.glsl | 17 ++ .../594824.wgsl.expected.hlsl | 11 + .../594824.wgsl.expected.msl | 12 + .../594824.wgsl.expected.spvasm | 52 ++++ .../594824.wgsl.expected.wgsl | 12 + .../gen/literal/textureSampleBias/65ac50.wgsl | 36 --- .../65ac50.wgsl.expected.glsl | 17 -- .../65ac50.wgsl.expected.hlsl | 11 - .../65ac50.wgsl.expected.msl | 12 - .../65ac50.wgsl.expected.spvasm | 55 ---- .../65ac50.wgsl.expected.wgsl | 12 - .../gen/literal/textureSampleBias/81c19a.wgsl | 36 --- .../81c19a.wgsl.expected.glsl | 17 -- .../81c19a.wgsl.expected.hlsl | 11 - .../81c19a.wgsl.expected.msl | 12 - .../81c19a.wgsl.expected.spvasm | 52 ---- .../81c19a.wgsl.expected.wgsl | 12 - .../gen/literal/textureSampleBias/9dbb51.wgsl | 36 +++ .../9dbb51.wgsl.expected.glsl | 17 ++ .../9dbb51.wgsl.expected.hlsl | 11 + .../9dbb51.wgsl.expected.msl | 12 + .../9dbb51.wgsl.expected.spvasm | 55 ++++ .../9dbb51.wgsl.expected.wgsl | 12 + .../gen/literal/textureSampleBias/a161cf.wgsl | 36 +++ .../a161cf.wgsl.expected.glsl | 17 ++ .../a161cf.wgsl.expected.hlsl | 11 + .../a161cf.wgsl.expected.msl | 12 + .../a161cf.wgsl.expected.spvasm | 52 ++++ .../a161cf.wgsl.expected.wgsl | 12 + .../gen/literal/textureSampleBias/df91bb.wgsl | 36 --- .../df91bb.wgsl.expected.glsl | 17 -- .../df91bb.wgsl.expected.hlsl | 11 - .../df91bb.wgsl.expected.msl | 12 - .../df91bb.wgsl.expected.spvasm | 52 ---- .../df91bb.wgsl.expected.wgsl | 12 - .../literal/textureSampleCompare/25fcd1.wgsl | 36 --- .../25fcd1.wgsl.expected.glsl | 17 -- .../25fcd1.wgsl.expected.hlsl | 11 - .../25fcd1.wgsl.expected.msl | 12 - .../25fcd1.wgsl.expected.spvasm | 51 ---- .../25fcd1.wgsl.expected.wgsl | 12 - .../literal/textureSampleCompare/98b85c.wgsl | 36 --- .../98b85c.wgsl.expected.glsl | 26 -- .../98b85c.wgsl.expected.hlsl | 11 - .../98b85c.wgsl.expected.msl | 12 - .../98b85c.wgsl.expected.spvasm | 54 ---- .../98b85c.wgsl.expected.wgsl | 12 - .../literal/textureSampleCompare/af1051.wgsl | 36 +++ .../af1051.wgsl.expected.glsl | 26 ++ .../af1051.wgsl.expected.hlsl | 11 + .../af1051.wgsl.expected.msl | 12 + .../af1051.wgsl.expected.spvasm | 54 ++++ .../af1051.wgsl.expected.wgsl | 12 + .../literal/textureSampleCompare/dec064.wgsl | 36 +++ .../dec064.wgsl.expected.glsl | 17 ++ .../dec064.wgsl.expected.hlsl | 11 + .../dec064.wgsl.expected.msl | 12 + .../dec064.wgsl.expected.spvasm | 51 ++++ .../dec064.wgsl.expected.wgsl | 12 + .../textureSampleCompareLevel/011a8f.wgsl | 47 ---- .../011a8f.wgsl.expected.glsl | 78 ------ .../011a8f.wgsl.expected.hlsl | 33 --- .../011a8f.wgsl.expected.msl | 33 --- .../011a8f.wgsl.expected.spvasm | 88 ------- .../011a8f.wgsl.expected.wgsl | 23 -- .../textureSampleCompareLevel/7f2b9a.wgsl | 47 ++++ .../7f2b9a.wgsl.expected.glsl | 55 ++++ .../7f2b9a.wgsl.expected.hlsl | 33 +++ .../7f2b9a.wgsl.expected.msl | 33 +++ .../7f2b9a.wgsl.expected.spvasm | 86 +++++++ .../7f2b9a.wgsl.expected.wgsl | 23 ++ .../textureSampleCompareLevel/b6e47c.wgsl | 47 ++++ .../b6e47c.wgsl.expected.glsl | 78 ++++++ .../b6e47c.wgsl.expected.hlsl | 33 +++ .../b6e47c.wgsl.expected.msl | 33 +++ .../b6e47c.wgsl.expected.spvasm | 88 +++++++ .../b6e47c.wgsl.expected.wgsl | 23 ++ .../textureSampleCompareLevel/f8121c.wgsl | 47 ---- .../f8121c.wgsl.expected.glsl | 55 ---- .../f8121c.wgsl.expected.hlsl | 33 --- .../f8121c.wgsl.expected.msl | 33 --- .../f8121c.wgsl.expected.spvasm | 86 ------- .../f8121c.wgsl.expected.wgsl | 23 -- .../gen/literal/textureSampleGrad/468f88.wgsl | 47 ---- .../468f88.wgsl.expected.glsl | 55 ---- .../468f88.wgsl.expected.hlsl | 33 --- .../468f88.wgsl.expected.msl | 33 --- .../468f88.wgsl.expected.spvasm | 85 ------ .../468f88.wgsl.expected.wgsl | 23 -- .../gen/literal/textureSampleGrad/5884dd.wgsl | 47 ++++ .../5884dd.wgsl.expected.glsl | 55 ++++ .../5884dd.wgsl.expected.hlsl | 33 +++ .../5884dd.wgsl.expected.msl | 33 +++ .../5884dd.wgsl.expected.spvasm | 85 ++++++ .../5884dd.wgsl.expected.wgsl | 23 ++ .../gen/literal/textureSampleGrad/872f00.wgsl | 47 ---- .../872f00.wgsl.expected.glsl | 55 ---- .../872f00.wgsl.expected.hlsl | 33 --- .../872f00.wgsl.expected.msl | 33 --- .../872f00.wgsl.expected.spvasm | 90 ------- .../872f00.wgsl.expected.wgsl | 23 -- .../gen/literal/textureSampleGrad/d4e3c5.wgsl | 47 ++++ .../d4e3c5.wgsl.expected.glsl | 55 ++++ .../d4e3c5.wgsl.expected.hlsl | 33 +++ .../d4e3c5.wgsl.expected.msl | 33 +++ .../d4e3c5.wgsl.expected.spvasm | 85 ++++++ .../d4e3c5.wgsl.expected.wgsl | 23 ++ .../gen/literal/textureSampleGrad/d65515.wgsl | 47 ++++ .../d65515.wgsl.expected.glsl | 55 ++++ .../d65515.wgsl.expected.hlsl | 33 +++ .../d65515.wgsl.expected.msl | 33 +++ .../d65515.wgsl.expected.spvasm | 90 +++++++ .../d65515.wgsl.expected.wgsl | 23 ++ .../gen/literal/textureSampleGrad/e9a2f7.wgsl | 47 ---- .../e9a2f7.wgsl.expected.glsl | 55 ---- .../e9a2f7.wgsl.expected.hlsl | 33 --- .../e9a2f7.wgsl.expected.msl | 33 --- .../e9a2f7.wgsl.expected.spvasm | 85 ------ .../e9a2f7.wgsl.expected.wgsl | 23 -- .../literal/textureSampleLevel/0b0a1b.wgsl | 47 ++++ .../0b0a1b.wgsl.expected.glsl | 55 ++++ .../0b0a1b.wgsl.expected.hlsl | 33 +++ .../0b0a1b.wgsl.expected.msl | 33 +++ .../0b0a1b.wgsl.expected.spvasm | 85 ++++++ .../0b0a1b.wgsl.expected.wgsl | 23 ++ .../literal/textureSampleLevel/36780e.wgsl | 47 ++++ .../36780e.wgsl.expected.glsl | 78 ++++++ .../36780e.wgsl.expected.hlsl | 33 +++ .../36780e.wgsl.expected.msl | 33 +++ .../36780e.wgsl.expected.spvasm | 91 +++++++ .../36780e.wgsl.expected.wgsl | 23 ++ .../literal/textureSampleLevel/47daa4.wgsl | 47 ---- .../47daa4.wgsl.expected.glsl | 55 ---- .../47daa4.wgsl.expected.hlsl | 33 --- .../47daa4.wgsl.expected.msl | 33 --- .../47daa4.wgsl.expected.spvasm | 88 ------- .../47daa4.wgsl.expected.wgsl | 23 -- .../literal/textureSampleLevel/690d95.wgsl | 47 ---- .../690d95.wgsl.expected.glsl | 55 ---- .../690d95.wgsl.expected.hlsl | 33 --- .../690d95.wgsl.expected.msl | 33 --- .../690d95.wgsl.expected.spvasm | 85 ------ .../690d95.wgsl.expected.wgsl | 23 -- .../literal/textureSampleLevel/749baf.wgsl | 47 ++++ .../749baf.wgsl.expected.glsl | 55 ++++ .../749baf.wgsl.expected.hlsl | 33 +++ .../749baf.wgsl.expected.msl | 33 +++ .../749baf.wgsl.expected.spvasm | 88 +++++++ .../749baf.wgsl.expected.wgsl | 23 ++ .../literal/textureSampleLevel/9bd37b.wgsl | 47 ---- .../9bd37b.wgsl.expected.glsl | 55 ---- .../9bd37b.wgsl.expected.hlsl | 33 --- .../9bd37b.wgsl.expected.msl | 33 --- .../9bd37b.wgsl.expected.spvasm | 85 ------ .../9bd37b.wgsl.expected.wgsl | 23 -- .../literal/textureSampleLevel/a4af26.wgsl | 47 ---- .../a4af26.wgsl.expected.glsl | 55 ---- .../a4af26.wgsl.expected.hlsl | 33 --- .../a4af26.wgsl.expected.msl | 33 --- .../a4af26.wgsl.expected.spvasm | 88 ------- .../a4af26.wgsl.expected.wgsl | 23 -- .../literal/textureSampleLevel/b7c55c.wgsl | 47 ++++ .../b7c55c.wgsl.expected.glsl | 55 ++++ .../b7c55c.wgsl.expected.hlsl | 33 +++ .../b7c55c.wgsl.expected.msl | 33 +++ .../b7c55c.wgsl.expected.spvasm | 88 +++++++ .../b7c55c.wgsl.expected.wgsl | 23 ++ .../literal/textureSampleLevel/ba93b3.wgsl | 47 ---- .../ba93b3.wgsl.expected.glsl | 78 ------ .../ba93b3.wgsl.expected.hlsl | 33 --- .../ba93b3.wgsl.expected.msl | 33 --- .../ba93b3.wgsl.expected.spvasm | 91 ------- .../ba93b3.wgsl.expected.wgsl | 23 -- .../literal/textureSampleLevel/dcbecb.wgsl | 47 ++++ .../dcbecb.wgsl.expected.glsl | 55 ++++ .../dcbecb.wgsl.expected.hlsl | 33 +++ .../dcbecb.wgsl.expected.msl | 33 +++ .../dcbecb.wgsl.expected.spvasm | 85 ++++++ .../dcbecb.wgsl.expected.wgsl | 23 ++ test/tint/builtins/gen/var/abs/002533.wgsl | 46 ++++ .../gen/var/abs/002533.wgsl.expected.glsl | 52 ++++ .../gen/var/abs/002533.wgsl.expected.hlsl | 31 +++ .../gen/var/abs/002533.wgsl.expected.msl | 34 +++ .../gen/var/abs/002533.wgsl.expected.spvasm | 69 +++++ .../gen/var/abs/002533.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/abs/005174.wgsl | 46 ++++ .../gen/var/abs/005174.wgsl.expected.glsl | 52 ++++ .../gen/var/abs/005174.wgsl.expected.hlsl | 31 +++ .../gen/var/abs/005174.wgsl.expected.msl | 34 +++ .../gen/var/abs/005174.wgsl.expected.spvasm | 71 +++++ .../gen/var/abs/005174.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/abs/1ce782.wgsl | 46 ++++ .../gen/var/abs/1ce782.wgsl.expected.glsl | 52 ++++ .../gen/var/abs/1ce782.wgsl.expected.hlsl | 31 +++ .../gen/var/abs/1ce782.wgsl.expected.msl | 34 +++ .../gen/var/abs/1ce782.wgsl.expected.spvasm | 70 +++++ .../gen/var/abs/1ce782.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/abs/1e9d53.wgsl | 46 ++++ .../gen/var/abs/1e9d53.wgsl.expected.glsl | 52 ++++ .../gen/var/abs/1e9d53.wgsl.expected.hlsl | 31 +++ .../gen/var/abs/1e9d53.wgsl.expected.msl | 34 +++ .../gen/var/abs/1e9d53.wgsl.expected.spvasm | 71 +++++ .../gen/var/abs/1e9d53.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/abs/467cd1.wgsl | 46 ++++ .../gen/var/abs/467cd1.wgsl.expected.glsl | 52 ++++ .../gen/var/abs/467cd1.wgsl.expected.hlsl | 31 +++ .../gen/var/abs/467cd1.wgsl.expected.msl | 34 +++ .../gen/var/abs/467cd1.wgsl.expected.spvasm | 70 +++++ .../gen/var/abs/467cd1.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/abs/4ad288.wgsl | 46 ++++ .../gen/var/abs/4ad288.wgsl.expected.glsl | 52 ++++ .../gen/var/abs/4ad288.wgsl.expected.hlsl | 31 +++ .../gen/var/abs/4ad288.wgsl.expected.msl | 34 +++ .../gen/var/abs/4ad288.wgsl.expected.spvasm | 72 ++++++ .../gen/var/abs/4ad288.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/abs/5ad50a.wgsl | 46 ++++ .../gen/var/abs/5ad50a.wgsl.expected.glsl | 52 ++++ .../gen/var/abs/5ad50a.wgsl.expected.hlsl | 31 +++ .../gen/var/abs/5ad50a.wgsl.expected.msl | 34 +++ .../gen/var/abs/5ad50a.wgsl.expected.spvasm | 72 ++++++ .../gen/var/abs/5ad50a.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/abs/7326de.wgsl | 46 ++++ .../gen/var/abs/7326de.wgsl.expected.glsl | 52 ++++ .../gen/var/abs/7326de.wgsl.expected.hlsl | 31 +++ .../gen/var/abs/7326de.wgsl.expected.msl | 34 +++ .../gen/var/abs/7326de.wgsl.expected.spvasm | 70 +++++ .../gen/var/abs/7326de.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/abs/7f28e6.wgsl | 46 ++++ .../gen/var/abs/7f28e6.wgsl.expected.glsl | 52 ++++ .../gen/var/abs/7f28e6.wgsl.expected.hlsl | 31 +++ .../gen/var/abs/7f28e6.wgsl.expected.msl | 34 +++ .../gen/var/abs/7f28e6.wgsl.expected.spvasm | 70 +++++ .../gen/var/abs/7f28e6.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/abs/7faa9e.wgsl | 46 ++++ .../gen/var/abs/7faa9e.wgsl.expected.glsl | 52 ++++ .../gen/var/abs/7faa9e.wgsl.expected.hlsl | 31 +++ .../gen/var/abs/7faa9e.wgsl.expected.msl | 34 +++ .../gen/var/abs/7faa9e.wgsl.expected.spvasm | 72 ++++++ .../gen/var/abs/7faa9e.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/abs/9c80a6.wgsl | 46 ++++ .../gen/var/abs/9c80a6.wgsl.expected.glsl | 52 ++++ .../gen/var/abs/9c80a6.wgsl.expected.hlsl | 31 +++ .../gen/var/abs/9c80a6.wgsl.expected.msl | 34 +++ .../gen/var/abs/9c80a6.wgsl.expected.spvasm | 72 ++++++ .../gen/var/abs/9c80a6.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/abs/b96037.wgsl | 46 ++++ .../gen/var/abs/b96037.wgsl.expected.glsl | 52 ++++ .../gen/var/abs/b96037.wgsl.expected.hlsl | 31 +++ .../gen/var/abs/b96037.wgsl.expected.msl | 34 +++ .../gen/var/abs/b96037.wgsl.expected.spvasm | 69 +++++ .../gen/var/abs/b96037.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/acos/489247.wgsl | 46 ++++ .../gen/var/acos/489247.wgsl.expected.glsl | 52 ++++ .../gen/var/acos/489247.wgsl.expected.hlsl | 31 +++ .../gen/var/acos/489247.wgsl.expected.msl | 34 +++ .../gen/var/acos/489247.wgsl.expected.spvasm | 69 +++++ .../gen/var/acos/489247.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/acos/8e2acf.wgsl | 46 ++++ .../gen/var/acos/8e2acf.wgsl.expected.glsl | 52 ++++ .../gen/var/acos/8e2acf.wgsl.expected.hlsl | 31 +++ .../gen/var/acos/8e2acf.wgsl.expected.msl | 34 +++ .../gen/var/acos/8e2acf.wgsl.expected.spvasm | 69 +++++ .../gen/var/acos/8e2acf.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/acos/a610c4.wgsl | 46 ++++ .../gen/var/acos/a610c4.wgsl.expected.glsl | 52 ++++ .../gen/var/acos/a610c4.wgsl.expected.hlsl | 31 +++ .../gen/var/acos/a610c4.wgsl.expected.msl | 34 +++ .../gen/var/acos/a610c4.wgsl.expected.spvasm | 71 +++++ .../gen/var/acos/a610c4.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/acos/dfc915.wgsl | 46 ++++ .../gen/var/acos/dfc915.wgsl.expected.glsl | 52 ++++ .../gen/var/acos/dfc915.wgsl.expected.hlsl | 31 +++ .../gen/var/acos/dfc915.wgsl.expected.msl | 34 +++ .../gen/var/acos/dfc915.wgsl.expected.spvasm | 71 +++++ .../gen/var/acos/dfc915.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/all/353d6a.wgsl | 46 ++++ .../gen/var/all/353d6a.wgsl.expected.glsl | 52 ++++ .../gen/var/all/353d6a.wgsl.expected.hlsl | 31 +++ .../gen/var/all/353d6a.wgsl.expected.msl | 34 +++ .../gen/var/all/353d6a.wgsl.expected.spvasm | 69 +++++ .../gen/var/all/353d6a.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/all/986c7b.wgsl | 46 ++++ .../gen/var/all/986c7b.wgsl.expected.glsl | 52 ++++ .../gen/var/all/986c7b.wgsl.expected.hlsl | 31 +++ .../gen/var/all/986c7b.wgsl.expected.msl | 34 +++ .../gen/var/all/986c7b.wgsl.expected.spvasm | 73 ++++++ .../gen/var/all/986c7b.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/all/bd2dba.wgsl | 46 ++++ .../gen/var/all/bd2dba.wgsl.expected.glsl | 52 ++++ .../gen/var/all/bd2dba.wgsl.expected.hlsl | 31 +++ .../gen/var/all/bd2dba.wgsl.expected.msl | 34 +++ .../gen/var/all/bd2dba.wgsl.expected.spvasm | 73 ++++++ .../gen/var/all/bd2dba.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/all/f46790.wgsl | 46 ++++ .../gen/var/all/f46790.wgsl.expected.glsl | 52 ++++ .../gen/var/all/f46790.wgsl.expected.hlsl | 31 +++ .../gen/var/all/f46790.wgsl.expected.msl | 34 +++ .../gen/var/all/f46790.wgsl.expected.spvasm | 73 ++++++ .../gen/var/all/f46790.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/any/083428.wgsl | 46 ++++ .../gen/var/any/083428.wgsl.expected.glsl | 52 ++++ .../gen/var/any/083428.wgsl.expected.hlsl | 31 +++ .../gen/var/any/083428.wgsl.expected.msl | 34 +++ .../gen/var/any/083428.wgsl.expected.spvasm | 73 ++++++ .../gen/var/any/083428.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/any/0e3e58.wgsl | 46 ++++ .../gen/var/any/0e3e58.wgsl.expected.glsl | 52 ++++ .../gen/var/any/0e3e58.wgsl.expected.hlsl | 31 +++ .../gen/var/any/0e3e58.wgsl.expected.msl | 34 +++ .../gen/var/any/0e3e58.wgsl.expected.spvasm | 73 ++++++ .../gen/var/any/0e3e58.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/any/2ab91a.wgsl | 46 ++++ .../gen/var/any/2ab91a.wgsl.expected.glsl | 52 ++++ .../gen/var/any/2ab91a.wgsl.expected.hlsl | 31 +++ .../gen/var/any/2ab91a.wgsl.expected.msl | 34 +++ .../gen/var/any/2ab91a.wgsl.expected.spvasm | 69 +++++ .../gen/var/any/2ab91a.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/any/e755c1.wgsl | 46 ++++ .../gen/var/any/e755c1.wgsl.expected.glsl | 52 ++++ .../gen/var/any/e755c1.wgsl.expected.hlsl | 31 +++ .../gen/var/any/e755c1.wgsl.expected.msl | 34 +++ .../gen/var/any/e755c1.wgsl.expected.spvasm | 73 ++++++ .../gen/var/any/e755c1.wgsl.expected.wgsl | 20 ++ .../builtins/gen/var/arrayLength/1588cd.wgsl | 49 ++++ .../var/arrayLength/1588cd.wgsl.expected.glsl | 58 +++++ .../var/arrayLength/1588cd.wgsl.expected.hlsl | 35 +++ .../var/arrayLength/1588cd.wgsl.expected.msl | 41 +++ .../arrayLength/1588cd.wgsl.expected.spvasm | 80 ++++++ .../var/arrayLength/1588cd.wgsl.expected.wgsl | 25 ++ .../builtins/gen/var/arrayLength/61b1c7.wgsl | 49 ++++ .../var/arrayLength/61b1c7.wgsl.expected.glsl | 58 +++++ .../var/arrayLength/61b1c7.wgsl.expected.hlsl | 35 +++ .../var/arrayLength/61b1c7.wgsl.expected.msl | 41 +++ .../arrayLength/61b1c7.wgsl.expected.spvasm | 79 ++++++ .../var/arrayLength/61b1c7.wgsl.expected.wgsl | 25 ++ .../builtins/gen/var/arrayLength/a0f5ca.wgsl | 49 ++++ .../var/arrayLength/a0f5ca.wgsl.expected.glsl | 58 +++++ .../var/arrayLength/a0f5ca.wgsl.expected.hlsl | 35 +++ .../var/arrayLength/a0f5ca.wgsl.expected.msl | 41 +++ .../arrayLength/a0f5ca.wgsl.expected.spvasm | 79 ++++++ .../var/arrayLength/a0f5ca.wgsl.expected.wgsl | 25 ++ .../builtins/gen/var/arrayLength/cdd123.wgsl | 49 ++++ .../var/arrayLength/cdd123.wgsl.expected.glsl | 58 +++++ .../var/arrayLength/cdd123.wgsl.expected.hlsl | 35 +++ .../var/arrayLength/cdd123.wgsl.expected.msl | 41 +++ .../arrayLength/cdd123.wgsl.expected.spvasm | 78 ++++++ .../var/arrayLength/cdd123.wgsl.expected.wgsl | 25 ++ .../builtins/gen/var/arrayLength/cfca0a.wgsl | 49 ++++ .../var/arrayLength/cfca0a.wgsl.expected.glsl | 58 +++++ .../var/arrayLength/cfca0a.wgsl.expected.hlsl | 35 +++ .../var/arrayLength/cfca0a.wgsl.expected.msl | 41 +++ .../arrayLength/cfca0a.wgsl.expected.spvasm | 79 ++++++ .../var/arrayLength/cfca0a.wgsl.expected.wgsl | 25 ++ .../builtins/gen/var/arrayLength/eb510f.wgsl | 49 ++++ .../var/arrayLength/eb510f.wgsl.expected.glsl | 58 +++++ .../var/arrayLength/eb510f.wgsl.expected.hlsl | 35 +++ .../var/arrayLength/eb510f.wgsl.expected.msl | 41 +++ .../arrayLength/eb510f.wgsl.expected.spvasm | 78 ++++++ .../var/arrayLength/eb510f.wgsl.expected.wgsl | 25 ++ test/tint/builtins/gen/var/asin/064953.wgsl | 46 ++++ .../gen/var/asin/064953.wgsl.expected.glsl | 52 ++++ .../gen/var/asin/064953.wgsl.expected.hlsl | 31 +++ .../gen/var/asin/064953.wgsl.expected.msl | 34 +++ .../gen/var/asin/064953.wgsl.expected.spvasm | 69 +++++ .../gen/var/asin/064953.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/asin/7b6a44.wgsl | 46 ++++ .../gen/var/asin/7b6a44.wgsl.expected.glsl | 52 ++++ .../gen/var/asin/7b6a44.wgsl.expected.hlsl | 31 +++ .../gen/var/asin/7b6a44.wgsl.expected.msl | 34 +++ .../gen/var/asin/7b6a44.wgsl.expected.spvasm | 71 +++++ .../gen/var/asin/7b6a44.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/asin/8cd9c9.wgsl | 46 ++++ .../gen/var/asin/8cd9c9.wgsl.expected.glsl | 52 ++++ .../gen/var/asin/8cd9c9.wgsl.expected.hlsl | 31 +++ .../gen/var/asin/8cd9c9.wgsl.expected.msl | 34 +++ .../gen/var/asin/8cd9c9.wgsl.expected.spvasm | 71 +++++ .../gen/var/asin/8cd9c9.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/asin/c0c272.wgsl | 46 ++++ .../gen/var/asin/c0c272.wgsl.expected.glsl | 52 ++++ .../gen/var/asin/c0c272.wgsl.expected.hlsl | 31 +++ .../gen/var/asin/c0c272.wgsl.expected.msl | 34 +++ .../gen/var/asin/c0c272.wgsl.expected.spvasm | 69 +++++ .../gen/var/asin/c0c272.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/atan/02979a.wgsl | 46 ++++ .../gen/var/atan/02979a.wgsl.expected.glsl | 52 ++++ .../gen/var/atan/02979a.wgsl.expected.hlsl | 31 +++ .../gen/var/atan/02979a.wgsl.expected.msl | 34 +++ .../gen/var/atan/02979a.wgsl.expected.spvasm | 69 +++++ .../gen/var/atan/02979a.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/atan/331e6d.wgsl | 46 ++++ .../gen/var/atan/331e6d.wgsl.expected.glsl | 52 ++++ .../gen/var/atan/331e6d.wgsl.expected.hlsl | 31 +++ .../gen/var/atan/331e6d.wgsl.expected.msl | 34 +++ .../gen/var/atan/331e6d.wgsl.expected.spvasm | 71 +++++ .../gen/var/atan/331e6d.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/atan/a8b696.wgsl | 46 ++++ .../gen/var/atan/a8b696.wgsl.expected.glsl | 52 ++++ .../gen/var/atan/a8b696.wgsl.expected.hlsl | 31 +++ .../gen/var/atan/a8b696.wgsl.expected.msl | 34 +++ .../gen/var/atan/a8b696.wgsl.expected.spvasm | 69 +++++ .../gen/var/atan/a8b696.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/atan/ad96e4.wgsl | 46 ++++ .../gen/var/atan/ad96e4.wgsl.expected.glsl | 52 ++++ .../gen/var/atan/ad96e4.wgsl.expected.hlsl | 31 +++ .../gen/var/atan/ad96e4.wgsl.expected.msl | 34 +++ .../gen/var/atan/ad96e4.wgsl.expected.spvasm | 71 +++++ .../gen/var/atan/ad96e4.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/atan2/57fb13.wgsl | 47 ++++ .../gen/var/atan2/57fb13.wgsl.expected.glsl | 55 ++++ .../gen/var/atan2/57fb13.wgsl.expected.hlsl | 32 +++ .../gen/var/atan2/57fb13.wgsl.expected.msl | 35 +++ .../gen/var/atan2/57fb13.wgsl.expected.spvasm | 75 ++++++ .../gen/var/atan2/57fb13.wgsl.expected.wgsl | 21 ++ test/tint/builtins/gen/var/atan2/96057c.wgsl | 47 ++++ .../gen/var/atan2/96057c.wgsl.expected.glsl | 55 ++++ .../gen/var/atan2/96057c.wgsl.expected.hlsl | 32 +++ .../gen/var/atan2/96057c.wgsl.expected.msl | 35 +++ .../gen/var/atan2/96057c.wgsl.expected.spvasm | 73 ++++++ .../gen/var/atan2/96057c.wgsl.expected.wgsl | 21 ++ test/tint/builtins/gen/var/atan2/a70d0d.wgsl | 47 ++++ .../gen/var/atan2/a70d0d.wgsl.expected.glsl | 55 ++++ .../gen/var/atan2/a70d0d.wgsl.expected.hlsl | 32 +++ .../gen/var/atan2/a70d0d.wgsl.expected.msl | 35 +++ .../gen/var/atan2/a70d0d.wgsl.expected.spvasm | 75 ++++++ .../gen/var/atan2/a70d0d.wgsl.expected.wgsl | 21 ++ test/tint/builtins/gen/var/atan2/ae713e.wgsl | 47 ++++ .../gen/var/atan2/ae713e.wgsl.expected.glsl | 55 ++++ .../gen/var/atan2/ae713e.wgsl.expected.hlsl | 32 +++ .../gen/var/atan2/ae713e.wgsl.expected.msl | 35 +++ .../gen/var/atan2/ae713e.wgsl.expected.spvasm | 73 ++++++ .../gen/var/atan2/ae713e.wgsl.expected.wgsl | 21 ++ .../builtins/gen/var/atomicAdd/794055.wgsl | 36 +++ .../var/atomicAdd/794055.wgsl.expected.glsl | 21 ++ .../var/atomicAdd/794055.wgsl.expected.hlsl | 27 ++ .../var/atomicAdd/794055.wgsl.expected.msl | 22 ++ .../var/atomicAdd/794055.wgsl.expected.spvasm | 57 ++++ .../var/atomicAdd/794055.wgsl.expected.wgsl | 11 + .../builtins/gen/var/atomicAdd/8a199a.wgsl | 44 ++++ .../var/atomicAdd/8a199a.wgsl.expected.glsl | 46 ++++ .../var/atomicAdd/8a199a.wgsl.expected.hlsl | 24 ++ .../var/atomicAdd/8a199a.wgsl.expected.msl | 22 ++ .../var/atomicAdd/8a199a.wgsl.expected.spvasm | 55 ++++ .../var/atomicAdd/8a199a.wgsl.expected.wgsl | 20 ++ .../builtins/gen/var/atomicAdd/d32fe4.wgsl | 44 ++++ .../var/atomicAdd/d32fe4.wgsl.expected.glsl | 46 ++++ .../var/atomicAdd/d32fe4.wgsl.expected.hlsl | 24 ++ .../var/atomicAdd/d32fe4.wgsl.expected.msl | 22 ++ .../var/atomicAdd/d32fe4.wgsl.expected.spvasm | 57 ++++ .../var/atomicAdd/d32fe4.wgsl.expected.wgsl | 20 ++ .../builtins/gen/var/atomicAdd/d5db1d.wgsl | 36 +++ .../var/atomicAdd/d5db1d.wgsl.expected.glsl | 21 ++ .../var/atomicAdd/d5db1d.wgsl.expected.hlsl | 27 ++ .../var/atomicAdd/d5db1d.wgsl.expected.msl | 22 ++ .../var/atomicAdd/d5db1d.wgsl.expected.spvasm | 56 ++++ .../var/atomicAdd/d5db1d.wgsl.expected.wgsl | 11 + .../builtins/gen/var/atomicAnd/152966.wgsl | 44 ++++ .../var/atomicAnd/152966.wgsl.expected.glsl | 46 ++++ .../var/atomicAnd/152966.wgsl.expected.hlsl | 24 ++ .../var/atomicAnd/152966.wgsl.expected.msl | 22 ++ .../var/atomicAnd/152966.wgsl.expected.spvasm | 57 ++++ .../var/atomicAnd/152966.wgsl.expected.wgsl | 20 ++ .../builtins/gen/var/atomicAnd/34edd3.wgsl | 36 +++ .../var/atomicAnd/34edd3.wgsl.expected.glsl | 21 ++ .../var/atomicAnd/34edd3.wgsl.expected.hlsl | 27 ++ .../var/atomicAnd/34edd3.wgsl.expected.msl | 22 ++ .../var/atomicAnd/34edd3.wgsl.expected.spvasm | 56 ++++ .../var/atomicAnd/34edd3.wgsl.expected.wgsl | 11 + .../builtins/gen/var/atomicAnd/45a819.wgsl | 36 +++ .../var/atomicAnd/45a819.wgsl.expected.glsl | 21 ++ .../var/atomicAnd/45a819.wgsl.expected.hlsl | 27 ++ .../var/atomicAnd/45a819.wgsl.expected.msl | 22 ++ .../var/atomicAnd/45a819.wgsl.expected.spvasm | 57 ++++ .../var/atomicAnd/45a819.wgsl.expected.wgsl | 11 + .../builtins/gen/var/atomicAnd/85a8d9.wgsl | 44 ++++ .../var/atomicAnd/85a8d9.wgsl.expected.glsl | 46 ++++ .../var/atomicAnd/85a8d9.wgsl.expected.hlsl | 24 ++ .../var/atomicAnd/85a8d9.wgsl.expected.msl | 22 ++ .../var/atomicAnd/85a8d9.wgsl.expected.spvasm | 55 ++++ .../var/atomicAnd/85a8d9.wgsl.expected.wgsl | 20 ++ .../var/atomicCompareExchangeWeak/1bd40a.wgsl | 45 ++++ .../1bd40a.wgsl.expected.glsl | 66 +++++ .../1bd40a.wgsl.expected.hlsl | 31 +++ .../1bd40a.wgsl.expected.msl | 35 +++ .../1bd40a.wgsl.expected.spvasm | 76 ++++++ .../1bd40a.wgsl.expected.wgsl | 21 ++ .../var/atomicCompareExchangeWeak/63d8e6.wgsl | 45 ++++ .../63d8e6.wgsl.expected.glsl | 66 +++++ .../63d8e6.wgsl.expected.hlsl | 31 +++ .../63d8e6.wgsl.expected.msl | 35 +++ .../63d8e6.wgsl.expected.spvasm | 74 ++++++ .../63d8e6.wgsl.expected.wgsl | 21 ++ .../var/atomicCompareExchangeWeak/83580d.wgsl | 37 +++ .../83580d.wgsl.expected.glsl | 31 +++ .../83580d.wgsl.expected.hlsl | 17 ++ .../83580d.wgsl.expected.msl | 35 +++ .../83580d.wgsl.expected.spvasm | 75 ++++++ .../83580d.wgsl.expected.wgsl | 12 + .../var/atomicCompareExchangeWeak/e88938.wgsl | 37 +++ .../e88938.wgsl.expected.glsl | 31 +++ .../e88938.wgsl.expected.hlsl | 17 ++ .../e88938.wgsl.expected.msl | 35 +++ .../e88938.wgsl.expected.spvasm | 76 ++++++ .../e88938.wgsl.expected.wgsl | 12 + .../gen/var/atomicExchange/0a5dca.wgsl | 36 +++ .../atomicExchange/0a5dca.wgsl.expected.glsl | 21 ++ .../atomicExchange/0a5dca.wgsl.expected.hlsl | 27 ++ .../atomicExchange/0a5dca.wgsl.expected.msl | 22 ++ .../0a5dca.wgsl.expected.spvasm | 56 ++++ .../atomicExchange/0a5dca.wgsl.expected.wgsl | 11 + .../gen/var/atomicExchange/d59712.wgsl | 44 ++++ .../atomicExchange/d59712.wgsl.expected.glsl | 46 ++++ .../atomicExchange/d59712.wgsl.expected.hlsl | 24 ++ .../atomicExchange/d59712.wgsl.expected.msl | 22 ++ .../d59712.wgsl.expected.spvasm | 55 ++++ .../atomicExchange/d59712.wgsl.expected.wgsl | 20 ++ .../gen/var/atomicExchange/e114ba.wgsl | 36 +++ .../atomicExchange/e114ba.wgsl.expected.glsl | 21 ++ .../atomicExchange/e114ba.wgsl.expected.hlsl | 27 ++ .../atomicExchange/e114ba.wgsl.expected.msl | 22 ++ .../e114ba.wgsl.expected.spvasm | 57 ++++ .../atomicExchange/e114ba.wgsl.expected.wgsl | 11 + .../gen/var/atomicExchange/f2e22f.wgsl | 44 ++++ .../atomicExchange/f2e22f.wgsl.expected.glsl | 46 ++++ .../atomicExchange/f2e22f.wgsl.expected.hlsl | 24 ++ .../atomicExchange/f2e22f.wgsl.expected.msl | 22 ++ .../f2e22f.wgsl.expected.spvasm | 57 ++++ .../atomicExchange/f2e22f.wgsl.expected.wgsl | 20 ++ .../builtins/gen/var/atomicLoad/0806ad.wgsl | 43 ++++ .../var/atomicLoad/0806ad.wgsl.expected.glsl | 44 ++++ .../var/atomicLoad/0806ad.wgsl.expected.hlsl | 23 ++ .../var/atomicLoad/0806ad.wgsl.expected.msl | 21 ++ .../atomicLoad/0806ad.wgsl.expected.spvasm | 52 ++++ .../var/atomicLoad/0806ad.wgsl.expected.wgsl | 19 ++ .../builtins/gen/var/atomicLoad/361bf1.wgsl | 35 +++ .../var/atomicLoad/361bf1.wgsl.expected.glsl | 20 ++ .../var/atomicLoad/361bf1.wgsl.expected.hlsl | 26 ++ .../var/atomicLoad/361bf1.wgsl.expected.msl | 21 ++ .../atomicLoad/361bf1.wgsl.expected.spvasm | 51 ++++ .../var/atomicLoad/361bf1.wgsl.expected.wgsl | 10 + .../builtins/gen/var/atomicLoad/afcc03.wgsl | 35 +++ .../var/atomicLoad/afcc03.wgsl.expected.glsl | 20 ++ .../var/atomicLoad/afcc03.wgsl.expected.hlsl | 26 ++ .../var/atomicLoad/afcc03.wgsl.expected.msl | 21 ++ .../atomicLoad/afcc03.wgsl.expected.spvasm | 52 ++++ .../var/atomicLoad/afcc03.wgsl.expected.wgsl | 10 + .../builtins/gen/var/atomicLoad/fe6cc3.wgsl | 43 ++++ .../var/atomicLoad/fe6cc3.wgsl.expected.glsl | 44 ++++ .../var/atomicLoad/fe6cc3.wgsl.expected.hlsl | 23 ++ .../var/atomicLoad/fe6cc3.wgsl.expected.msl | 21 ++ .../atomicLoad/fe6cc3.wgsl.expected.spvasm | 51 ++++ .../var/atomicLoad/fe6cc3.wgsl.expected.wgsl | 19 ++ .../builtins/gen/var/atomicMax/51b9be.wgsl | 44 ++++ .../var/atomicMax/51b9be.wgsl.expected.glsl | 46 ++++ .../var/atomicMax/51b9be.wgsl.expected.hlsl | 24 ++ .../var/atomicMax/51b9be.wgsl.expected.msl | 22 ++ .../var/atomicMax/51b9be.wgsl.expected.spvasm | 55 ++++ .../var/atomicMax/51b9be.wgsl.expected.wgsl | 20 ++ .../builtins/gen/var/atomicMax/92aa72.wgsl | 44 ++++ .../var/atomicMax/92aa72.wgsl.expected.glsl | 46 ++++ .../var/atomicMax/92aa72.wgsl.expected.hlsl | 24 ++ .../var/atomicMax/92aa72.wgsl.expected.msl | 22 ++ .../var/atomicMax/92aa72.wgsl.expected.spvasm | 57 ++++ .../var/atomicMax/92aa72.wgsl.expected.wgsl | 20 ++ .../builtins/gen/var/atomicMax/a89cc3.wgsl | 36 +++ .../var/atomicMax/a89cc3.wgsl.expected.glsl | 21 ++ .../var/atomicMax/a89cc3.wgsl.expected.hlsl | 27 ++ .../var/atomicMax/a89cc3.wgsl.expected.msl | 22 ++ .../var/atomicMax/a89cc3.wgsl.expected.spvasm | 57 ++++ .../var/atomicMax/a89cc3.wgsl.expected.wgsl | 11 + .../builtins/gen/var/atomicMax/beccfc.wgsl | 36 +++ .../var/atomicMax/beccfc.wgsl.expected.glsl | 21 ++ .../var/atomicMax/beccfc.wgsl.expected.hlsl | 27 ++ .../var/atomicMax/beccfc.wgsl.expected.msl | 22 ++ .../var/atomicMax/beccfc.wgsl.expected.spvasm | 56 ++++ .../var/atomicMax/beccfc.wgsl.expected.wgsl | 11 + .../builtins/gen/var/atomicMin/278235.wgsl | 36 +++ .../var/atomicMin/278235.wgsl.expected.glsl | 21 ++ .../var/atomicMin/278235.wgsl.expected.hlsl | 27 ++ .../var/atomicMin/278235.wgsl.expected.msl | 22 ++ .../var/atomicMin/278235.wgsl.expected.spvasm | 57 ++++ .../var/atomicMin/278235.wgsl.expected.wgsl | 11 + .../builtins/gen/var/atomicMin/69d383.wgsl | 36 +++ .../var/atomicMin/69d383.wgsl.expected.glsl | 21 ++ .../var/atomicMin/69d383.wgsl.expected.hlsl | 27 ++ .../var/atomicMin/69d383.wgsl.expected.msl | 22 ++ .../var/atomicMin/69d383.wgsl.expected.spvasm | 56 ++++ .../var/atomicMin/69d383.wgsl.expected.wgsl | 11 + .../builtins/gen/var/atomicMin/8e38dc.wgsl | 44 ++++ .../var/atomicMin/8e38dc.wgsl.expected.glsl | 46 ++++ .../var/atomicMin/8e38dc.wgsl.expected.hlsl | 24 ++ .../var/atomicMin/8e38dc.wgsl.expected.msl | 22 ++ .../var/atomicMin/8e38dc.wgsl.expected.spvasm | 57 ++++ .../var/atomicMin/8e38dc.wgsl.expected.wgsl | 20 ++ .../builtins/gen/var/atomicMin/c67a74.wgsl | 44 ++++ .../var/atomicMin/c67a74.wgsl.expected.glsl | 46 ++++ .../var/atomicMin/c67a74.wgsl.expected.hlsl | 24 ++ .../var/atomicMin/c67a74.wgsl.expected.msl | 22 ++ .../var/atomicMin/c67a74.wgsl.expected.spvasm | 55 ++++ .../var/atomicMin/c67a74.wgsl.expected.wgsl | 20 ++ .../builtins/gen/var/atomicOr/5e3d61.wgsl | 36 +++ .../var/atomicOr/5e3d61.wgsl.expected.glsl | 21 ++ .../var/atomicOr/5e3d61.wgsl.expected.hlsl | 27 ++ .../gen/var/atomicOr/5e3d61.wgsl.expected.msl | 22 ++ .../var/atomicOr/5e3d61.wgsl.expected.spvasm | 56 ++++ .../var/atomicOr/5e3d61.wgsl.expected.wgsl | 11 + .../builtins/gen/var/atomicOr/5e95d4.wgsl | 44 ++++ .../var/atomicOr/5e95d4.wgsl.expected.glsl | 46 ++++ .../var/atomicOr/5e95d4.wgsl.expected.hlsl | 24 ++ .../gen/var/atomicOr/5e95d4.wgsl.expected.msl | 22 ++ .../var/atomicOr/5e95d4.wgsl.expected.spvasm | 55 ++++ .../var/atomicOr/5e95d4.wgsl.expected.wgsl | 20 ++ .../builtins/gen/var/atomicOr/8d96a0.wgsl | 44 ++++ .../var/atomicOr/8d96a0.wgsl.expected.glsl | 46 ++++ .../var/atomicOr/8d96a0.wgsl.expected.hlsl | 24 ++ .../gen/var/atomicOr/8d96a0.wgsl.expected.msl | 22 ++ .../var/atomicOr/8d96a0.wgsl.expected.spvasm | 57 ++++ .../var/atomicOr/8d96a0.wgsl.expected.wgsl | 20 ++ .../builtins/gen/var/atomicOr/d09248.wgsl | 36 +++ .../var/atomicOr/d09248.wgsl.expected.glsl | 21 ++ .../var/atomicOr/d09248.wgsl.expected.hlsl | 27 ++ .../gen/var/atomicOr/d09248.wgsl.expected.msl | 22 ++ .../var/atomicOr/d09248.wgsl.expected.spvasm | 57 ++++ .../var/atomicOr/d09248.wgsl.expected.wgsl | 11 + .../builtins/gen/var/atomicStore/726882.wgsl | 36 +++ .../var/atomicStore/726882.wgsl.expected.glsl | 21 ++ .../var/atomicStore/726882.wgsl.expected.hlsl | 26 ++ .../var/atomicStore/726882.wgsl.expected.msl | 22 ++ .../atomicStore/726882.wgsl.expected.spvasm | 53 ++++ .../var/atomicStore/726882.wgsl.expected.wgsl | 11 + .../builtins/gen/var/atomicStore/8bea94.wgsl | 36 +++ .../var/atomicStore/8bea94.wgsl.expected.glsl | 21 ++ .../var/atomicStore/8bea94.wgsl.expected.hlsl | 26 ++ .../var/atomicStore/8bea94.wgsl.expected.msl | 22 ++ .../atomicStore/8bea94.wgsl.expected.spvasm | 54 ++++ .../var/atomicStore/8bea94.wgsl.expected.wgsl | 11 + .../builtins/gen/var/atomicStore/cdc29e.wgsl | 44 ++++ .../var/atomicStore/cdc29e.wgsl.expected.glsl | 46 ++++ .../var/atomicStore/cdc29e.wgsl.expected.hlsl | 23 ++ .../var/atomicStore/cdc29e.wgsl.expected.msl | 22 ++ .../atomicStore/cdc29e.wgsl.expected.spvasm | 52 ++++ .../var/atomicStore/cdc29e.wgsl.expected.wgsl | 20 ++ .../builtins/gen/var/atomicStore/d1e9a6.wgsl | 44 ++++ .../var/atomicStore/d1e9a6.wgsl.expected.glsl | 46 ++++ .../var/atomicStore/d1e9a6.wgsl.expected.hlsl | 23 ++ .../var/atomicStore/d1e9a6.wgsl.expected.msl | 22 ++ .../atomicStore/d1e9a6.wgsl.expected.spvasm | 54 ++++ .../var/atomicStore/d1e9a6.wgsl.expected.wgsl | 20 ++ .../builtins/gen/var/atomicSub/051100.wgsl | 44 ++++ .../var/atomicSub/051100.wgsl.expected.glsl | 46 ++++ .../var/atomicSub/051100.wgsl.expected.hlsl | 24 ++ .../var/atomicSub/051100.wgsl.expected.msl | 22 ++ .../var/atomicSub/051100.wgsl.expected.spvasm | 57 ++++ .../var/atomicSub/051100.wgsl.expected.wgsl | 20 ++ .../builtins/gen/var/atomicSub/0d26c2.wgsl | 36 +++ .../var/atomicSub/0d26c2.wgsl.expected.glsl | 21 ++ .../var/atomicSub/0d26c2.wgsl.expected.hlsl | 27 ++ .../var/atomicSub/0d26c2.wgsl.expected.msl | 22 ++ .../var/atomicSub/0d26c2.wgsl.expected.spvasm | 56 ++++ .../var/atomicSub/0d26c2.wgsl.expected.wgsl | 11 + .../builtins/gen/var/atomicSub/15bfc9.wgsl | 44 ++++ .../var/atomicSub/15bfc9.wgsl.expected.glsl | 46 ++++ .../var/atomicSub/15bfc9.wgsl.expected.hlsl | 24 ++ .../var/atomicSub/15bfc9.wgsl.expected.msl | 22 ++ .../var/atomicSub/15bfc9.wgsl.expected.spvasm | 55 ++++ .../var/atomicSub/15bfc9.wgsl.expected.wgsl | 20 ++ .../builtins/gen/var/atomicSub/77883a.wgsl | 36 +++ .../var/atomicSub/77883a.wgsl.expected.glsl | 21 ++ .../var/atomicSub/77883a.wgsl.expected.hlsl | 27 ++ .../var/atomicSub/77883a.wgsl.expected.msl | 22 ++ .../var/atomicSub/77883a.wgsl.expected.spvasm | 57 ++++ .../var/atomicSub/77883a.wgsl.expected.wgsl | 11 + .../builtins/gen/var/atomicXor/54510e.wgsl | 44 ++++ .../var/atomicXor/54510e.wgsl.expected.glsl | 46 ++++ .../var/atomicXor/54510e.wgsl.expected.hlsl | 24 ++ .../var/atomicXor/54510e.wgsl.expected.msl | 22 ++ .../var/atomicXor/54510e.wgsl.expected.spvasm | 55 ++++ .../var/atomicXor/54510e.wgsl.expected.wgsl | 20 ++ .../builtins/gen/var/atomicXor/75dc95.wgsl | 36 +++ .../var/atomicXor/75dc95.wgsl.expected.glsl | 21 ++ .../var/atomicXor/75dc95.wgsl.expected.hlsl | 27 ++ .../var/atomicXor/75dc95.wgsl.expected.msl | 22 ++ .../var/atomicXor/75dc95.wgsl.expected.spvasm | 57 ++++ .../var/atomicXor/75dc95.wgsl.expected.wgsl | 11 + .../builtins/gen/var/atomicXor/c1b78c.wgsl | 44 ++++ .../var/atomicXor/c1b78c.wgsl.expected.glsl | 46 ++++ .../var/atomicXor/c1b78c.wgsl.expected.hlsl | 24 ++ .../var/atomicXor/c1b78c.wgsl.expected.msl | 22 ++ .../var/atomicXor/c1b78c.wgsl.expected.spvasm | 57 ++++ .../var/atomicXor/c1b78c.wgsl.expected.wgsl | 20 ++ .../builtins/gen/var/atomicXor/c8e6be.wgsl | 36 +++ .../var/atomicXor/c8e6be.wgsl.expected.glsl | 21 ++ .../var/atomicXor/c8e6be.wgsl.expected.hlsl | 27 ++ .../var/atomicXor/c8e6be.wgsl.expected.msl | 22 ++ .../var/atomicXor/c8e6be.wgsl.expected.spvasm | 56 ++++ .../var/atomicXor/c8e6be.wgsl.expected.wgsl | 11 + test/tint/builtins/gen/var/ceil/34064b.wgsl | 46 ++++ .../gen/var/ceil/34064b.wgsl.expected.glsl | 52 ++++ .../gen/var/ceil/34064b.wgsl.expected.hlsl | 31 +++ .../gen/var/ceil/34064b.wgsl.expected.msl | 34 +++ .../gen/var/ceil/34064b.wgsl.expected.spvasm | 71 +++++ .../gen/var/ceil/34064b.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/ceil/678655.wgsl | 46 ++++ .../gen/var/ceil/678655.wgsl.expected.glsl | 52 ++++ .../gen/var/ceil/678655.wgsl.expected.hlsl | 31 +++ .../gen/var/ceil/678655.wgsl.expected.msl | 34 +++ .../gen/var/ceil/678655.wgsl.expected.spvasm | 69 +++++ .../gen/var/ceil/678655.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/ceil/96f597.wgsl | 46 ++++ .../gen/var/ceil/96f597.wgsl.expected.glsl | 52 ++++ .../gen/var/ceil/96f597.wgsl.expected.hlsl | 31 +++ .../gen/var/ceil/96f597.wgsl.expected.msl | 34 +++ .../gen/var/ceil/96f597.wgsl.expected.spvasm | 71 +++++ .../gen/var/ceil/96f597.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/ceil/b74c16.wgsl | 46 ++++ .../gen/var/ceil/b74c16.wgsl.expected.glsl | 52 ++++ .../gen/var/ceil/b74c16.wgsl.expected.hlsl | 31 +++ .../gen/var/ceil/b74c16.wgsl.expected.msl | 34 +++ .../gen/var/ceil/b74c16.wgsl.expected.spvasm | 69 +++++ .../gen/var/ceil/b74c16.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/clamp/0acf8f.wgsl | 48 ++++ .../gen/var/clamp/0acf8f.wgsl.expected.glsl | 58 +++++ .../gen/var/clamp/0acf8f.wgsl.expected.hlsl | 33 +++ .../gen/var/clamp/0acf8f.wgsl.expected.msl | 36 +++ .../gen/var/clamp/0acf8f.wgsl.expected.spvasm | 79 ++++++ .../gen/var/clamp/0acf8f.wgsl.expected.wgsl | 22 ++ test/tint/builtins/gen/var/clamp/1a32e3.wgsl | 48 ++++ .../gen/var/clamp/1a32e3.wgsl.expected.glsl | 58 +++++ .../gen/var/clamp/1a32e3.wgsl.expected.hlsl | 33 +++ .../gen/var/clamp/1a32e3.wgsl.expected.msl | 36 +++ .../gen/var/clamp/1a32e3.wgsl.expected.spvasm | 80 ++++++ .../gen/var/clamp/1a32e3.wgsl.expected.wgsl | 22 ++ test/tint/builtins/gen/var/clamp/2bd567.wgsl | 48 ++++ .../gen/var/clamp/2bd567.wgsl.expected.glsl | 58 +++++ .../gen/var/clamp/2bd567.wgsl.expected.hlsl | 33 +++ .../gen/var/clamp/2bd567.wgsl.expected.msl | 36 +++ .../gen/var/clamp/2bd567.wgsl.expected.spvasm | 77 ++++++ .../gen/var/clamp/2bd567.wgsl.expected.wgsl | 22 ++ test/tint/builtins/gen/var/clamp/2bde41.wgsl | 48 ++++ .../gen/var/clamp/2bde41.wgsl.expected.glsl | 58 +++++ .../gen/var/clamp/2bde41.wgsl.expected.hlsl | 33 +++ .../gen/var/clamp/2bde41.wgsl.expected.msl | 36 +++ .../gen/var/clamp/2bde41.wgsl.expected.spvasm | 77 ++++++ .../gen/var/clamp/2bde41.wgsl.expected.wgsl | 22 ++ test/tint/builtins/gen/var/clamp/548fc7.wgsl | 48 ++++ .../gen/var/clamp/548fc7.wgsl.expected.glsl | 58 +++++ .../gen/var/clamp/548fc7.wgsl.expected.hlsl | 33 +++ .../gen/var/clamp/548fc7.wgsl.expected.msl | 36 +++ .../gen/var/clamp/548fc7.wgsl.expected.spvasm | 80 ++++++ .../gen/var/clamp/548fc7.wgsl.expected.wgsl | 22 ++ test/tint/builtins/gen/var/clamp/5f0819.wgsl | 48 ++++ .../gen/var/clamp/5f0819.wgsl.expected.glsl | 58 +++++ .../gen/var/clamp/5f0819.wgsl.expected.hlsl | 33 +++ .../gen/var/clamp/5f0819.wgsl.expected.msl | 36 +++ .../gen/var/clamp/5f0819.wgsl.expected.spvasm | 80 ++++++ .../gen/var/clamp/5f0819.wgsl.expected.wgsl | 22 ++ test/tint/builtins/gen/var/clamp/6c1749.wgsl | 48 ++++ .../gen/var/clamp/6c1749.wgsl.expected.glsl | 58 +++++ .../gen/var/clamp/6c1749.wgsl.expected.hlsl | 33 +++ .../gen/var/clamp/6c1749.wgsl.expected.msl | 36 +++ .../gen/var/clamp/6c1749.wgsl.expected.spvasm | 80 ++++++ .../gen/var/clamp/6c1749.wgsl.expected.wgsl | 22 ++ test/tint/builtins/gen/var/clamp/7706d7.wgsl | 48 ++++ .../gen/var/clamp/7706d7.wgsl.expected.glsl | 58 +++++ .../gen/var/clamp/7706d7.wgsl.expected.hlsl | 33 +++ .../gen/var/clamp/7706d7.wgsl.expected.msl | 36 +++ .../gen/var/clamp/7706d7.wgsl.expected.spvasm | 80 ++++++ .../gen/var/clamp/7706d7.wgsl.expected.wgsl | 22 ++ test/tint/builtins/gen/var/clamp/867397.wgsl | 48 ++++ .../gen/var/clamp/867397.wgsl.expected.glsl | 58 +++++ .../gen/var/clamp/867397.wgsl.expected.hlsl | 33 +++ .../gen/var/clamp/867397.wgsl.expected.msl | 36 +++ .../gen/var/clamp/867397.wgsl.expected.spvasm | 79 ++++++ .../gen/var/clamp/867397.wgsl.expected.wgsl | 22 ++ test/tint/builtins/gen/var/clamp/a2de25.wgsl | 48 ++++ .../gen/var/clamp/a2de25.wgsl.expected.glsl | 58 +++++ .../gen/var/clamp/a2de25.wgsl.expected.hlsl | 33 +++ .../gen/var/clamp/a2de25.wgsl.expected.msl | 36 +++ .../gen/var/clamp/a2de25.wgsl.expected.spvasm | 80 ++++++ .../gen/var/clamp/a2de25.wgsl.expected.wgsl | 22 ++ test/tint/builtins/gen/var/clamp/b07c65.wgsl | 48 ++++ .../gen/var/clamp/b07c65.wgsl.expected.glsl | 58 +++++ .../gen/var/clamp/b07c65.wgsl.expected.hlsl | 33 +++ .../gen/var/clamp/b07c65.wgsl.expected.msl | 36 +++ .../gen/var/clamp/b07c65.wgsl.expected.spvasm | 80 ++++++ .../gen/var/clamp/b07c65.wgsl.expected.wgsl | 22 ++ test/tint/builtins/gen/var/clamp/bd43ce.wgsl | 48 ++++ .../gen/var/clamp/bd43ce.wgsl.expected.glsl | 58 +++++ .../gen/var/clamp/bd43ce.wgsl.expected.hlsl | 33 +++ .../gen/var/clamp/bd43ce.wgsl.expected.msl | 36 +++ .../gen/var/clamp/bd43ce.wgsl.expected.spvasm | 80 ++++++ .../gen/var/clamp/bd43ce.wgsl.expected.wgsl | 22 ++ test/tint/builtins/gen/var/cos/16dc15.wgsl | 46 ++++ .../gen/var/cos/16dc15.wgsl.expected.glsl | 52 ++++ .../gen/var/cos/16dc15.wgsl.expected.hlsl | 31 +++ .../gen/var/cos/16dc15.wgsl.expected.msl | 34 +++ .../gen/var/cos/16dc15.wgsl.expected.spvasm | 71 +++++ .../gen/var/cos/16dc15.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/cos/29d66d.wgsl | 46 ++++ .../gen/var/cos/29d66d.wgsl.expected.glsl | 52 ++++ .../gen/var/cos/29d66d.wgsl.expected.hlsl | 31 +++ .../gen/var/cos/29d66d.wgsl.expected.msl | 34 +++ .../gen/var/cos/29d66d.wgsl.expected.spvasm | 69 +++++ .../gen/var/cos/29d66d.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/cos/c3b486.wgsl | 46 ++++ .../gen/var/cos/c3b486.wgsl.expected.glsl | 52 ++++ .../gen/var/cos/c3b486.wgsl.expected.hlsl | 31 +++ .../gen/var/cos/c3b486.wgsl.expected.msl | 34 +++ .../gen/var/cos/c3b486.wgsl.expected.spvasm | 71 +++++ .../gen/var/cos/c3b486.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/cos/c5c28e.wgsl | 46 ++++ .../gen/var/cos/c5c28e.wgsl.expected.glsl | 52 ++++ .../gen/var/cos/c5c28e.wgsl.expected.hlsl | 31 +++ .../gen/var/cos/c5c28e.wgsl.expected.msl | 34 +++ .../gen/var/cos/c5c28e.wgsl.expected.spvasm | 69 +++++ .../gen/var/cos/c5c28e.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/cosh/377652.wgsl | 46 ++++ .../gen/var/cosh/377652.wgsl.expected.glsl | 52 ++++ .../gen/var/cosh/377652.wgsl.expected.hlsl | 31 +++ .../gen/var/cosh/377652.wgsl.expected.msl | 34 +++ .../gen/var/cosh/377652.wgsl.expected.spvasm | 71 +++++ .../gen/var/cosh/377652.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/cosh/c13756.wgsl | 46 ++++ .../gen/var/cosh/c13756.wgsl.expected.glsl | 52 ++++ .../gen/var/cosh/c13756.wgsl.expected.hlsl | 31 +++ .../gen/var/cosh/c13756.wgsl.expected.msl | 34 +++ .../gen/var/cosh/c13756.wgsl.expected.spvasm | 71 +++++ .../gen/var/cosh/c13756.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/cosh/da92dd.wgsl | 46 ++++ .../gen/var/cosh/da92dd.wgsl.expected.glsl | 52 ++++ .../gen/var/cosh/da92dd.wgsl.expected.hlsl | 31 +++ .../gen/var/cosh/da92dd.wgsl.expected.msl | 34 +++ .../gen/var/cosh/da92dd.wgsl.expected.spvasm | 69 +++++ .../gen/var/cosh/da92dd.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/cosh/e0c1de.wgsl | 46 ++++ .../gen/var/cosh/e0c1de.wgsl.expected.glsl | 52 ++++ .../gen/var/cosh/e0c1de.wgsl.expected.hlsl | 31 +++ .../gen/var/cosh/e0c1de.wgsl.expected.msl | 34 +++ .../gen/var/cosh/e0c1de.wgsl.expected.spvasm | 69 +++++ .../gen/var/cosh/e0c1de.wgsl.expected.wgsl | 20 ++ .../gen/var/countLeadingZeros/208d46.wgsl | 46 ++++ .../208d46.wgsl.expected.glsl | 97 +++++++ .../208d46.wgsl.expected.hlsl | 46 ++++ .../208d46.wgsl.expected.msl | 34 +++ .../208d46.wgsl.expected.spvasm | 127 +++++++++ .../208d46.wgsl.expected.wgsl | 20 ++ .../gen/var/countLeadingZeros/6d4656.wgsl | 46 ++++ .../6d4656.wgsl.expected.glsl | 97 +++++++ .../6d4656.wgsl.expected.hlsl | 46 ++++ .../6d4656.wgsl.expected.msl | 34 +++ .../6d4656.wgsl.expected.spvasm | 133 ++++++++++ .../6d4656.wgsl.expected.wgsl | 20 ++ .../gen/var/countLeadingZeros/70783f.wgsl | 46 ++++ .../70783f.wgsl.expected.glsl | 97 +++++++ .../70783f.wgsl.expected.hlsl | 46 ++++ .../70783f.wgsl.expected.msl | 34 +++ .../70783f.wgsl.expected.spvasm | 139 ++++++++++ .../70783f.wgsl.expected.wgsl | 20 ++ .../gen/var/countLeadingZeros/7c38a6.wgsl | 46 ++++ .../7c38a6.wgsl.expected.glsl | 97 +++++++ .../7c38a6.wgsl.expected.hlsl | 46 ++++ .../7c38a6.wgsl.expected.msl | 34 +++ .../7c38a6.wgsl.expected.spvasm | 145 +++++++++++ .../7c38a6.wgsl.expected.wgsl | 20 ++ .../gen/var/countLeadingZeros/858d40.wgsl | 46 ++++ .../858d40.wgsl.expected.glsl | 97 +++++++ .../858d40.wgsl.expected.hlsl | 46 ++++ .../858d40.wgsl.expected.msl | 34 +++ .../858d40.wgsl.expected.spvasm | 145 +++++++++++ .../858d40.wgsl.expected.wgsl | 20 ++ .../gen/var/countLeadingZeros/ab6345.wgsl | 46 ++++ .../ab6345.wgsl.expected.glsl | 97 +++++++ .../ab6345.wgsl.expected.hlsl | 46 ++++ .../ab6345.wgsl.expected.msl | 34 +++ .../ab6345.wgsl.expected.spvasm | 139 ++++++++++ .../ab6345.wgsl.expected.wgsl | 20 ++ .../gen/var/countLeadingZeros/eab32b.wgsl | 46 ++++ .../eab32b.wgsl.expected.glsl | 97 +++++++ .../eab32b.wgsl.expected.hlsl | 46 ++++ .../eab32b.wgsl.expected.msl | 34 +++ .../eab32b.wgsl.expected.spvasm | 145 +++++++++++ .../eab32b.wgsl.expected.wgsl | 20 ++ .../gen/var/countLeadingZeros/f70103.wgsl | 46 ++++ .../f70103.wgsl.expected.glsl | 97 +++++++ .../f70103.wgsl.expected.hlsl | 46 ++++ .../f70103.wgsl.expected.msl | 34 +++ .../f70103.wgsl.expected.spvasm | 139 ++++++++++ .../f70103.wgsl.expected.wgsl | 20 ++ .../builtins/gen/var/countOneBits/0d0e46.wgsl | 46 ++++ .../countOneBits/0d0e46.wgsl.expected.glsl | 52 ++++ .../countOneBits/0d0e46.wgsl.expected.hlsl | 31 +++ .../var/countOneBits/0d0e46.wgsl.expected.msl | 34 +++ .../countOneBits/0d0e46.wgsl.expected.spvasm | 71 +++++ .../countOneBits/0d0e46.wgsl.expected.wgsl | 20 ++ .../builtins/gen/var/countOneBits/0f7980.wgsl | 46 ++++ .../countOneBits/0f7980.wgsl.expected.glsl | 52 ++++ .../countOneBits/0f7980.wgsl.expected.hlsl | 31 +++ .../var/countOneBits/0f7980.wgsl.expected.msl | 34 +++ .../countOneBits/0f7980.wgsl.expected.spvasm | 71 +++++ .../countOneBits/0f7980.wgsl.expected.wgsl | 20 ++ .../builtins/gen/var/countOneBits/65d2ae.wgsl | 46 ++++ .../countOneBits/65d2ae.wgsl.expected.glsl | 52 ++++ .../countOneBits/65d2ae.wgsl.expected.hlsl | 31 +++ .../var/countOneBits/65d2ae.wgsl.expected.msl | 34 +++ .../countOneBits/65d2ae.wgsl.expected.spvasm | 71 +++++ .../countOneBits/65d2ae.wgsl.expected.wgsl | 20 ++ .../builtins/gen/var/countOneBits/690cfc.wgsl | 46 ++++ .../countOneBits/690cfc.wgsl.expected.glsl | 52 ++++ .../countOneBits/690cfc.wgsl.expected.hlsl | 31 +++ .../var/countOneBits/690cfc.wgsl.expected.msl | 34 +++ .../countOneBits/690cfc.wgsl.expected.spvasm | 71 +++++ .../countOneBits/690cfc.wgsl.expected.wgsl | 20 ++ .../builtins/gen/var/countOneBits/94fd81.wgsl | 46 ++++ .../countOneBits/94fd81.wgsl.expected.glsl | 52 ++++ .../countOneBits/94fd81.wgsl.expected.hlsl | 31 +++ .../var/countOneBits/94fd81.wgsl.expected.msl | 34 +++ .../countOneBits/94fd81.wgsl.expected.spvasm | 71 +++++ .../countOneBits/94fd81.wgsl.expected.wgsl | 20 ++ .../builtins/gen/var/countOneBits/ae44f9.wgsl | 46 ++++ .../countOneBits/ae44f9.wgsl.expected.glsl | 52 ++++ .../countOneBits/ae44f9.wgsl.expected.hlsl | 31 +++ .../var/countOneBits/ae44f9.wgsl.expected.msl | 34 +++ .../countOneBits/ae44f9.wgsl.expected.spvasm | 71 +++++ .../countOneBits/ae44f9.wgsl.expected.wgsl | 20 ++ .../builtins/gen/var/countOneBits/af90e2.wgsl | 46 ++++ .../countOneBits/af90e2.wgsl.expected.glsl | 52 ++++ .../countOneBits/af90e2.wgsl.expected.hlsl | 31 +++ .../var/countOneBits/af90e2.wgsl.expected.msl | 34 +++ .../countOneBits/af90e2.wgsl.expected.spvasm | 71 +++++ .../countOneBits/af90e2.wgsl.expected.wgsl | 20 ++ .../builtins/gen/var/countOneBits/fd88b2.wgsl | 46 ++++ .../countOneBits/fd88b2.wgsl.expected.glsl | 52 ++++ .../countOneBits/fd88b2.wgsl.expected.hlsl | 31 +++ .../var/countOneBits/fd88b2.wgsl.expected.msl | 34 +++ .../countOneBits/fd88b2.wgsl.expected.spvasm | 71 +++++ .../countOneBits/fd88b2.wgsl.expected.wgsl | 20 ++ .../gen/var/countTrailingZeros/1ad138.wgsl | 46 ++++ .../1ad138.wgsl.expected.glsl | 97 +++++++ .../1ad138.wgsl.expected.hlsl | 46 ++++ .../1ad138.wgsl.expected.msl | 34 +++ .../1ad138.wgsl.expected.spvasm | 142 ++++++++++ .../1ad138.wgsl.expected.wgsl | 20 ++ .../gen/var/countTrailingZeros/1dc84a.wgsl | 46 ++++ .../1dc84a.wgsl.expected.glsl | 97 +++++++ .../1dc84a.wgsl.expected.hlsl | 46 ++++ .../1dc84a.wgsl.expected.msl | 34 +++ .../1dc84a.wgsl.expected.spvasm | 148 +++++++++++ .../1dc84a.wgsl.expected.wgsl | 20 ++ .../gen/var/countTrailingZeros/21e394.wgsl | 46 ++++ .../21e394.wgsl.expected.glsl | 97 +++++++ .../21e394.wgsl.expected.hlsl | 46 ++++ .../21e394.wgsl.expected.msl | 34 +++ .../21e394.wgsl.expected.spvasm | 131 ++++++++++ .../21e394.wgsl.expected.wgsl | 20 ++ .../gen/var/countTrailingZeros/327c37.wgsl | 46 ++++ .../327c37.wgsl.expected.glsl | 97 +++++++ .../327c37.wgsl.expected.hlsl | 46 ++++ .../327c37.wgsl.expected.msl | 34 +++ .../327c37.wgsl.expected.spvasm | 148 +++++++++++ .../327c37.wgsl.expected.wgsl | 20 ++ .../gen/var/countTrailingZeros/42fed6.wgsl | 46 ++++ .../42fed6.wgsl.expected.glsl | 97 +++++++ .../42fed6.wgsl.expected.hlsl | 46 ++++ .../42fed6.wgsl.expected.msl | 34 +++ .../42fed6.wgsl.expected.spvasm | 137 ++++++++++ .../42fed6.wgsl.expected.wgsl | 20 ++ .../gen/var/countTrailingZeros/8ed26f.wgsl | 46 ++++ .../8ed26f.wgsl.expected.glsl | 97 +++++++ .../8ed26f.wgsl.expected.hlsl | 46 ++++ .../8ed26f.wgsl.expected.msl | 34 +++ .../8ed26f.wgsl.expected.spvasm | 142 ++++++++++ .../8ed26f.wgsl.expected.wgsl | 20 ++ .../gen/var/countTrailingZeros/acfacb.wgsl | 46 ++++ .../acfacb.wgsl.expected.glsl | 97 +++++++ .../acfacb.wgsl.expected.hlsl | 46 ++++ .../acfacb.wgsl.expected.msl | 34 +++ .../acfacb.wgsl.expected.spvasm | 148 +++++++++++ .../acfacb.wgsl.expected.wgsl | 20 ++ .../gen/var/countTrailingZeros/d2b4a0.wgsl | 46 ++++ .../d2b4a0.wgsl.expected.glsl | 97 +++++++ .../d2b4a0.wgsl.expected.hlsl | 46 ++++ .../d2b4a0.wgsl.expected.msl | 34 +++ .../d2b4a0.wgsl.expected.spvasm | 142 ++++++++++ .../d2b4a0.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/cross/041cb0.wgsl | 47 ++++ .../gen/var/cross/041cb0.wgsl.expected.glsl | 55 ++++ .../gen/var/cross/041cb0.wgsl.expected.hlsl | 32 +++ .../gen/var/cross/041cb0.wgsl.expected.msl | 35 +++ .../gen/var/cross/041cb0.wgsl.expected.spvasm | 75 ++++++ .../gen/var/cross/041cb0.wgsl.expected.wgsl | 21 ++ .../tint/builtins/gen/var/degrees/0d170c.wgsl | 46 ++++ .../gen/var/degrees/0d170c.wgsl.expected.glsl | 67 +++++ .../gen/var/degrees/0d170c.wgsl.expected.hlsl | 35 +++ .../gen/var/degrees/0d170c.wgsl.expected.msl | 39 +++ .../var/degrees/0d170c.wgsl.expected.spvasm | 69 +++++ .../gen/var/degrees/0d170c.wgsl.expected.wgsl | 20 ++ .../tint/builtins/gen/var/degrees/1ad5df.wgsl | 46 ++++ .../gen/var/degrees/1ad5df.wgsl.expected.glsl | 67 +++++ .../gen/var/degrees/1ad5df.wgsl.expected.hlsl | 35 +++ .../gen/var/degrees/1ad5df.wgsl.expected.msl | 39 +++ .../var/degrees/1ad5df.wgsl.expected.spvasm | 71 +++++ .../gen/var/degrees/1ad5df.wgsl.expected.wgsl | 20 ++ .../tint/builtins/gen/var/degrees/2af623.wgsl | 46 ++++ .../gen/var/degrees/2af623.wgsl.expected.glsl | 67 +++++ .../gen/var/degrees/2af623.wgsl.expected.hlsl | 35 +++ .../gen/var/degrees/2af623.wgsl.expected.msl | 39 +++ .../var/degrees/2af623.wgsl.expected.spvasm | 71 +++++ .../gen/var/degrees/2af623.wgsl.expected.wgsl | 20 ++ .../tint/builtins/gen/var/degrees/51f705.wgsl | 46 ++++ .../gen/var/degrees/51f705.wgsl.expected.glsl | 67 +++++ .../gen/var/degrees/51f705.wgsl.expected.hlsl | 35 +++ .../gen/var/degrees/51f705.wgsl.expected.msl | 39 +++ .../var/degrees/51f705.wgsl.expected.spvasm | 69 +++++ .../gen/var/degrees/51f705.wgsl.expected.wgsl | 20 ++ .../builtins/gen/var/determinant/2b62ba.wgsl | 46 ++++ .../var/determinant/2b62ba.wgsl.expected.glsl | 52 ++++ .../var/determinant/2b62ba.wgsl.expected.hlsl | 31 +++ .../var/determinant/2b62ba.wgsl.expected.msl | 34 +++ .../determinant/2b62ba.wgsl.expected.spvasm | 73 ++++++ .../var/determinant/2b62ba.wgsl.expected.wgsl | 20 ++ .../builtins/gen/var/determinant/a0a87c.wgsl | 46 ++++ .../var/determinant/a0a87c.wgsl.expected.glsl | 52 ++++ .../var/determinant/a0a87c.wgsl.expected.hlsl | 31 +++ .../var/determinant/a0a87c.wgsl.expected.msl | 34 +++ .../determinant/a0a87c.wgsl.expected.spvasm | 72 ++++++ .../var/determinant/a0a87c.wgsl.expected.wgsl | 20 ++ .../builtins/gen/var/determinant/e19305.wgsl | 46 ++++ .../var/determinant/e19305.wgsl.expected.glsl | 52 ++++ .../var/determinant/e19305.wgsl.expected.hlsl | 31 +++ .../var/determinant/e19305.wgsl.expected.msl | 34 +++ .../determinant/e19305.wgsl.expected.spvasm | 73 ++++++ .../var/determinant/e19305.wgsl.expected.wgsl | 20 ++ .../builtins/gen/var/distance/0657d4.wgsl | 47 ++++ .../var/distance/0657d4.wgsl.expected.glsl | 55 ++++ .../var/distance/0657d4.wgsl.expected.hlsl | 32 +++ .../gen/var/distance/0657d4.wgsl.expected.msl | 35 +++ .../var/distance/0657d4.wgsl.expected.spvasm | 76 ++++++ .../var/distance/0657d4.wgsl.expected.wgsl | 21 ++ .../builtins/gen/var/distance/9646ea.wgsl | 47 ++++ .../var/distance/9646ea.wgsl.expected.glsl | 55 ++++ .../var/distance/9646ea.wgsl.expected.hlsl | 32 +++ .../gen/var/distance/9646ea.wgsl.expected.msl | 35 +++ .../var/distance/9646ea.wgsl.expected.spvasm | 74 ++++++ .../var/distance/9646ea.wgsl.expected.wgsl | 21 ++ .../builtins/gen/var/distance/aa4055.wgsl | 47 ++++ .../var/distance/aa4055.wgsl.expected.glsl | 55 ++++ .../var/distance/aa4055.wgsl.expected.hlsl | 32 +++ .../gen/var/distance/aa4055.wgsl.expected.msl | 35 +++ .../var/distance/aa4055.wgsl.expected.spvasm | 76 ++++++ .../var/distance/aa4055.wgsl.expected.wgsl | 21 ++ .../builtins/gen/var/distance/cfed73.wgsl | 47 ++++ .../var/distance/cfed73.wgsl.expected.glsl | 55 ++++ .../var/distance/cfed73.wgsl.expected.hlsl | 32 +++ .../gen/var/distance/cfed73.wgsl.expected.msl | 35 +++ .../var/distance/cfed73.wgsl.expected.spvasm | 73 ++++++ .../var/distance/cfed73.wgsl.expected.wgsl | 21 ++ test/tint/builtins/gen/var/dot/0c577b.wgsl | 47 ++++ .../gen/var/dot/0c577b.wgsl.expected.glsl | 55 ++++ .../gen/var/dot/0c577b.wgsl.expected.hlsl | 32 +++ .../gen/var/dot/0c577b.wgsl.expected.msl | 35 +++ .../gen/var/dot/0c577b.wgsl.expected.spvasm | 73 ++++++ .../gen/var/dot/0c577b.wgsl.expected.wgsl | 21 ++ test/tint/builtins/gen/var/dot/7548a0.wgsl | 47 ++++ .../gen/var/dot/7548a0.wgsl.expected.glsl | 67 +++++ .../gen/var/dot/7548a0.wgsl.expected.hlsl | 32 +++ .../gen/var/dot/7548a0.wgsl.expected.msl | 40 +++ .../gen/var/dot/7548a0.wgsl.expected.spvasm | 87 +++++++ .../gen/var/dot/7548a0.wgsl.expected.wgsl | 21 ++ test/tint/builtins/gen/var/dot/883f0e.wgsl | 47 ++++ .../gen/var/dot/883f0e.wgsl.expected.glsl | 55 ++++ .../gen/var/dot/883f0e.wgsl.expected.hlsl | 32 +++ .../gen/var/dot/883f0e.wgsl.expected.msl | 35 +++ .../gen/var/dot/883f0e.wgsl.expected.spvasm | 75 ++++++ .../gen/var/dot/883f0e.wgsl.expected.wgsl | 21 ++ test/tint/builtins/gen/var/dot/97c7ee.wgsl | 47 ++++ .../gen/var/dot/97c7ee.wgsl.expected.glsl | 67 +++++ .../gen/var/dot/97c7ee.wgsl.expected.hlsl | 32 +++ .../gen/var/dot/97c7ee.wgsl.expected.msl | 40 +++ .../gen/var/dot/97c7ee.wgsl.expected.spvasm | 83 ++++++ .../gen/var/dot/97c7ee.wgsl.expected.wgsl | 21 ++ test/tint/builtins/gen/var/dot/ba4246.wgsl | 47 ++++ .../gen/var/dot/ba4246.wgsl.expected.glsl | 55 ++++ .../gen/var/dot/ba4246.wgsl.expected.hlsl | 32 +++ .../gen/var/dot/ba4246.wgsl.expected.msl | 35 +++ .../gen/var/dot/ba4246.wgsl.expected.spvasm | 75 ++++++ .../gen/var/dot/ba4246.wgsl.expected.wgsl | 21 ++ test/tint/builtins/gen/var/dot/e994c7.wgsl | 47 ++++ .../gen/var/dot/e994c7.wgsl.expected.glsl | 67 +++++ .../gen/var/dot/e994c7.wgsl.expected.hlsl | 32 +++ .../gen/var/dot/e994c7.wgsl.expected.msl | 40 +++ .../gen/var/dot/e994c7.wgsl.expected.spvasm | 91 +++++++ .../gen/var/dot/e994c7.wgsl.expected.wgsl | 21 ++ test/tint/builtins/gen/var/dot/ef6b1d.wgsl | 47 ++++ .../gen/var/dot/ef6b1d.wgsl.expected.glsl | 67 +++++ .../gen/var/dot/ef6b1d.wgsl.expected.hlsl | 32 +++ .../gen/var/dot/ef6b1d.wgsl.expected.msl | 40 +++ .../gen/var/dot/ef6b1d.wgsl.expected.spvasm | 91 +++++++ .../gen/var/dot/ef6b1d.wgsl.expected.wgsl | 21 ++ test/tint/builtins/gen/var/dot/f1312c.wgsl | 47 ++++ .../gen/var/dot/f1312c.wgsl.expected.glsl | 67 +++++ .../gen/var/dot/f1312c.wgsl.expected.hlsl | 32 +++ .../gen/var/dot/f1312c.wgsl.expected.msl | 40 +++ .../gen/var/dot/f1312c.wgsl.expected.spvasm | 87 +++++++ .../gen/var/dot/f1312c.wgsl.expected.wgsl | 21 ++ test/tint/builtins/gen/var/dot/fc5f7c.wgsl | 47 ++++ .../gen/var/dot/fc5f7c.wgsl.expected.glsl | 67 +++++ .../gen/var/dot/fc5f7c.wgsl.expected.hlsl | 32 +++ .../gen/var/dot/fc5f7c.wgsl.expected.msl | 40 +++ .../gen/var/dot/fc5f7c.wgsl.expected.spvasm | 83 ++++++ .../gen/var/dot/fc5f7c.wgsl.expected.wgsl | 21 ++ test/tint/builtins/gen/var/dpdx/0763f7.wgsl | 35 +++ .../gen/var/dpdx/0763f7.wgsl.expected.glsl | 16 ++ .../gen/var/dpdx/0763f7.wgsl.expected.hlsl | 9 + .../gen/var/dpdx/0763f7.wgsl.expected.msl | 13 + .../gen/var/dpdx/0763f7.wgsl.expected.spvasm | 34 +++ .../gen/var/dpdx/0763f7.wgsl.expected.wgsl | 9 + test/tint/builtins/gen/var/dpdx/99edb1.wgsl | 35 +++ .../gen/var/dpdx/99edb1.wgsl.expected.glsl | 16 ++ .../gen/var/dpdx/99edb1.wgsl.expected.hlsl | 9 + .../gen/var/dpdx/99edb1.wgsl.expected.msl | 13 + .../gen/var/dpdx/99edb1.wgsl.expected.spvasm | 34 +++ .../gen/var/dpdx/99edb1.wgsl.expected.wgsl | 9 + test/tint/builtins/gen/var/dpdx/c487fa.wgsl | 35 +++ .../gen/var/dpdx/c487fa.wgsl.expected.glsl | 16 ++ .../gen/var/dpdx/c487fa.wgsl.expected.hlsl | 9 + .../gen/var/dpdx/c487fa.wgsl.expected.msl | 13 + .../gen/var/dpdx/c487fa.wgsl.expected.spvasm | 34 +++ .../gen/var/dpdx/c487fa.wgsl.expected.wgsl | 9 + test/tint/builtins/gen/var/dpdx/e263de.wgsl | 35 +++ .../gen/var/dpdx/e263de.wgsl.expected.glsl | 16 ++ .../gen/var/dpdx/e263de.wgsl.expected.hlsl | 9 + .../gen/var/dpdx/e263de.wgsl.expected.msl | 13 + .../gen/var/dpdx/e263de.wgsl.expected.spvasm | 34 +++ .../gen/var/dpdx/e263de.wgsl.expected.wgsl | 9 + .../builtins/gen/var/dpdxCoarse/029152.wgsl | 35 +++ .../var/dpdxCoarse/029152.wgsl.expected.glsl | 16 ++ .../var/dpdxCoarse/029152.wgsl.expected.hlsl | 9 + .../var/dpdxCoarse/029152.wgsl.expected.msl | 13 + .../dpdxCoarse/029152.wgsl.expected.spvasm | 35 +++ .../var/dpdxCoarse/029152.wgsl.expected.wgsl | 9 + .../builtins/gen/var/dpdxCoarse/9581cf.wgsl | 35 +++ .../var/dpdxCoarse/9581cf.wgsl.expected.glsl | 16 ++ .../var/dpdxCoarse/9581cf.wgsl.expected.hlsl | 9 + .../var/dpdxCoarse/9581cf.wgsl.expected.msl | 13 + .../dpdxCoarse/9581cf.wgsl.expected.spvasm | 35 +++ .../var/dpdxCoarse/9581cf.wgsl.expected.wgsl | 9 + .../builtins/gen/var/dpdxCoarse/c28641.wgsl | 35 +++ .../var/dpdxCoarse/c28641.wgsl.expected.glsl | 16 ++ .../var/dpdxCoarse/c28641.wgsl.expected.hlsl | 9 + .../var/dpdxCoarse/c28641.wgsl.expected.msl | 13 + .../dpdxCoarse/c28641.wgsl.expected.spvasm | 35 +++ .../var/dpdxCoarse/c28641.wgsl.expected.wgsl | 9 + .../builtins/gen/var/dpdxCoarse/f64d7b.wgsl | 35 +++ .../var/dpdxCoarse/f64d7b.wgsl.expected.glsl | 16 ++ .../var/dpdxCoarse/f64d7b.wgsl.expected.hlsl | 9 + .../var/dpdxCoarse/f64d7b.wgsl.expected.msl | 13 + .../dpdxCoarse/f64d7b.wgsl.expected.spvasm | 35 +++ .../var/dpdxCoarse/f64d7b.wgsl.expected.wgsl | 9 + .../builtins/gen/var/dpdxFine/8c5069.wgsl | 35 +++ .../var/dpdxFine/8c5069.wgsl.expected.glsl | 16 ++ .../var/dpdxFine/8c5069.wgsl.expected.hlsl | 9 + .../gen/var/dpdxFine/8c5069.wgsl.expected.msl | 13 + .../var/dpdxFine/8c5069.wgsl.expected.spvasm | 35 +++ .../var/dpdxFine/8c5069.wgsl.expected.wgsl | 9 + .../builtins/gen/var/dpdxFine/9631de.wgsl | 35 +++ .../var/dpdxFine/9631de.wgsl.expected.glsl | 16 ++ .../var/dpdxFine/9631de.wgsl.expected.hlsl | 9 + .../gen/var/dpdxFine/9631de.wgsl.expected.msl | 13 + .../var/dpdxFine/9631de.wgsl.expected.spvasm | 35 +++ .../var/dpdxFine/9631de.wgsl.expected.wgsl | 9 + .../builtins/gen/var/dpdxFine/f401a2.wgsl | 35 +++ .../var/dpdxFine/f401a2.wgsl.expected.glsl | 16 ++ .../var/dpdxFine/f401a2.wgsl.expected.hlsl | 9 + .../gen/var/dpdxFine/f401a2.wgsl.expected.msl | 13 + .../var/dpdxFine/f401a2.wgsl.expected.spvasm | 35 +++ .../var/dpdxFine/f401a2.wgsl.expected.wgsl | 9 + .../builtins/gen/var/dpdxFine/f92fb6.wgsl | 35 +++ .../var/dpdxFine/f92fb6.wgsl.expected.glsl | 16 ++ .../var/dpdxFine/f92fb6.wgsl.expected.hlsl | 9 + .../gen/var/dpdxFine/f92fb6.wgsl.expected.msl | 13 + .../var/dpdxFine/f92fb6.wgsl.expected.spvasm | 35 +++ .../var/dpdxFine/f92fb6.wgsl.expected.wgsl | 9 + test/tint/builtins/gen/var/dpdy/699a05.wgsl | 35 +++ .../gen/var/dpdy/699a05.wgsl.expected.glsl | 16 ++ .../gen/var/dpdy/699a05.wgsl.expected.hlsl | 9 + .../gen/var/dpdy/699a05.wgsl.expected.msl | 13 + .../gen/var/dpdy/699a05.wgsl.expected.spvasm | 34 +++ .../gen/var/dpdy/699a05.wgsl.expected.wgsl | 9 + test/tint/builtins/gen/var/dpdy/7f8d84.wgsl | 35 +++ .../gen/var/dpdy/7f8d84.wgsl.expected.glsl | 16 ++ .../gen/var/dpdy/7f8d84.wgsl.expected.hlsl | 9 + .../gen/var/dpdy/7f8d84.wgsl.expected.msl | 13 + .../gen/var/dpdy/7f8d84.wgsl.expected.spvasm | 34 +++ .../gen/var/dpdy/7f8d84.wgsl.expected.wgsl | 9 + test/tint/builtins/gen/var/dpdy/a8b56e.wgsl | 35 +++ .../gen/var/dpdy/a8b56e.wgsl.expected.glsl | 16 ++ .../gen/var/dpdy/a8b56e.wgsl.expected.hlsl | 9 + .../gen/var/dpdy/a8b56e.wgsl.expected.msl | 13 + .../gen/var/dpdy/a8b56e.wgsl.expected.spvasm | 34 +++ .../gen/var/dpdy/a8b56e.wgsl.expected.wgsl | 9 + test/tint/builtins/gen/var/dpdy/feb40f.wgsl | 35 +++ .../gen/var/dpdy/feb40f.wgsl.expected.glsl | 16 ++ .../gen/var/dpdy/feb40f.wgsl.expected.hlsl | 9 + .../gen/var/dpdy/feb40f.wgsl.expected.msl | 13 + .../gen/var/dpdy/feb40f.wgsl.expected.spvasm | 34 +++ .../gen/var/dpdy/feb40f.wgsl.expected.wgsl | 9 + .../builtins/gen/var/dpdyCoarse/3e1ab4.wgsl | 35 +++ .../var/dpdyCoarse/3e1ab4.wgsl.expected.glsl | 16 ++ .../var/dpdyCoarse/3e1ab4.wgsl.expected.hlsl | 9 + .../var/dpdyCoarse/3e1ab4.wgsl.expected.msl | 13 + .../dpdyCoarse/3e1ab4.wgsl.expected.spvasm | 35 +++ .../var/dpdyCoarse/3e1ab4.wgsl.expected.wgsl | 9 + .../builtins/gen/var/dpdyCoarse/445d24.wgsl | 35 +++ .../var/dpdyCoarse/445d24.wgsl.expected.glsl | 16 ++ .../var/dpdyCoarse/445d24.wgsl.expected.hlsl | 9 + .../var/dpdyCoarse/445d24.wgsl.expected.msl | 13 + .../dpdyCoarse/445d24.wgsl.expected.spvasm | 35 +++ .../var/dpdyCoarse/445d24.wgsl.expected.wgsl | 9 + .../builtins/gen/var/dpdyCoarse/870a7e.wgsl | 35 +++ .../var/dpdyCoarse/870a7e.wgsl.expected.glsl | 16 ++ .../var/dpdyCoarse/870a7e.wgsl.expected.hlsl | 9 + .../var/dpdyCoarse/870a7e.wgsl.expected.msl | 13 + .../dpdyCoarse/870a7e.wgsl.expected.spvasm | 35 +++ .../var/dpdyCoarse/870a7e.wgsl.expected.wgsl | 9 + .../builtins/gen/var/dpdyCoarse/ae1873.wgsl | 35 +++ .../var/dpdyCoarse/ae1873.wgsl.expected.glsl | 16 ++ .../var/dpdyCoarse/ae1873.wgsl.expected.hlsl | 9 + .../var/dpdyCoarse/ae1873.wgsl.expected.msl | 13 + .../dpdyCoarse/ae1873.wgsl.expected.spvasm | 35 +++ .../var/dpdyCoarse/ae1873.wgsl.expected.wgsl | 9 + .../builtins/gen/var/dpdyFine/1fb7ab.wgsl | 35 +++ .../var/dpdyFine/1fb7ab.wgsl.expected.glsl | 16 ++ .../var/dpdyFine/1fb7ab.wgsl.expected.hlsl | 9 + .../gen/var/dpdyFine/1fb7ab.wgsl.expected.msl | 13 + .../var/dpdyFine/1fb7ab.wgsl.expected.spvasm | 35 +++ .../var/dpdyFine/1fb7ab.wgsl.expected.wgsl | 9 + .../builtins/gen/var/dpdyFine/6eb673.wgsl | 35 +++ .../var/dpdyFine/6eb673.wgsl.expected.glsl | 16 ++ .../var/dpdyFine/6eb673.wgsl.expected.hlsl | 9 + .../gen/var/dpdyFine/6eb673.wgsl.expected.msl | 13 + .../var/dpdyFine/6eb673.wgsl.expected.spvasm | 35 +++ .../var/dpdyFine/6eb673.wgsl.expected.wgsl | 9 + .../builtins/gen/var/dpdyFine/d0a648.wgsl | 35 +++ .../var/dpdyFine/d0a648.wgsl.expected.glsl | 16 ++ .../var/dpdyFine/d0a648.wgsl.expected.hlsl | 9 + .../gen/var/dpdyFine/d0a648.wgsl.expected.msl | 13 + .../var/dpdyFine/d0a648.wgsl.expected.spvasm | 35 +++ .../var/dpdyFine/d0a648.wgsl.expected.wgsl | 9 + .../builtins/gen/var/dpdyFine/df33aa.wgsl | 35 +++ .../var/dpdyFine/df33aa.wgsl.expected.glsl | 16 ++ .../var/dpdyFine/df33aa.wgsl.expected.hlsl | 9 + .../gen/var/dpdyFine/df33aa.wgsl.expected.msl | 13 + .../var/dpdyFine/df33aa.wgsl.expected.spvasm | 35 +++ .../var/dpdyFine/df33aa.wgsl.expected.wgsl | 9 + test/tint/builtins/gen/var/exp/0f70eb.wgsl | 46 ++++ .../gen/var/exp/0f70eb.wgsl.expected.glsl | 52 ++++ .../gen/var/exp/0f70eb.wgsl.expected.hlsl | 31 +++ .../gen/var/exp/0f70eb.wgsl.expected.msl | 34 +++ .../gen/var/exp/0f70eb.wgsl.expected.spvasm | 69 +++++ .../gen/var/exp/0f70eb.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/exp/1951e7.wgsl | 46 ++++ .../gen/var/exp/1951e7.wgsl.expected.glsl | 52 ++++ .../gen/var/exp/1951e7.wgsl.expected.hlsl | 31 +++ .../gen/var/exp/1951e7.wgsl.expected.msl | 34 +++ .../gen/var/exp/1951e7.wgsl.expected.spvasm | 71 +++++ .../gen/var/exp/1951e7.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/exp/771fd2.wgsl | 46 ++++ .../gen/var/exp/771fd2.wgsl.expected.glsl | 52 ++++ .../gen/var/exp/771fd2.wgsl.expected.hlsl | 31 +++ .../gen/var/exp/771fd2.wgsl.expected.msl | 34 +++ .../gen/var/exp/771fd2.wgsl.expected.spvasm | 69 +++++ .../gen/var/exp/771fd2.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/exp/d98450.wgsl | 46 ++++ .../gen/var/exp/d98450.wgsl.expected.glsl | 52 ++++ .../gen/var/exp/d98450.wgsl.expected.hlsl | 31 +++ .../gen/var/exp/d98450.wgsl.expected.msl | 34 +++ .../gen/var/exp/d98450.wgsl.expected.spvasm | 71 +++++ .../gen/var/exp/d98450.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/exp2/1f8680.wgsl | 46 ++++ .../gen/var/exp2/1f8680.wgsl.expected.glsl | 52 ++++ .../gen/var/exp2/1f8680.wgsl.expected.hlsl | 31 +++ .../gen/var/exp2/1f8680.wgsl.expected.msl | 34 +++ .../gen/var/exp2/1f8680.wgsl.expected.spvasm | 71 +++++ .../gen/var/exp2/1f8680.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/exp2/a9d0a7.wgsl | 46 ++++ .../gen/var/exp2/a9d0a7.wgsl.expected.glsl | 52 ++++ .../gen/var/exp2/a9d0a7.wgsl.expected.hlsl | 31 +++ .../gen/var/exp2/a9d0a7.wgsl.expected.msl | 34 +++ .../gen/var/exp2/a9d0a7.wgsl.expected.spvasm | 69 +++++ .../gen/var/exp2/a9d0a7.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/exp2/d6777c.wgsl | 46 ++++ .../gen/var/exp2/d6777c.wgsl.expected.glsl | 52 ++++ .../gen/var/exp2/d6777c.wgsl.expected.hlsl | 31 +++ .../gen/var/exp2/d6777c.wgsl.expected.msl | 34 +++ .../gen/var/exp2/d6777c.wgsl.expected.spvasm | 71 +++++ .../gen/var/exp2/d6777c.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/exp2/dea523.wgsl | 46 ++++ .../gen/var/exp2/dea523.wgsl.expected.glsl | 52 ++++ .../gen/var/exp2/dea523.wgsl.expected.hlsl | 31 +++ .../gen/var/exp2/dea523.wgsl.expected.msl | 34 +++ .../gen/var/exp2/dea523.wgsl.expected.spvasm | 69 +++++ .../gen/var/exp2/dea523.wgsl.expected.wgsl | 20 ++ .../builtins/gen/var/extractBits/12b197.wgsl | 48 ++++ .../var/extractBits/12b197.wgsl.expected.glsl | 76 ++++++ .../var/extractBits/12b197.wgsl.expected.hlsl | 41 +++ .../var/extractBits/12b197.wgsl.expected.msl | 42 +++ .../extractBits/12b197.wgsl.expected.spvasm | 101 ++++++++ .../var/extractBits/12b197.wgsl.expected.wgsl | 22 ++ .../builtins/gen/var/extractBits/249874.wgsl | 48 ++++ .../var/extractBits/249874.wgsl.expected.glsl | 76 ++++++ .../var/extractBits/249874.wgsl.expected.hlsl | 41 +++ .../var/extractBits/249874.wgsl.expected.msl | 42 +++ .../extractBits/249874.wgsl.expected.spvasm | 102 ++++++++ .../var/extractBits/249874.wgsl.expected.wgsl | 22 ++ .../builtins/gen/var/extractBits/631377.wgsl | 48 ++++ .../var/extractBits/631377.wgsl.expected.glsl | 76 ++++++ .../var/extractBits/631377.wgsl.expected.hlsl | 41 +++ .../var/extractBits/631377.wgsl.expected.msl | 42 +++ .../extractBits/631377.wgsl.expected.spvasm | 101 ++++++++ .../var/extractBits/631377.wgsl.expected.wgsl | 22 ++ .../builtins/gen/var/extractBits/a99a8d.wgsl | 48 ++++ .../var/extractBits/a99a8d.wgsl.expected.glsl | 76 ++++++ .../var/extractBits/a99a8d.wgsl.expected.hlsl | 41 +++ .../var/extractBits/a99a8d.wgsl.expected.msl | 42 +++ .../extractBits/a99a8d.wgsl.expected.spvasm | 102 ++++++++ .../var/extractBits/a99a8d.wgsl.expected.wgsl | 22 ++ .../builtins/gen/var/extractBits/ce81f8.wgsl | 48 ++++ .../var/extractBits/ce81f8.wgsl.expected.glsl | 76 ++++++ .../var/extractBits/ce81f8.wgsl.expected.hlsl | 41 +++ .../var/extractBits/ce81f8.wgsl.expected.msl | 42 +++ .../extractBits/ce81f8.wgsl.expected.spvasm | 98 +++++++ .../var/extractBits/ce81f8.wgsl.expected.wgsl | 22 ++ .../builtins/gen/var/extractBits/e04f5d.wgsl | 48 ++++ .../var/extractBits/e04f5d.wgsl.expected.glsl | 76 ++++++ .../var/extractBits/e04f5d.wgsl.expected.hlsl | 41 +++ .../var/extractBits/e04f5d.wgsl.expected.msl | 42 +++ .../extractBits/e04f5d.wgsl.expected.spvasm | 102 ++++++++ .../var/extractBits/e04f5d.wgsl.expected.wgsl | 22 ++ .../builtins/gen/var/extractBits/f28f69.wgsl | 48 ++++ .../var/extractBits/f28f69.wgsl.expected.glsl | 76 ++++++ .../var/extractBits/f28f69.wgsl.expected.hlsl | 41 +++ .../var/extractBits/f28f69.wgsl.expected.msl | 42 +++ .../extractBits/f28f69.wgsl.expected.spvasm | 101 ++++++++ .../var/extractBits/f28f69.wgsl.expected.wgsl | 22 ++ .../builtins/gen/var/extractBits/fb850f.wgsl | 48 ++++ .../var/extractBits/fb850f.wgsl.expected.glsl | 76 ++++++ .../var/extractBits/fb850f.wgsl.expected.hlsl | 41 +++ .../var/extractBits/fb850f.wgsl.expected.msl | 42 +++ .../extractBits/fb850f.wgsl.expected.spvasm | 102 ++++++++ .../var/extractBits/fb850f.wgsl.expected.wgsl | 22 ++ .../builtins/gen/var/faceForward/5afbd5.wgsl | 48 ++++ .../var/faceForward/5afbd5.wgsl.expected.glsl | 58 +++++ .../var/faceForward/5afbd5.wgsl.expected.hlsl | 33 +++ .../var/faceForward/5afbd5.wgsl.expected.msl | 36 +++ .../faceForward/5afbd5.wgsl.expected.spvasm | 79 ++++++ .../var/faceForward/5afbd5.wgsl.expected.wgsl | 22 ++ .../builtins/gen/var/faceForward/b316e5.wgsl | 48 ++++ .../var/faceForward/b316e5.wgsl.expected.glsl | 58 +++++ .../var/faceForward/b316e5.wgsl.expected.hlsl | 33 +++ .../var/faceForward/b316e5.wgsl.expected.msl | 36 +++ .../faceForward/b316e5.wgsl.expected.spvasm | 77 ++++++ .../var/faceForward/b316e5.wgsl.expected.wgsl | 22 ++ .../builtins/gen/var/faceForward/e6908b.wgsl | 48 ++++ .../var/faceForward/e6908b.wgsl.expected.glsl | 58 +++++ .../var/faceForward/e6908b.wgsl.expected.hlsl | 33 +++ .../var/faceForward/e6908b.wgsl.expected.msl | 36 +++ .../faceForward/e6908b.wgsl.expected.spvasm | 79 ++++++ .../var/faceForward/e6908b.wgsl.expected.wgsl | 22 ++ .../gen/var/firstLeadingBit/000ff3.wgsl | 46 ++++ .../firstLeadingBit/000ff3.wgsl.expected.glsl | 97 +++++++ .../firstLeadingBit/000ff3.wgsl.expected.hlsl | 46 ++++ .../firstLeadingBit/000ff3.wgsl.expected.msl | 49 ++++ .../000ff3.wgsl.expected.spvasm | 144 +++++++++++ .../firstLeadingBit/000ff3.wgsl.expected.wgsl | 20 ++ .../gen/var/firstLeadingBit/35053e.wgsl | 46 ++++ .../firstLeadingBit/35053e.wgsl.expected.glsl | 97 +++++++ .../firstLeadingBit/35053e.wgsl.expected.hlsl | 46 ++++ .../firstLeadingBit/35053e.wgsl.expected.msl | 49 ++++ .../35053e.wgsl.expected.spvasm | 154 +++++++++++ .../firstLeadingBit/35053e.wgsl.expected.wgsl | 20 ++ .../gen/var/firstLeadingBit/3fd7d0.wgsl | 46 ++++ .../firstLeadingBit/3fd7d0.wgsl.expected.glsl | 97 +++++++ .../firstLeadingBit/3fd7d0.wgsl.expected.hlsl | 46 ++++ .../firstLeadingBit/3fd7d0.wgsl.expected.msl | 49 ++++ .../3fd7d0.wgsl.expected.spvasm | 144 +++++++++++ .../firstLeadingBit/3fd7d0.wgsl.expected.wgsl | 20 ++ .../gen/var/firstLeadingBit/57a1a3.wgsl | 46 ++++ .../firstLeadingBit/57a1a3.wgsl.expected.glsl | 97 +++++++ .../firstLeadingBit/57a1a3.wgsl.expected.hlsl | 46 ++++ .../firstLeadingBit/57a1a3.wgsl.expected.msl | 49 ++++ .../57a1a3.wgsl.expected.spvasm | 142 ++++++++++ .../firstLeadingBit/57a1a3.wgsl.expected.wgsl | 20 ++ .../gen/var/firstLeadingBit/6fe804.wgsl | 46 ++++ .../firstLeadingBit/6fe804.wgsl.expected.glsl | 97 +++++++ .../firstLeadingBit/6fe804.wgsl.expected.hlsl | 46 ++++ .../firstLeadingBit/6fe804.wgsl.expected.msl | 49 ++++ .../6fe804.wgsl.expected.spvasm | 144 +++++++++++ .../firstLeadingBit/6fe804.wgsl.expected.wgsl | 20 ++ .../gen/var/firstLeadingBit/a622c2.wgsl | 46 ++++ .../firstLeadingBit/a622c2.wgsl.expected.glsl | 97 +++++++ .../firstLeadingBit/a622c2.wgsl.expected.hlsl | 46 ++++ .../firstLeadingBit/a622c2.wgsl.expected.msl | 49 ++++ .../a622c2.wgsl.expected.spvasm | 154 +++++++++++ .../firstLeadingBit/a622c2.wgsl.expected.wgsl | 20 ++ .../gen/var/firstLeadingBit/c1f940.wgsl | 46 ++++ .../firstLeadingBit/c1f940.wgsl.expected.glsl | 97 +++++++ .../firstLeadingBit/c1f940.wgsl.expected.hlsl | 46 ++++ .../firstLeadingBit/c1f940.wgsl.expected.msl | 49 ++++ .../c1f940.wgsl.expected.spvasm | 154 +++++++++++ .../firstLeadingBit/c1f940.wgsl.expected.wgsl | 20 ++ .../gen/var/firstLeadingBit/f0779d.wgsl | 46 ++++ .../firstLeadingBit/f0779d.wgsl.expected.glsl | 97 +++++++ .../firstLeadingBit/f0779d.wgsl.expected.hlsl | 46 ++++ .../firstLeadingBit/f0779d.wgsl.expected.msl | 49 ++++ .../f0779d.wgsl.expected.spvasm | 132 ++++++++++ .../firstLeadingBit/f0779d.wgsl.expected.wgsl | 20 ++ .../gen/var/firstTrailingBit/110f2c.wgsl | 46 ++++ .../110f2c.wgsl.expected.glsl | 97 +++++++ .../110f2c.wgsl.expected.hlsl | 46 ++++ .../firstTrailingBit/110f2c.wgsl.expected.msl | 49 ++++ .../110f2c.wgsl.expected.spvasm | 144 +++++++++++ .../110f2c.wgsl.expected.wgsl | 20 ++ .../gen/var/firstTrailingBit/3a2acc.wgsl | 46 ++++ .../3a2acc.wgsl.expected.glsl | 97 +++++++ .../3a2acc.wgsl.expected.hlsl | 46 ++++ .../firstTrailingBit/3a2acc.wgsl.expected.msl | 49 ++++ .../3a2acc.wgsl.expected.spvasm | 138 ++++++++++ .../3a2acc.wgsl.expected.wgsl | 20 ++ .../gen/var/firstTrailingBit/45eb10.wgsl | 46 ++++ .../45eb10.wgsl.expected.glsl | 97 +++++++ .../45eb10.wgsl.expected.hlsl | 46 ++++ .../firstTrailingBit/45eb10.wgsl.expected.msl | 49 ++++ .../45eb10.wgsl.expected.spvasm | 144 +++++++++++ .../45eb10.wgsl.expected.wgsl | 20 ++ .../gen/var/firstTrailingBit/47d475.wgsl | 46 ++++ .../47d475.wgsl.expected.glsl | 97 +++++++ .../47d475.wgsl.expected.hlsl | 46 ++++ .../firstTrailingBit/47d475.wgsl.expected.msl | 49 ++++ .../47d475.wgsl.expected.spvasm | 132 ++++++++++ .../47d475.wgsl.expected.wgsl | 20 ++ .../gen/var/firstTrailingBit/50c072.wgsl | 46 ++++ .../50c072.wgsl.expected.glsl | 97 +++++++ .../50c072.wgsl.expected.hlsl | 46 ++++ .../firstTrailingBit/50c072.wgsl.expected.msl | 49 ++++ .../50c072.wgsl.expected.spvasm | 150 +++++++++++ .../50c072.wgsl.expected.wgsl | 20 ++ .../gen/var/firstTrailingBit/7496d6.wgsl | 46 ++++ .../7496d6.wgsl.expected.glsl | 97 +++++++ .../7496d6.wgsl.expected.hlsl | 46 ++++ .../firstTrailingBit/7496d6.wgsl.expected.msl | 49 ++++ .../7496d6.wgsl.expected.spvasm | 150 +++++++++++ .../7496d6.wgsl.expected.wgsl | 20 ++ .../gen/var/firstTrailingBit/86551b.wgsl | 46 ++++ .../86551b.wgsl.expected.glsl | 97 +++++++ .../86551b.wgsl.expected.hlsl | 46 ++++ .../firstTrailingBit/86551b.wgsl.expected.msl | 49 ++++ .../86551b.wgsl.expected.spvasm | 150 +++++++++++ .../86551b.wgsl.expected.wgsl | 20 ++ .../gen/var/firstTrailingBit/cb51ce.wgsl | 46 ++++ .../cb51ce.wgsl.expected.glsl | 97 +++++++ .../cb51ce.wgsl.expected.hlsl | 46 ++++ .../firstTrailingBit/cb51ce.wgsl.expected.msl | 49 ++++ .../cb51ce.wgsl.expected.spvasm | 144 +++++++++++ .../cb51ce.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/floor/3bccc4.wgsl | 46 ++++ .../gen/var/floor/3bccc4.wgsl.expected.glsl | 52 ++++ .../gen/var/floor/3bccc4.wgsl.expected.hlsl | 31 +++ .../gen/var/floor/3bccc4.wgsl.expected.msl | 34 +++ .../gen/var/floor/3bccc4.wgsl.expected.spvasm | 69 +++++ .../gen/var/floor/3bccc4.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/floor/5fc9ac.wgsl | 46 ++++ .../gen/var/floor/5fc9ac.wgsl.expected.glsl | 52 ++++ .../gen/var/floor/5fc9ac.wgsl.expected.hlsl | 31 +++ .../gen/var/floor/5fc9ac.wgsl.expected.msl | 34 +++ .../gen/var/floor/5fc9ac.wgsl.expected.spvasm | 71 +++++ .../gen/var/floor/5fc9ac.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/floor/60d7ea.wgsl | 46 ++++ .../gen/var/floor/60d7ea.wgsl.expected.glsl | 52 ++++ .../gen/var/floor/60d7ea.wgsl.expected.hlsl | 31 +++ .../gen/var/floor/60d7ea.wgsl.expected.msl | 34 +++ .../gen/var/floor/60d7ea.wgsl.expected.spvasm | 71 +++++ .../gen/var/floor/60d7ea.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/floor/66f154.wgsl | 46 ++++ .../gen/var/floor/66f154.wgsl.expected.glsl | 52 ++++ .../gen/var/floor/66f154.wgsl.expected.hlsl | 31 +++ .../gen/var/floor/66f154.wgsl.expected.msl | 34 +++ .../gen/var/floor/66f154.wgsl.expected.spvasm | 69 +++++ .../gen/var/floor/66f154.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/fma/26a7a9.wgsl | 48 ++++ .../gen/var/fma/26a7a9.wgsl.expected.glsl | 58 +++++ .../gen/var/fma/26a7a9.wgsl.expected.hlsl | 33 +++ .../gen/var/fma/26a7a9.wgsl.expected.msl | 36 +++ .../gen/var/fma/26a7a9.wgsl.expected.spvasm | 79 ++++++ .../gen/var/fma/26a7a9.wgsl.expected.wgsl | 22 ++ test/tint/builtins/gen/var/fma/6a3283.wgsl | 48 ++++ .../gen/var/fma/6a3283.wgsl.expected.glsl | 58 +++++ .../gen/var/fma/6a3283.wgsl.expected.hlsl | 33 +++ .../gen/var/fma/6a3283.wgsl.expected.msl | 36 +++ .../gen/var/fma/6a3283.wgsl.expected.spvasm | 77 ++++++ .../gen/var/fma/6a3283.wgsl.expected.wgsl | 22 ++ test/tint/builtins/gen/var/fma/c10ba3.wgsl | 48 ++++ .../gen/var/fma/c10ba3.wgsl.expected.glsl | 58 +++++ .../gen/var/fma/c10ba3.wgsl.expected.hlsl | 33 +++ .../gen/var/fma/c10ba3.wgsl.expected.msl | 36 +++ .../gen/var/fma/c10ba3.wgsl.expected.spvasm | 77 ++++++ .../gen/var/fma/c10ba3.wgsl.expected.wgsl | 22 ++ test/tint/builtins/gen/var/fma/e17c5c.wgsl | 48 ++++ .../gen/var/fma/e17c5c.wgsl.expected.glsl | 58 +++++ .../gen/var/fma/e17c5c.wgsl.expected.hlsl | 33 +++ .../gen/var/fma/e17c5c.wgsl.expected.msl | 36 +++ .../gen/var/fma/e17c5c.wgsl.expected.spvasm | 79 ++++++ .../gen/var/fma/e17c5c.wgsl.expected.wgsl | 22 ++ test/tint/builtins/gen/var/fract/8bc1e9.wgsl | 46 ++++ .../gen/var/fract/8bc1e9.wgsl.expected.glsl | 52 ++++ .../gen/var/fract/8bc1e9.wgsl.expected.hlsl | 31 +++ .../gen/var/fract/8bc1e9.wgsl.expected.msl | 34 +++ .../gen/var/fract/8bc1e9.wgsl.expected.spvasm | 69 +++++ .../gen/var/fract/8bc1e9.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/fract/943cb1.wgsl | 46 ++++ .../gen/var/fract/943cb1.wgsl.expected.glsl | 52 ++++ .../gen/var/fract/943cb1.wgsl.expected.hlsl | 31 +++ .../gen/var/fract/943cb1.wgsl.expected.msl | 34 +++ .../gen/var/fract/943cb1.wgsl.expected.spvasm | 71 +++++ .../gen/var/fract/943cb1.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/fract/a49758.wgsl | 46 ++++ .../gen/var/fract/a49758.wgsl.expected.glsl | 52 ++++ .../gen/var/fract/a49758.wgsl.expected.hlsl | 31 +++ .../gen/var/fract/a49758.wgsl.expected.msl | 34 +++ .../gen/var/fract/a49758.wgsl.expected.spvasm | 71 +++++ .../gen/var/fract/a49758.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/fract/fa5c71.wgsl | 46 ++++ .../gen/var/fract/fa5c71.wgsl.expected.glsl | 52 ++++ .../gen/var/fract/fa5c71.wgsl.expected.hlsl | 31 +++ .../gen/var/fract/fa5c71.wgsl.expected.msl | 34 +++ .../gen/var/fract/fa5c71.wgsl.expected.spvasm | 69 +++++ .../gen/var/fract/fa5c71.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/frexp/368997.wgsl | 46 ++++ .../gen/var/frexp/368997.wgsl.expected.glsl | 88 +++++++ .../gen/var/frexp/368997.wgsl.expected.hlsl | 42 +++ .../gen/var/frexp/368997.wgsl.expected.msl | 45 ++++ .../gen/var/frexp/368997.wgsl.expected.spvasm | 81 ++++++ .../gen/var/frexp/368997.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/frexp/3c4f48.wgsl | 46 ++++ .../gen/var/frexp/3c4f48.wgsl.expected.glsl | 88 +++++++ .../gen/var/frexp/3c4f48.wgsl.expected.hlsl | 42 +++ .../gen/var/frexp/3c4f48.wgsl.expected.msl | 45 ++++ .../gen/var/frexp/3c4f48.wgsl.expected.spvasm | 79 ++++++ .../gen/var/frexp/3c4f48.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/frexp/4bdfc7.wgsl | 46 ++++ .../gen/var/frexp/4bdfc7.wgsl.expected.glsl | 88 +++++++ .../gen/var/frexp/4bdfc7.wgsl.expected.hlsl | 42 +++ .../gen/var/frexp/4bdfc7.wgsl.expected.msl | 45 ++++ .../gen/var/frexp/4bdfc7.wgsl.expected.spvasm | 81 ++++++ .../gen/var/frexp/4bdfc7.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/frexp/eabd40.wgsl | 46 ++++ .../gen/var/frexp/eabd40.wgsl.expected.glsl | 88 +++++++ .../gen/var/frexp/eabd40.wgsl.expected.hlsl | 42 +++ .../gen/var/frexp/eabd40.wgsl.expected.msl | 45 ++++ .../gen/var/frexp/eabd40.wgsl.expected.spvasm | 78 ++++++ .../gen/var/frexp/eabd40.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/fwidth/5d1b39.wgsl | 35 +++ .../gen/var/fwidth/5d1b39.wgsl.expected.glsl | 16 ++ .../gen/var/fwidth/5d1b39.wgsl.expected.hlsl | 9 + .../gen/var/fwidth/5d1b39.wgsl.expected.msl | 13 + .../var/fwidth/5d1b39.wgsl.expected.spvasm | 34 +++ .../gen/var/fwidth/5d1b39.wgsl.expected.wgsl | 9 + test/tint/builtins/gen/var/fwidth/b83ebb.wgsl | 35 +++ .../gen/var/fwidth/b83ebb.wgsl.expected.glsl | 16 ++ .../gen/var/fwidth/b83ebb.wgsl.expected.hlsl | 9 + .../gen/var/fwidth/b83ebb.wgsl.expected.msl | 13 + .../var/fwidth/b83ebb.wgsl.expected.spvasm | 34 +++ .../gen/var/fwidth/b83ebb.wgsl.expected.wgsl | 9 + test/tint/builtins/gen/var/fwidth/d2ab9a.wgsl | 35 +++ .../gen/var/fwidth/d2ab9a.wgsl.expected.glsl | 16 ++ .../gen/var/fwidth/d2ab9a.wgsl.expected.hlsl | 9 + .../gen/var/fwidth/d2ab9a.wgsl.expected.msl | 13 + .../var/fwidth/d2ab9a.wgsl.expected.spvasm | 34 +++ .../gen/var/fwidth/d2ab9a.wgsl.expected.wgsl | 9 + test/tint/builtins/gen/var/fwidth/df38ef.wgsl | 35 +++ .../gen/var/fwidth/df38ef.wgsl.expected.glsl | 16 ++ .../gen/var/fwidth/df38ef.wgsl.expected.hlsl | 9 + .../gen/var/fwidth/df38ef.wgsl.expected.msl | 13 + .../var/fwidth/df38ef.wgsl.expected.spvasm | 34 +++ .../gen/var/fwidth/df38ef.wgsl.expected.wgsl | 9 + .../builtins/gen/var/fwidthCoarse/159c8a.wgsl | 35 +++ .../fwidthCoarse/159c8a.wgsl.expected.glsl | 16 ++ .../fwidthCoarse/159c8a.wgsl.expected.hlsl | 9 + .../var/fwidthCoarse/159c8a.wgsl.expected.msl | 13 + .../fwidthCoarse/159c8a.wgsl.expected.spvasm | 35 +++ .../fwidthCoarse/159c8a.wgsl.expected.wgsl | 9 + .../builtins/gen/var/fwidthCoarse/1e59d9.wgsl | 35 +++ .../fwidthCoarse/1e59d9.wgsl.expected.glsl | 16 ++ .../fwidthCoarse/1e59d9.wgsl.expected.hlsl | 9 + .../var/fwidthCoarse/1e59d9.wgsl.expected.msl | 13 + .../fwidthCoarse/1e59d9.wgsl.expected.spvasm | 35 +++ .../fwidthCoarse/1e59d9.wgsl.expected.wgsl | 9 + .../builtins/gen/var/fwidthCoarse/4e4fc4.wgsl | 35 +++ .../fwidthCoarse/4e4fc4.wgsl.expected.glsl | 16 ++ .../fwidthCoarse/4e4fc4.wgsl.expected.hlsl | 9 + .../var/fwidthCoarse/4e4fc4.wgsl.expected.msl | 13 + .../fwidthCoarse/4e4fc4.wgsl.expected.spvasm | 35 +++ .../fwidthCoarse/4e4fc4.wgsl.expected.wgsl | 9 + .../builtins/gen/var/fwidthCoarse/e653f7.wgsl | 35 +++ .../fwidthCoarse/e653f7.wgsl.expected.glsl | 16 ++ .../fwidthCoarse/e653f7.wgsl.expected.hlsl | 9 + .../var/fwidthCoarse/e653f7.wgsl.expected.msl | 13 + .../fwidthCoarse/e653f7.wgsl.expected.spvasm | 35 +++ .../fwidthCoarse/e653f7.wgsl.expected.wgsl | 9 + .../builtins/gen/var/fwidthFine/523fdc.wgsl | 35 +++ .../var/fwidthFine/523fdc.wgsl.expected.glsl | 16 ++ .../var/fwidthFine/523fdc.wgsl.expected.hlsl | 9 + .../var/fwidthFine/523fdc.wgsl.expected.msl | 13 + .../fwidthFine/523fdc.wgsl.expected.spvasm | 35 +++ .../var/fwidthFine/523fdc.wgsl.expected.wgsl | 9 + .../builtins/gen/var/fwidthFine/68f4ef.wgsl | 35 +++ .../var/fwidthFine/68f4ef.wgsl.expected.glsl | 16 ++ .../var/fwidthFine/68f4ef.wgsl.expected.hlsl | 9 + .../var/fwidthFine/68f4ef.wgsl.expected.msl | 13 + .../fwidthFine/68f4ef.wgsl.expected.spvasm | 35 +++ .../var/fwidthFine/68f4ef.wgsl.expected.wgsl | 9 + .../builtins/gen/var/fwidthFine/f1742d.wgsl | 35 +++ .../var/fwidthFine/f1742d.wgsl.expected.glsl | 16 ++ .../var/fwidthFine/f1742d.wgsl.expected.hlsl | 9 + .../var/fwidthFine/f1742d.wgsl.expected.msl | 13 + .../fwidthFine/f1742d.wgsl.expected.spvasm | 35 +++ .../var/fwidthFine/f1742d.wgsl.expected.wgsl | 9 + .../builtins/gen/var/fwidthFine/ff6aa0.wgsl | 35 +++ .../var/fwidthFine/ff6aa0.wgsl.expected.glsl | 16 ++ .../var/fwidthFine/ff6aa0.wgsl.expected.hlsl | 9 + .../var/fwidthFine/ff6aa0.wgsl.expected.msl | 13 + .../fwidthFine/ff6aa0.wgsl.expected.spvasm | 35 +++ .../var/fwidthFine/ff6aa0.wgsl.expected.wgsl | 9 + .../builtins/gen/var/insertBits/3c7ba5.wgsl | 49 ++++ .../var/insertBits/3c7ba5.wgsl.expected.glsl | 79 ++++++ .../var/insertBits/3c7ba5.wgsl.expected.hlsl | 41 +++ .../var/insertBits/3c7ba5.wgsl.expected.msl | 43 ++++ .../insertBits/3c7ba5.wgsl.expected.spvasm | 107 ++++++++ .../var/insertBits/3c7ba5.wgsl.expected.wgsl | 23 ++ .../builtins/gen/var/insertBits/428b0b.wgsl | 49 ++++ .../var/insertBits/428b0b.wgsl.expected.glsl | 79 ++++++ .../var/insertBits/428b0b.wgsl.expected.hlsl | 41 +++ .../var/insertBits/428b0b.wgsl.expected.msl | 43 ++++ .../insertBits/428b0b.wgsl.expected.spvasm | 108 ++++++++ .../var/insertBits/428b0b.wgsl.expected.wgsl | 23 ++ .../builtins/gen/var/insertBits/51ede1.wgsl | 49 ++++ .../var/insertBits/51ede1.wgsl.expected.glsl | 79 ++++++ .../var/insertBits/51ede1.wgsl.expected.hlsl | 41 +++ .../var/insertBits/51ede1.wgsl.expected.msl | 43 ++++ .../insertBits/51ede1.wgsl.expected.spvasm | 107 ++++++++ .../var/insertBits/51ede1.wgsl.expected.wgsl | 23 ++ .../builtins/gen/var/insertBits/65468b.wgsl | 49 ++++ .../var/insertBits/65468b.wgsl.expected.glsl | 79 ++++++ .../var/insertBits/65468b.wgsl.expected.hlsl | 41 +++ .../var/insertBits/65468b.wgsl.expected.msl | 43 ++++ .../insertBits/65468b.wgsl.expected.spvasm | 108 ++++++++ .../var/insertBits/65468b.wgsl.expected.wgsl | 23 ++ .../builtins/gen/var/insertBits/87826b.wgsl | 49 ++++ .../var/insertBits/87826b.wgsl.expected.glsl | 79 ++++++ .../var/insertBits/87826b.wgsl.expected.hlsl | 41 +++ .../var/insertBits/87826b.wgsl.expected.msl | 43 ++++ .../insertBits/87826b.wgsl.expected.spvasm | 107 ++++++++ .../var/insertBits/87826b.wgsl.expected.wgsl | 23 ++ .../builtins/gen/var/insertBits/d86978.wgsl | 49 ++++ .../var/insertBits/d86978.wgsl.expected.glsl | 79 ++++++ .../var/insertBits/d86978.wgsl.expected.hlsl | 41 +++ .../var/insertBits/d86978.wgsl.expected.msl | 43 ++++ .../insertBits/d86978.wgsl.expected.spvasm | 108 ++++++++ .../var/insertBits/d86978.wgsl.expected.wgsl | 23 ++ .../builtins/gen/var/insertBits/e3e3a2.wgsl | 49 ++++ .../var/insertBits/e3e3a2.wgsl.expected.glsl | 79 ++++++ .../var/insertBits/e3e3a2.wgsl.expected.hlsl | 41 +++ .../var/insertBits/e3e3a2.wgsl.expected.msl | 43 ++++ .../insertBits/e3e3a2.wgsl.expected.spvasm | 104 ++++++++ .../var/insertBits/e3e3a2.wgsl.expected.wgsl | 23 ++ .../builtins/gen/var/insertBits/fe6ba6.wgsl | 49 ++++ .../var/insertBits/fe6ba6.wgsl.expected.glsl | 79 ++++++ .../var/insertBits/fe6ba6.wgsl.expected.hlsl | 41 +++ .../var/insertBits/fe6ba6.wgsl.expected.msl | 43 ++++ .../insertBits/fe6ba6.wgsl.expected.spvasm | 108 ++++++++ .../var/insertBits/fe6ba6.wgsl.expected.wgsl | 23 ++ .../builtins/gen/var/inverseSqrt/84407e.wgsl | 46 ++++ .../var/inverseSqrt/84407e.wgsl.expected.glsl | 52 ++++ .../var/inverseSqrt/84407e.wgsl.expected.hlsl | 31 +++ .../var/inverseSqrt/84407e.wgsl.expected.msl | 34 +++ .../inverseSqrt/84407e.wgsl.expected.spvasm | 69 +++++ .../var/inverseSqrt/84407e.wgsl.expected.wgsl | 20 ++ .../builtins/gen/var/inverseSqrt/8f2bd2.wgsl | 46 ++++ .../var/inverseSqrt/8f2bd2.wgsl.expected.glsl | 52 ++++ .../var/inverseSqrt/8f2bd2.wgsl.expected.hlsl | 31 +++ .../var/inverseSqrt/8f2bd2.wgsl.expected.msl | 34 +++ .../inverseSqrt/8f2bd2.wgsl.expected.spvasm | 71 +++++ .../var/inverseSqrt/8f2bd2.wgsl.expected.wgsl | 20 ++ .../builtins/gen/var/inverseSqrt/b197b1.wgsl | 46 ++++ .../var/inverseSqrt/b197b1.wgsl.expected.glsl | 52 ++++ .../var/inverseSqrt/b197b1.wgsl.expected.hlsl | 31 +++ .../var/inverseSqrt/b197b1.wgsl.expected.msl | 34 +++ .../inverseSqrt/b197b1.wgsl.expected.spvasm | 71 +++++ .../var/inverseSqrt/b197b1.wgsl.expected.wgsl | 20 ++ .../builtins/gen/var/inverseSqrt/c22347.wgsl | 46 ++++ .../var/inverseSqrt/c22347.wgsl.expected.glsl | 52 ++++ .../var/inverseSqrt/c22347.wgsl.expected.hlsl | 31 +++ .../var/inverseSqrt/c22347.wgsl.expected.msl | 34 +++ .../inverseSqrt/c22347.wgsl.expected.spvasm | 69 +++++ .../var/inverseSqrt/c22347.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/ldexp/a31cdc.wgsl | 47 ++++ .../gen/var/ldexp/a31cdc.wgsl.expected.glsl | 55 ++++ .../gen/var/ldexp/a31cdc.wgsl.expected.hlsl | 32 +++ .../gen/var/ldexp/a31cdc.wgsl.expected.msl | 35 +++ .../gen/var/ldexp/a31cdc.wgsl.expected.spvasm | 79 ++++++ .../gen/var/ldexp/a31cdc.wgsl.expected.wgsl | 21 ++ test/tint/builtins/gen/var/ldexp/abd718.wgsl | 47 ++++ .../gen/var/ldexp/abd718.wgsl.expected.glsl | 55 ++++ .../gen/var/ldexp/abd718.wgsl.expected.hlsl | 32 +++ .../gen/var/ldexp/abd718.wgsl.expected.msl | 35 +++ .../gen/var/ldexp/abd718.wgsl.expected.spvasm | 79 ++++++ .../gen/var/ldexp/abd718.wgsl.expected.wgsl | 21 ++ test/tint/builtins/gen/var/ldexp/cc9cde.wgsl | 47 ++++ .../gen/var/ldexp/cc9cde.wgsl.expected.glsl | 55 ++++ .../gen/var/ldexp/cc9cde.wgsl.expected.hlsl | 32 +++ .../gen/var/ldexp/cc9cde.wgsl.expected.msl | 35 +++ .../gen/var/ldexp/cc9cde.wgsl.expected.spvasm | 77 ++++++ .../gen/var/ldexp/cc9cde.wgsl.expected.wgsl | 21 ++ test/tint/builtins/gen/var/ldexp/db8b49.wgsl | 47 ++++ .../gen/var/ldexp/db8b49.wgsl.expected.glsl | 55 ++++ .../gen/var/ldexp/db8b49.wgsl.expected.hlsl | 32 +++ .../gen/var/ldexp/db8b49.wgsl.expected.msl | 35 +++ .../gen/var/ldexp/db8b49.wgsl.expected.spvasm | 77 ++++++ .../gen/var/ldexp/db8b49.wgsl.expected.wgsl | 21 ++ test/tint/builtins/gen/var/length/056071.wgsl | 46 ++++ .../gen/var/length/056071.wgsl.expected.glsl | 52 ++++ .../gen/var/length/056071.wgsl.expected.hlsl | 31 +++ .../gen/var/length/056071.wgsl.expected.msl | 34 +++ .../var/length/056071.wgsl.expected.spvasm | 72 ++++++ .../gen/var/length/056071.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/length/602a17.wgsl | 46 ++++ .../gen/var/length/602a17.wgsl.expected.glsl | 52 ++++ .../gen/var/length/602a17.wgsl.expected.hlsl | 31 +++ .../gen/var/length/602a17.wgsl.expected.msl | 34 +++ .../var/length/602a17.wgsl.expected.spvasm | 69 +++++ .../gen/var/length/602a17.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/length/afde8b.wgsl | 46 ++++ .../gen/var/length/afde8b.wgsl.expected.glsl | 52 ++++ .../gen/var/length/afde8b.wgsl.expected.hlsl | 31 +++ .../gen/var/length/afde8b.wgsl.expected.msl | 34 +++ .../var/length/afde8b.wgsl.expected.spvasm | 72 ++++++ .../gen/var/length/afde8b.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/length/becebf.wgsl | 46 ++++ .../gen/var/length/becebf.wgsl.expected.glsl | 52 ++++ .../gen/var/length/becebf.wgsl.expected.hlsl | 31 +++ .../gen/var/length/becebf.wgsl.expected.msl | 34 +++ .../var/length/becebf.wgsl.expected.spvasm | 70 +++++ .../gen/var/length/becebf.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/log/3da25a.wgsl | 46 ++++ .../gen/var/log/3da25a.wgsl.expected.glsl | 52 ++++ .../gen/var/log/3da25a.wgsl.expected.hlsl | 31 +++ .../gen/var/log/3da25a.wgsl.expected.msl | 34 +++ .../gen/var/log/3da25a.wgsl.expected.spvasm | 69 +++++ .../gen/var/log/3da25a.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/log/7114a6.wgsl | 46 ++++ .../gen/var/log/7114a6.wgsl.expected.glsl | 52 ++++ .../gen/var/log/7114a6.wgsl.expected.hlsl | 31 +++ .../gen/var/log/7114a6.wgsl.expected.msl | 34 +++ .../gen/var/log/7114a6.wgsl.expected.spvasm | 69 +++++ .../gen/var/log/7114a6.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/log/b2ce28.wgsl | 46 ++++ .../gen/var/log/b2ce28.wgsl.expected.glsl | 52 ++++ .../gen/var/log/b2ce28.wgsl.expected.hlsl | 31 +++ .../gen/var/log/b2ce28.wgsl.expected.msl | 34 +++ .../gen/var/log/b2ce28.wgsl.expected.spvasm | 71 +++++ .../gen/var/log/b2ce28.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/log/f4c570.wgsl | 46 ++++ .../gen/var/log/f4c570.wgsl.expected.glsl | 52 ++++ .../gen/var/log/f4c570.wgsl.expected.hlsl | 31 +++ .../gen/var/log/f4c570.wgsl.expected.msl | 34 +++ .../gen/var/log/f4c570.wgsl.expected.spvasm | 71 +++++ .../gen/var/log/f4c570.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/log2/4036ed.wgsl | 46 ++++ .../gen/var/log2/4036ed.wgsl.expected.glsl | 52 ++++ .../gen/var/log2/4036ed.wgsl.expected.hlsl | 31 +++ .../gen/var/log2/4036ed.wgsl.expected.msl | 34 +++ .../gen/var/log2/4036ed.wgsl.expected.spvasm | 69 +++++ .../gen/var/log2/4036ed.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/log2/902988.wgsl | 46 ++++ .../gen/var/log2/902988.wgsl.expected.glsl | 52 ++++ .../gen/var/log2/902988.wgsl.expected.hlsl | 31 +++ .../gen/var/log2/902988.wgsl.expected.msl | 34 +++ .../gen/var/log2/902988.wgsl.expected.spvasm | 69 +++++ .../gen/var/log2/902988.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/log2/adb233.wgsl | 46 ++++ .../gen/var/log2/adb233.wgsl.expected.glsl | 52 ++++ .../gen/var/log2/adb233.wgsl.expected.hlsl | 31 +++ .../gen/var/log2/adb233.wgsl.expected.msl | 34 +++ .../gen/var/log2/adb233.wgsl.expected.spvasm | 71 +++++ .../gen/var/log2/adb233.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/log2/aea659.wgsl | 46 ++++ .../gen/var/log2/aea659.wgsl.expected.glsl | 52 ++++ .../gen/var/log2/aea659.wgsl.expected.hlsl | 31 +++ .../gen/var/log2/aea659.wgsl.expected.msl | 34 +++ .../gen/var/log2/aea659.wgsl.expected.spvasm | 71 +++++ .../gen/var/log2/aea659.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/max/0c0aae.wgsl | 47 ++++ .../gen/var/max/0c0aae.wgsl.expected.glsl | 55 ++++ .../gen/var/max/0c0aae.wgsl.expected.hlsl | 32 +++ .../gen/var/max/0c0aae.wgsl.expected.msl | 35 +++ .../gen/var/max/0c0aae.wgsl.expected.spvasm | 76 ++++++ .../gen/var/max/0c0aae.wgsl.expected.wgsl | 21 ++ test/tint/builtins/gen/var/max/25eafe.wgsl | 47 ++++ .../gen/var/max/25eafe.wgsl.expected.glsl | 55 ++++ .../gen/var/max/25eafe.wgsl.expected.hlsl | 32 +++ .../gen/var/max/25eafe.wgsl.expected.msl | 35 +++ .../gen/var/max/25eafe.wgsl.expected.spvasm | 76 ++++++ .../gen/var/max/25eafe.wgsl.expected.wgsl | 21 ++ test/tint/builtins/gen/var/max/320815.wgsl | 47 ++++ .../gen/var/max/320815.wgsl.expected.glsl | 55 ++++ .../gen/var/max/320815.wgsl.expected.hlsl | 32 +++ .../gen/var/max/320815.wgsl.expected.msl | 35 +++ .../gen/var/max/320815.wgsl.expected.spvasm | 76 ++++++ .../gen/var/max/320815.wgsl.expected.wgsl | 21 ++ test/tint/builtins/gen/var/max/44a39d.wgsl | 47 ++++ .../gen/var/max/44a39d.wgsl.expected.glsl | 55 ++++ .../gen/var/max/44a39d.wgsl.expected.hlsl | 32 +++ .../gen/var/max/44a39d.wgsl.expected.msl | 35 +++ .../gen/var/max/44a39d.wgsl.expected.spvasm | 73 ++++++ .../gen/var/max/44a39d.wgsl.expected.wgsl | 21 ++ test/tint/builtins/gen/var/max/453e04.wgsl | 47 ++++ .../gen/var/max/453e04.wgsl.expected.glsl | 55 ++++ .../gen/var/max/453e04.wgsl.expected.hlsl | 32 +++ .../gen/var/max/453e04.wgsl.expected.msl | 35 +++ .../gen/var/max/453e04.wgsl.expected.spvasm | 76 ++++++ .../gen/var/max/453e04.wgsl.expected.wgsl | 21 ++ test/tint/builtins/gen/var/max/462050.wgsl | 47 ++++ .../gen/var/max/462050.wgsl.expected.glsl | 55 ++++ .../gen/var/max/462050.wgsl.expected.hlsl | 32 +++ .../gen/var/max/462050.wgsl.expected.msl | 35 +++ .../gen/var/max/462050.wgsl.expected.spvasm | 75 ++++++ .../gen/var/max/462050.wgsl.expected.wgsl | 21 ++ test/tint/builtins/gen/var/max/4883ac.wgsl | 47 ++++ .../gen/var/max/4883ac.wgsl.expected.glsl | 55 ++++ .../gen/var/max/4883ac.wgsl.expected.hlsl | 32 +++ .../gen/var/max/4883ac.wgsl.expected.msl | 35 +++ .../gen/var/max/4883ac.wgsl.expected.spvasm | 75 ++++++ .../gen/var/max/4883ac.wgsl.expected.wgsl | 21 ++ test/tint/builtins/gen/var/max/85e6bc.wgsl | 47 ++++ .../gen/var/max/85e6bc.wgsl.expected.glsl | 55 ++++ .../gen/var/max/85e6bc.wgsl.expected.hlsl | 32 +++ .../gen/var/max/85e6bc.wgsl.expected.msl | 35 +++ .../gen/var/max/85e6bc.wgsl.expected.spvasm | 76 ++++++ .../gen/var/max/85e6bc.wgsl.expected.wgsl | 21 ++ test/tint/builtins/gen/var/max/a93419.wgsl | 47 ++++ .../gen/var/max/a93419.wgsl.expected.glsl | 55 ++++ .../gen/var/max/a93419.wgsl.expected.hlsl | 32 +++ .../gen/var/max/a93419.wgsl.expected.msl | 35 +++ .../gen/var/max/a93419.wgsl.expected.spvasm | 73 ++++++ .../gen/var/max/a93419.wgsl.expected.wgsl | 21 ++ test/tint/builtins/gen/var/max/b1b73a.wgsl | 47 ++++ .../gen/var/max/b1b73a.wgsl.expected.glsl | 55 ++++ .../gen/var/max/b1b73a.wgsl.expected.hlsl | 32 +++ .../gen/var/max/b1b73a.wgsl.expected.msl | 35 +++ .../gen/var/max/b1b73a.wgsl.expected.spvasm | 76 ++++++ .../gen/var/max/b1b73a.wgsl.expected.wgsl | 21 ++ test/tint/builtins/gen/var/max/ce7c30.wgsl | 47 ++++ .../gen/var/max/ce7c30.wgsl.expected.glsl | 55 ++++ .../gen/var/max/ce7c30.wgsl.expected.hlsl | 32 +++ .../gen/var/max/ce7c30.wgsl.expected.msl | 35 +++ .../gen/var/max/ce7c30.wgsl.expected.spvasm | 76 ++++++ .../gen/var/max/ce7c30.wgsl.expected.wgsl | 21 ++ test/tint/builtins/gen/var/max/e8192f.wgsl | 47 ++++ .../gen/var/max/e8192f.wgsl.expected.glsl | 55 ++++ .../gen/var/max/e8192f.wgsl.expected.hlsl | 32 +++ .../gen/var/max/e8192f.wgsl.expected.msl | 35 +++ .../gen/var/max/e8192f.wgsl.expected.spvasm | 76 ++++++ .../gen/var/max/e8192f.wgsl.expected.wgsl | 21 ++ test/tint/builtins/gen/var/min/03c7e3.wgsl | 47 ++++ .../gen/var/min/03c7e3.wgsl.expected.glsl | 55 ++++ .../gen/var/min/03c7e3.wgsl.expected.hlsl | 32 +++ .../gen/var/min/03c7e3.wgsl.expected.msl | 35 +++ .../gen/var/min/03c7e3.wgsl.expected.spvasm | 76 ++++++ .../gen/var/min/03c7e3.wgsl.expected.wgsl | 21 ++ test/tint/builtins/gen/var/min/0dc614.wgsl | 47 ++++ .../gen/var/min/0dc614.wgsl.expected.glsl | 55 ++++ .../gen/var/min/0dc614.wgsl.expected.hlsl | 32 +++ .../gen/var/min/0dc614.wgsl.expected.msl | 35 +++ .../gen/var/min/0dc614.wgsl.expected.spvasm | 76 ++++++ .../gen/var/min/0dc614.wgsl.expected.wgsl | 21 ++ test/tint/builtins/gen/var/min/3941e1.wgsl | 47 ++++ .../gen/var/min/3941e1.wgsl.expected.glsl | 55 ++++ .../gen/var/min/3941e1.wgsl.expected.hlsl | 32 +++ .../gen/var/min/3941e1.wgsl.expected.msl | 35 +++ .../gen/var/min/3941e1.wgsl.expected.spvasm | 76 ++++++ .../gen/var/min/3941e1.wgsl.expected.wgsl | 21 ++ test/tint/builtins/gen/var/min/46c5d3.wgsl | 47 ++++ .../gen/var/min/46c5d3.wgsl.expected.glsl | 55 ++++ .../gen/var/min/46c5d3.wgsl.expected.hlsl | 32 +++ .../gen/var/min/46c5d3.wgsl.expected.msl | 35 +++ .../gen/var/min/46c5d3.wgsl.expected.spvasm | 76 ++++++ .../gen/var/min/46c5d3.wgsl.expected.wgsl | 21 ++ test/tint/builtins/gen/var/min/82b28f.wgsl | 47 ++++ .../gen/var/min/82b28f.wgsl.expected.glsl | 55 ++++ .../gen/var/min/82b28f.wgsl.expected.hlsl | 32 +++ .../gen/var/min/82b28f.wgsl.expected.msl | 35 +++ .../gen/var/min/82b28f.wgsl.expected.spvasm | 76 ++++++ .../gen/var/min/82b28f.wgsl.expected.wgsl | 21 ++ test/tint/builtins/gen/var/min/93cfc4.wgsl | 47 ++++ .../gen/var/min/93cfc4.wgsl.expected.glsl | 55 ++++ .../gen/var/min/93cfc4.wgsl.expected.hlsl | 32 +++ .../gen/var/min/93cfc4.wgsl.expected.msl | 35 +++ .../gen/var/min/93cfc4.wgsl.expected.spvasm | 75 ++++++ .../gen/var/min/93cfc4.wgsl.expected.wgsl | 21 ++ test/tint/builtins/gen/var/min/a45171.wgsl | 47 ++++ .../gen/var/min/a45171.wgsl.expected.glsl | 55 ++++ .../gen/var/min/a45171.wgsl.expected.hlsl | 32 +++ .../gen/var/min/a45171.wgsl.expected.msl | 35 +++ .../gen/var/min/a45171.wgsl.expected.spvasm | 76 ++++++ .../gen/var/min/a45171.wgsl.expected.wgsl | 21 ++ test/tint/builtins/gen/var/min/aa28ad.wgsl | 47 ++++ .../gen/var/min/aa28ad.wgsl.expected.glsl | 55 ++++ .../gen/var/min/aa28ad.wgsl.expected.hlsl | 32 +++ .../gen/var/min/aa28ad.wgsl.expected.msl | 35 +++ .../gen/var/min/aa28ad.wgsl.expected.spvasm | 75 ++++++ .../gen/var/min/aa28ad.wgsl.expected.wgsl | 21 ++ test/tint/builtins/gen/var/min/af326d.wgsl | 47 ++++ .../gen/var/min/af326d.wgsl.expected.glsl | 55 ++++ .../gen/var/min/af326d.wgsl.expected.hlsl | 32 +++ .../gen/var/min/af326d.wgsl.expected.msl | 35 +++ .../gen/var/min/af326d.wgsl.expected.spvasm | 73 ++++++ .../gen/var/min/af326d.wgsl.expected.wgsl | 21 ++ test/tint/builtins/gen/var/min/c70bb7.wgsl | 47 ++++ .../gen/var/min/c70bb7.wgsl.expected.glsl | 55 ++++ .../gen/var/min/c70bb7.wgsl.expected.hlsl | 32 +++ .../gen/var/min/c70bb7.wgsl.expected.msl | 35 +++ .../gen/var/min/c70bb7.wgsl.expected.spvasm | 76 ++++++ .../gen/var/min/c70bb7.wgsl.expected.wgsl | 21 ++ test/tint/builtins/gen/var/min/c73147.wgsl | 47 ++++ .../gen/var/min/c73147.wgsl.expected.glsl | 55 ++++ .../gen/var/min/c73147.wgsl.expected.hlsl | 32 +++ .../gen/var/min/c73147.wgsl.expected.msl | 35 +++ .../gen/var/min/c73147.wgsl.expected.spvasm | 76 ++++++ .../gen/var/min/c73147.wgsl.expected.wgsl | 21 ++ test/tint/builtins/gen/var/min/c76fa6.wgsl | 47 ++++ .../gen/var/min/c76fa6.wgsl.expected.glsl | 55 ++++ .../gen/var/min/c76fa6.wgsl.expected.hlsl | 32 +++ .../gen/var/min/c76fa6.wgsl.expected.msl | 35 +++ .../gen/var/min/c76fa6.wgsl.expected.spvasm | 73 ++++++ .../gen/var/min/c76fa6.wgsl.expected.wgsl | 21 ++ test/tint/builtins/gen/var/mix/0c8c33.wgsl | 48 ++++ .../gen/var/mix/0c8c33.wgsl.expected.glsl | 58 +++++ .../gen/var/mix/0c8c33.wgsl.expected.hlsl | 33 +++ .../gen/var/mix/0c8c33.wgsl.expected.msl | 36 +++ .../gen/var/mix/0c8c33.wgsl.expected.spvasm | 79 ++++++ .../gen/var/mix/0c8c33.wgsl.expected.wgsl | 22 ++ test/tint/builtins/gen/var/mix/1faeb1.wgsl | 48 ++++ .../gen/var/mix/1faeb1.wgsl.expected.glsl | 58 +++++ .../gen/var/mix/1faeb1.wgsl.expected.hlsl | 33 +++ .../gen/var/mix/1faeb1.wgsl.expected.msl | 36 +++ .../gen/var/mix/1faeb1.wgsl.expected.spvasm | 80 ++++++ .../gen/var/mix/1faeb1.wgsl.expected.wgsl | 22 ++ test/tint/builtins/gen/var/mix/2fadab.wgsl | 48 ++++ .../gen/var/mix/2fadab.wgsl.expected.glsl | 58 +++++ .../gen/var/mix/2fadab.wgsl.expected.hlsl | 33 +++ .../gen/var/mix/2fadab.wgsl.expected.msl | 36 +++ .../gen/var/mix/2fadab.wgsl.expected.spvasm | 82 ++++++ .../gen/var/mix/2fadab.wgsl.expected.wgsl | 22 ++ test/tint/builtins/gen/var/mix/315264.wgsl | 48 ++++ .../gen/var/mix/315264.wgsl.expected.glsl | 58 +++++ .../gen/var/mix/315264.wgsl.expected.hlsl | 33 +++ .../gen/var/mix/315264.wgsl.expected.msl | 36 +++ .../gen/var/mix/315264.wgsl.expected.spvasm | 82 ++++++ .../gen/var/mix/315264.wgsl.expected.wgsl | 22 ++ test/tint/builtins/gen/var/mix/4f0b5e.wgsl | 48 ++++ .../gen/var/mix/4f0b5e.wgsl.expected.glsl | 58 +++++ .../gen/var/mix/4f0b5e.wgsl.expected.hlsl | 33 +++ .../gen/var/mix/4f0b5e.wgsl.expected.msl | 36 +++ .../gen/var/mix/4f0b5e.wgsl.expected.spvasm | 77 ++++++ .../gen/var/mix/4f0b5e.wgsl.expected.wgsl | 22 ++ test/tint/builtins/gen/var/mix/6f8adc.wgsl | 48 ++++ .../gen/var/mix/6f8adc.wgsl.expected.glsl | 58 +++++ .../gen/var/mix/6f8adc.wgsl.expected.hlsl | 33 +++ .../gen/var/mix/6f8adc.wgsl.expected.msl | 36 +++ .../gen/var/mix/6f8adc.wgsl.expected.spvasm | 79 ++++++ .../gen/var/mix/6f8adc.wgsl.expected.wgsl | 22 ++ test/tint/builtins/gen/var/mix/c37ede.wgsl | 48 ++++ .../gen/var/mix/c37ede.wgsl.expected.glsl | 58 +++++ .../gen/var/mix/c37ede.wgsl.expected.hlsl | 33 +++ .../gen/var/mix/c37ede.wgsl.expected.msl | 36 +++ .../gen/var/mix/c37ede.wgsl.expected.spvasm | 77 ++++++ .../gen/var/mix/c37ede.wgsl.expected.wgsl | 22 ++ test/tint/builtins/gen/var/modf/180fed.wgsl | 46 ++++ .../gen/var/modf/180fed.wgsl.expected.glsl | 88 +++++++ .../gen/var/modf/180fed.wgsl.expected.hlsl | 42 +++ .../gen/var/modf/180fed.wgsl.expected.msl | 45 ++++ .../gen/var/modf/180fed.wgsl.expected.spvasm | 77 ++++++ .../gen/var/modf/180fed.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/modf/9b75f7.wgsl | 46 ++++ .../gen/var/modf/9b75f7.wgsl.expected.glsl | 88 +++++++ .../gen/var/modf/9b75f7.wgsl.expected.hlsl | 42 +++ .../gen/var/modf/9b75f7.wgsl.expected.msl | 45 ++++ .../gen/var/modf/9b75f7.wgsl.expected.spvasm | 79 ++++++ .../gen/var/modf/9b75f7.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/modf/ec2dbc.wgsl | 46 ++++ .../gen/var/modf/ec2dbc.wgsl.expected.glsl | 88 +++++++ .../gen/var/modf/ec2dbc.wgsl.expected.hlsl | 42 +++ .../gen/var/modf/ec2dbc.wgsl.expected.msl | 45 ++++ .../gen/var/modf/ec2dbc.wgsl.expected.spvasm | 77 ++++++ .../gen/var/modf/ec2dbc.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/modf/f5f20d.wgsl | 46 ++++ .../gen/var/modf/f5f20d.wgsl.expected.glsl | 88 +++++++ .../gen/var/modf/f5f20d.wgsl.expected.hlsl | 42 +++ .../gen/var/modf/f5f20d.wgsl.expected.msl | 45 ++++ .../gen/var/modf/f5f20d.wgsl.expected.spvasm | 79 ++++++ .../gen/var/modf/f5f20d.wgsl.expected.wgsl | 20 ++ .../builtins/gen/var/normalize/64d8c0.wgsl | 46 ++++ .../var/normalize/64d8c0.wgsl.expected.glsl | 52 ++++ .../var/normalize/64d8c0.wgsl.expected.hlsl | 31 +++ .../var/normalize/64d8c0.wgsl.expected.msl | 34 +++ .../var/normalize/64d8c0.wgsl.expected.spvasm | 71 +++++ .../var/normalize/64d8c0.wgsl.expected.wgsl | 20 ++ .../builtins/gen/var/normalize/9a0aab.wgsl | 46 ++++ .../var/normalize/9a0aab.wgsl.expected.glsl | 52 ++++ .../var/normalize/9a0aab.wgsl.expected.hlsl | 31 +++ .../var/normalize/9a0aab.wgsl.expected.msl | 34 +++ .../var/normalize/9a0aab.wgsl.expected.spvasm | 69 +++++ .../var/normalize/9a0aab.wgsl.expected.wgsl | 20 ++ .../builtins/gen/var/normalize/fc2ef1.wgsl | 46 ++++ .../var/normalize/fc2ef1.wgsl.expected.glsl | 52 ++++ .../var/normalize/fc2ef1.wgsl.expected.hlsl | 31 +++ .../var/normalize/fc2ef1.wgsl.expected.msl | 34 +++ .../var/normalize/fc2ef1.wgsl.expected.spvasm | 71 +++++ .../var/normalize/fc2ef1.wgsl.expected.wgsl | 20 ++ .../gen/var/pack2x16float/0e97b3.wgsl | 46 ++++ .../pack2x16float/0e97b3.wgsl.expected.glsl | 52 ++++ .../pack2x16float/0e97b3.wgsl.expected.hlsl | 36 +++ .../pack2x16float/0e97b3.wgsl.expected.msl | 34 +++ .../pack2x16float/0e97b3.wgsl.expected.spvasm | 74 ++++++ .../pack2x16float/0e97b3.wgsl.expected.wgsl | 20 ++ .../gen/var/pack2x16snorm/6c169b.wgsl | 46 ++++ .../pack2x16snorm/6c169b.wgsl.expected.glsl | 52 ++++ .../pack2x16snorm/6c169b.wgsl.expected.hlsl | 36 +++ .../pack2x16snorm/6c169b.wgsl.expected.msl | 34 +++ .../pack2x16snorm/6c169b.wgsl.expected.spvasm | 74 ++++++ .../pack2x16snorm/6c169b.wgsl.expected.wgsl | 20 ++ .../gen/var/pack2x16unorm/0f08e4.wgsl | 46 ++++ .../pack2x16unorm/0f08e4.wgsl.expected.glsl | 52 ++++ .../pack2x16unorm/0f08e4.wgsl.expected.hlsl | 36 +++ .../pack2x16unorm/0f08e4.wgsl.expected.msl | 34 +++ .../pack2x16unorm/0f08e4.wgsl.expected.spvasm | 74 ++++++ .../pack2x16unorm/0f08e4.wgsl.expected.wgsl | 20 ++ .../builtins/gen/var/pack4x8snorm/4d22e7.wgsl | 46 ++++ .../pack4x8snorm/4d22e7.wgsl.expected.glsl | 52 ++++ .../pack4x8snorm/4d22e7.wgsl.expected.hlsl | 36 +++ .../var/pack4x8snorm/4d22e7.wgsl.expected.msl | 34 +++ .../pack4x8snorm/4d22e7.wgsl.expected.spvasm | 72 ++++++ .../pack4x8snorm/4d22e7.wgsl.expected.wgsl | 20 ++ .../builtins/gen/var/pack4x8unorm/95c456.wgsl | 46 ++++ .../pack4x8unorm/95c456.wgsl.expected.glsl | 52 ++++ .../pack4x8unorm/95c456.wgsl.expected.hlsl | 36 +++ .../var/pack4x8unorm/95c456.wgsl.expected.msl | 34 +++ .../pack4x8unorm/95c456.wgsl.expected.spvasm | 72 ++++++ .../pack4x8unorm/95c456.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/pow/04a908.wgsl | 47 ++++ .../gen/var/pow/04a908.wgsl.expected.glsl | 55 ++++ .../gen/var/pow/04a908.wgsl.expected.hlsl | 32 +++ .../gen/var/pow/04a908.wgsl.expected.msl | 35 +++ .../gen/var/pow/04a908.wgsl.expected.spvasm | 73 ++++++ .../gen/var/pow/04a908.wgsl.expected.wgsl | 21 ++ test/tint/builtins/gen/var/pow/46e029.wgsl | 47 ++++ .../gen/var/pow/46e029.wgsl.expected.glsl | 55 ++++ .../gen/var/pow/46e029.wgsl.expected.hlsl | 32 +++ .../gen/var/pow/46e029.wgsl.expected.msl | 35 +++ .../gen/var/pow/46e029.wgsl.expected.spvasm | 73 ++++++ .../gen/var/pow/46e029.wgsl.expected.wgsl | 21 ++ test/tint/builtins/gen/var/pow/4a46c9.wgsl | 47 ++++ .../gen/var/pow/4a46c9.wgsl.expected.glsl | 55 ++++ .../gen/var/pow/4a46c9.wgsl.expected.hlsl | 32 +++ .../gen/var/pow/4a46c9.wgsl.expected.msl | 35 +++ .../gen/var/pow/4a46c9.wgsl.expected.spvasm | 75 ++++++ .../gen/var/pow/4a46c9.wgsl.expected.wgsl | 21 ++ test/tint/builtins/gen/var/pow/e60ea5.wgsl | 47 ++++ .../gen/var/pow/e60ea5.wgsl.expected.glsl | 55 ++++ .../gen/var/pow/e60ea5.wgsl.expected.hlsl | 32 +++ .../gen/var/pow/e60ea5.wgsl.expected.msl | 35 +++ .../gen/var/pow/e60ea5.wgsl.expected.spvasm | 75 ++++++ .../gen/var/pow/e60ea5.wgsl.expected.wgsl | 21 ++ .../tint/builtins/gen/var/radians/09b7fc.wgsl | 46 ++++ .../gen/var/radians/09b7fc.wgsl.expected.glsl | 67 +++++ .../gen/var/radians/09b7fc.wgsl.expected.hlsl | 35 +++ .../gen/var/radians/09b7fc.wgsl.expected.msl | 39 +++ .../var/radians/09b7fc.wgsl.expected.spvasm | 69 +++++ .../gen/var/radians/09b7fc.wgsl.expected.wgsl | 20 ++ .../tint/builtins/gen/var/radians/61687a.wgsl | 46 ++++ .../gen/var/radians/61687a.wgsl.expected.glsl | 67 +++++ .../gen/var/radians/61687a.wgsl.expected.hlsl | 35 +++ .../gen/var/radians/61687a.wgsl.expected.msl | 39 +++ .../var/radians/61687a.wgsl.expected.spvasm | 71 +++++ .../gen/var/radians/61687a.wgsl.expected.wgsl | 20 ++ .../tint/builtins/gen/var/radians/6b0ff2.wgsl | 46 ++++ .../gen/var/radians/6b0ff2.wgsl.expected.glsl | 67 +++++ .../gen/var/radians/6b0ff2.wgsl.expected.hlsl | 35 +++ .../gen/var/radians/6b0ff2.wgsl.expected.msl | 39 +++ .../var/radians/6b0ff2.wgsl.expected.spvasm | 69 +++++ .../gen/var/radians/6b0ff2.wgsl.expected.wgsl | 20 ++ .../tint/builtins/gen/var/radians/f96258.wgsl | 46 ++++ .../gen/var/radians/f96258.wgsl.expected.glsl | 67 +++++ .../gen/var/radians/f96258.wgsl.expected.hlsl | 35 +++ .../gen/var/radians/f96258.wgsl.expected.msl | 39 +++ .../var/radians/f96258.wgsl.expected.spvasm | 71 +++++ .../gen/var/radians/f96258.wgsl.expected.wgsl | 20 ++ .../tint/builtins/gen/var/reflect/05357e.wgsl | 47 ++++ .../gen/var/reflect/05357e.wgsl.expected.glsl | 55 ++++ .../gen/var/reflect/05357e.wgsl.expected.hlsl | 32 +++ .../gen/var/reflect/05357e.wgsl.expected.msl | 35 +++ .../var/reflect/05357e.wgsl.expected.spvasm | 73 ++++++ .../gen/var/reflect/05357e.wgsl.expected.wgsl | 21 ++ .../tint/builtins/gen/var/reflect/b61e10.wgsl | 47 ++++ .../gen/var/reflect/b61e10.wgsl.expected.glsl | 55 ++++ .../gen/var/reflect/b61e10.wgsl.expected.hlsl | 32 +++ .../gen/var/reflect/b61e10.wgsl.expected.msl | 35 +++ .../var/reflect/b61e10.wgsl.expected.spvasm | 75 ++++++ .../gen/var/reflect/b61e10.wgsl.expected.wgsl | 21 ++ .../tint/builtins/gen/var/reflect/f47fdb.wgsl | 47 ++++ .../gen/var/reflect/f47fdb.wgsl.expected.glsl | 55 ++++ .../gen/var/reflect/f47fdb.wgsl.expected.hlsl | 32 +++ .../gen/var/reflect/f47fdb.wgsl.expected.msl | 35 +++ .../var/reflect/f47fdb.wgsl.expected.spvasm | 75 ++++++ .../gen/var/reflect/f47fdb.wgsl.expected.wgsl | 21 ++ .../tint/builtins/gen/var/refract/7e02e6.wgsl | 48 ++++ .../gen/var/refract/7e02e6.wgsl.expected.glsl | 58 +++++ .../gen/var/refract/7e02e6.wgsl.expected.hlsl | 33 +++ .../gen/var/refract/7e02e6.wgsl.expected.msl | 36 +++ .../var/refract/7e02e6.wgsl.expected.spvasm | 78 ++++++ .../gen/var/refract/7e02e6.wgsl.expected.wgsl | 22 ++ .../tint/builtins/gen/var/refract/cbc1d2.wgsl | 48 ++++ .../gen/var/refract/cbc1d2.wgsl.expected.glsl | 58 +++++ .../gen/var/refract/cbc1d2.wgsl.expected.hlsl | 33 +++ .../gen/var/refract/cbc1d2.wgsl.expected.msl | 36 +++ .../var/refract/cbc1d2.wgsl.expected.spvasm | 80 ++++++ .../gen/var/refract/cbc1d2.wgsl.expected.wgsl | 22 ++ .../tint/builtins/gen/var/refract/cd905f.wgsl | 48 ++++ .../gen/var/refract/cd905f.wgsl.expected.glsl | 58 +++++ .../gen/var/refract/cd905f.wgsl.expected.hlsl | 33 +++ .../gen/var/refract/cd905f.wgsl.expected.msl | 36 +++ .../var/refract/cd905f.wgsl.expected.spvasm | 80 ++++++ .../gen/var/refract/cd905f.wgsl.expected.wgsl | 22 ++ .../builtins/gen/var/reverseBits/222177.wgsl | 46 ++++ .../var/reverseBits/222177.wgsl.expected.glsl | 52 ++++ .../var/reverseBits/222177.wgsl.expected.hlsl | 31 +++ .../var/reverseBits/222177.wgsl.expected.msl | 34 +++ .../reverseBits/222177.wgsl.expected.spvasm | 71 +++++ .../var/reverseBits/222177.wgsl.expected.wgsl | 20 ++ .../builtins/gen/var/reverseBits/35fea9.wgsl | 46 ++++ .../var/reverseBits/35fea9.wgsl.expected.glsl | 52 ++++ .../var/reverseBits/35fea9.wgsl.expected.hlsl | 31 +++ .../var/reverseBits/35fea9.wgsl.expected.msl | 34 +++ .../reverseBits/35fea9.wgsl.expected.spvasm | 71 +++++ .../var/reverseBits/35fea9.wgsl.expected.wgsl | 20 ++ .../builtins/gen/var/reverseBits/4dbd6f.wgsl | 46 ++++ .../var/reverseBits/4dbd6f.wgsl.expected.glsl | 52 ++++ .../var/reverseBits/4dbd6f.wgsl.expected.hlsl | 31 +++ .../var/reverseBits/4dbd6f.wgsl.expected.msl | 34 +++ .../reverseBits/4dbd6f.wgsl.expected.spvasm | 71 +++++ .../var/reverseBits/4dbd6f.wgsl.expected.wgsl | 20 ++ .../builtins/gen/var/reverseBits/7c4269.wgsl | 46 ++++ .../var/reverseBits/7c4269.wgsl.expected.glsl | 52 ++++ .../var/reverseBits/7c4269.wgsl.expected.hlsl | 31 +++ .../var/reverseBits/7c4269.wgsl.expected.msl | 34 +++ .../reverseBits/7c4269.wgsl.expected.spvasm | 71 +++++ .../var/reverseBits/7c4269.wgsl.expected.wgsl | 20 ++ .../builtins/gen/var/reverseBits/a6ccd4.wgsl | 46 ++++ .../var/reverseBits/a6ccd4.wgsl.expected.glsl | 52 ++++ .../var/reverseBits/a6ccd4.wgsl.expected.hlsl | 31 +++ .../var/reverseBits/a6ccd4.wgsl.expected.msl | 34 +++ .../reverseBits/a6ccd4.wgsl.expected.spvasm | 71 +++++ .../var/reverseBits/a6ccd4.wgsl.expected.wgsl | 20 ++ .../builtins/gen/var/reverseBits/c21bc1.wgsl | 46 ++++ .../var/reverseBits/c21bc1.wgsl.expected.glsl | 52 ++++ .../var/reverseBits/c21bc1.wgsl.expected.hlsl | 31 +++ .../var/reverseBits/c21bc1.wgsl.expected.msl | 34 +++ .../reverseBits/c21bc1.wgsl.expected.spvasm | 71 +++++ .../var/reverseBits/c21bc1.wgsl.expected.wgsl | 20 ++ .../builtins/gen/var/reverseBits/e1f4c1.wgsl | 46 ++++ .../var/reverseBits/e1f4c1.wgsl.expected.glsl | 52 ++++ .../var/reverseBits/e1f4c1.wgsl.expected.hlsl | 31 +++ .../var/reverseBits/e1f4c1.wgsl.expected.msl | 34 +++ .../reverseBits/e1f4c1.wgsl.expected.spvasm | 71 +++++ .../var/reverseBits/e1f4c1.wgsl.expected.wgsl | 20 ++ .../builtins/gen/var/reverseBits/e31adf.wgsl | 46 ++++ .../var/reverseBits/e31adf.wgsl.expected.glsl | 52 ++++ .../var/reverseBits/e31adf.wgsl.expected.hlsl | 31 +++ .../var/reverseBits/e31adf.wgsl.expected.msl | 34 +++ .../reverseBits/e31adf.wgsl.expected.spvasm | 71 +++++ .../var/reverseBits/e31adf.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/round/106c0b.wgsl | 46 ++++ .../gen/var/round/106c0b.wgsl.expected.glsl | 52 ++++ .../gen/var/round/106c0b.wgsl.expected.hlsl | 31 +++ .../gen/var/round/106c0b.wgsl.expected.msl | 34 +++ .../gen/var/round/106c0b.wgsl.expected.spvasm | 69 +++++ .../gen/var/round/106c0b.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/round/1c7897.wgsl | 46 ++++ .../gen/var/round/1c7897.wgsl.expected.glsl | 52 ++++ .../gen/var/round/1c7897.wgsl.expected.hlsl | 31 +++ .../gen/var/round/1c7897.wgsl.expected.msl | 34 +++ .../gen/var/round/1c7897.wgsl.expected.spvasm | 71 +++++ .../gen/var/round/1c7897.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/round/52c84d.wgsl | 46 ++++ .../gen/var/round/52c84d.wgsl.expected.glsl | 52 ++++ .../gen/var/round/52c84d.wgsl.expected.hlsl | 31 +++ .../gen/var/round/52c84d.wgsl.expected.msl | 34 +++ .../gen/var/round/52c84d.wgsl.expected.spvasm | 71 +++++ .../gen/var/round/52c84d.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/round/9edc38.wgsl | 46 ++++ .../gen/var/round/9edc38.wgsl.expected.glsl | 52 ++++ .../gen/var/round/9edc38.wgsl.expected.hlsl | 31 +++ .../gen/var/round/9edc38.wgsl.expected.msl | 34 +++ .../gen/var/round/9edc38.wgsl.expected.spvasm | 69 +++++ .../gen/var/round/9edc38.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/select/00b848.wgsl | 48 ++++ .../gen/var/select/00b848.wgsl.expected.glsl | 58 +++++ .../gen/var/select/00b848.wgsl.expected.hlsl | 33 +++ .../gen/var/select/00b848.wgsl.expected.msl | 36 +++ .../var/select/00b848.wgsl.expected.spvasm | 83 ++++++ .../gen/var/select/00b848.wgsl.expected.wgsl | 22 ++ test/tint/builtins/gen/var/select/01e2cd.wgsl | 48 ++++ .../gen/var/select/01e2cd.wgsl.expected.glsl | 58 +++++ .../gen/var/select/01e2cd.wgsl.expected.hlsl | 33 +++ .../gen/var/select/01e2cd.wgsl.expected.msl | 36 +++ .../var/select/01e2cd.wgsl.expected.spvasm | 83 ++++++ .../gen/var/select/01e2cd.wgsl.expected.wgsl | 22 ++ test/tint/builtins/gen/var/select/087ea4.wgsl | 48 ++++ .../gen/var/select/087ea4.wgsl.expected.glsl | 58 +++++ .../gen/var/select/087ea4.wgsl.expected.hlsl | 33 +++ .../gen/var/select/087ea4.wgsl.expected.msl | 36 +++ .../var/select/087ea4.wgsl.expected.spvasm | 87 +++++++ .../gen/var/select/087ea4.wgsl.expected.wgsl | 22 ++ test/tint/builtins/gen/var/select/1e960b.wgsl | 48 ++++ .../gen/var/select/1e960b.wgsl.expected.glsl | 58 +++++ .../gen/var/select/1e960b.wgsl.expected.hlsl | 33 +++ .../gen/var/select/1e960b.wgsl.expected.msl | 36 +++ .../var/select/1e960b.wgsl.expected.spvasm | 83 ++++++ .../gen/var/select/1e960b.wgsl.expected.wgsl | 22 ++ test/tint/builtins/gen/var/select/266aff.wgsl | 48 ++++ .../gen/var/select/266aff.wgsl.expected.glsl | 58 +++++ .../gen/var/select/266aff.wgsl.expected.hlsl | 33 +++ .../gen/var/select/266aff.wgsl.expected.msl | 36 +++ .../var/select/266aff.wgsl.expected.spvasm | 82 ++++++ .../gen/var/select/266aff.wgsl.expected.wgsl | 22 ++ test/tint/builtins/gen/var/select/28a27e.wgsl | 48 ++++ .../gen/var/select/28a27e.wgsl.expected.glsl | 58 +++++ .../gen/var/select/28a27e.wgsl.expected.hlsl | 33 +++ .../gen/var/select/28a27e.wgsl.expected.msl | 36 +++ .../var/select/28a27e.wgsl.expected.spvasm | 83 ++++++ .../gen/var/select/28a27e.wgsl.expected.wgsl | 22 ++ test/tint/builtins/gen/var/select/3c25ce.wgsl | 48 ++++ .../gen/var/select/3c25ce.wgsl.expected.glsl | 58 +++++ .../gen/var/select/3c25ce.wgsl.expected.hlsl | 33 +++ .../gen/var/select/3c25ce.wgsl.expected.msl | 36 +++ .../var/select/3c25ce.wgsl.expected.spvasm | 83 ++++++ .../gen/var/select/3c25ce.wgsl.expected.wgsl | 22 ++ test/tint/builtins/gen/var/select/416e14.wgsl | 48 ++++ .../gen/var/select/416e14.wgsl.expected.glsl | 58 +++++ .../gen/var/select/416e14.wgsl.expected.hlsl | 33 +++ .../gen/var/select/416e14.wgsl.expected.msl | 36 +++ .../var/select/416e14.wgsl.expected.spvasm | 79 ++++++ .../gen/var/select/416e14.wgsl.expected.wgsl | 22 ++ test/tint/builtins/gen/var/select/51b047.wgsl | 48 ++++ .../gen/var/select/51b047.wgsl.expected.glsl | 58 +++++ .../gen/var/select/51b047.wgsl.expected.hlsl | 33 +++ .../gen/var/select/51b047.wgsl.expected.msl | 36 +++ .../var/select/51b047.wgsl.expected.spvasm | 87 +++++++ .../gen/var/select/51b047.wgsl.expected.wgsl | 22 ++ test/tint/builtins/gen/var/select/713567.wgsl | 48 ++++ .../gen/var/select/713567.wgsl.expected.glsl | 58 +++++ .../gen/var/select/713567.wgsl.expected.hlsl | 33 +++ .../gen/var/select/713567.wgsl.expected.msl | 36 +++ .../var/select/713567.wgsl.expected.spvasm | 84 ++++++ .../gen/var/select/713567.wgsl.expected.wgsl | 22 ++ test/tint/builtins/gen/var/select/78be5f.wgsl | 48 ++++ .../gen/var/select/78be5f.wgsl.expected.glsl | 58 +++++ .../gen/var/select/78be5f.wgsl.expected.hlsl | 33 +++ .../gen/var/select/78be5f.wgsl.expected.msl | 36 +++ .../var/select/78be5f.wgsl.expected.spvasm | 86 +++++++ .../gen/var/select/78be5f.wgsl.expected.wgsl | 22 ++ test/tint/builtins/gen/var/select/80a9a9.wgsl | 48 ++++ .../gen/var/select/80a9a9.wgsl.expected.glsl | 58 +++++ .../gen/var/select/80a9a9.wgsl.expected.hlsl | 33 +++ .../gen/var/select/80a9a9.wgsl.expected.msl | 36 +++ .../var/select/80a9a9.wgsl.expected.spvasm | 79 ++++++ .../gen/var/select/80a9a9.wgsl.expected.wgsl | 22 ++ test/tint/builtins/gen/var/select/8fa62c.wgsl | 48 ++++ .../gen/var/select/8fa62c.wgsl.expected.glsl | 58 +++++ .../gen/var/select/8fa62c.wgsl.expected.hlsl | 33 +++ .../gen/var/select/8fa62c.wgsl.expected.msl | 36 +++ .../var/select/8fa62c.wgsl.expected.spvasm | 87 +++++++ .../gen/var/select/8fa62c.wgsl.expected.wgsl | 22 ++ test/tint/builtins/gen/var/select/99f883.wgsl | 48 ++++ .../gen/var/select/99f883.wgsl.expected.glsl | 58 +++++ .../gen/var/select/99f883.wgsl.expected.hlsl | 33 +++ .../gen/var/select/99f883.wgsl.expected.msl | 36 +++ .../var/select/99f883.wgsl.expected.spvasm | 82 ++++++ .../gen/var/select/99f883.wgsl.expected.wgsl | 22 ++ test/tint/builtins/gen/var/select/a2860e.wgsl | 48 ++++ .../gen/var/select/a2860e.wgsl.expected.glsl | 58 +++++ .../gen/var/select/a2860e.wgsl.expected.hlsl | 33 +++ .../gen/var/select/a2860e.wgsl.expected.msl | 36 +++ .../var/select/a2860e.wgsl.expected.spvasm | 83 ++++++ .../gen/var/select/a2860e.wgsl.expected.wgsl | 22 ++ test/tint/builtins/gen/var/select/ab069f.wgsl | 48 ++++ .../gen/var/select/ab069f.wgsl.expected.glsl | 58 +++++ .../gen/var/select/ab069f.wgsl.expected.hlsl | 33 +++ .../gen/var/select/ab069f.wgsl.expected.msl | 36 +++ .../var/select/ab069f.wgsl.expected.spvasm | 87 +++++++ .../gen/var/select/ab069f.wgsl.expected.wgsl | 22 ++ test/tint/builtins/gen/var/select/b04721.wgsl | 48 ++++ .../gen/var/select/b04721.wgsl.expected.glsl | 58 +++++ .../gen/var/select/b04721.wgsl.expected.hlsl | 33 +++ .../gen/var/select/b04721.wgsl.expected.msl | 36 +++ .../var/select/b04721.wgsl.expected.spvasm | 87 +++++++ .../gen/var/select/b04721.wgsl.expected.wgsl | 22 ++ test/tint/builtins/gen/var/select/bb447f.wgsl | 48 ++++ .../gen/var/select/bb447f.wgsl.expected.glsl | 58 +++++ .../gen/var/select/bb447f.wgsl.expected.hlsl | 33 +++ .../gen/var/select/bb447f.wgsl.expected.msl | 36 +++ .../var/select/bb447f.wgsl.expected.spvasm | 87 +++++++ .../gen/var/select/bb447f.wgsl.expected.wgsl | 22 ++ test/tint/builtins/gen/var/select/bb8aae.wgsl | 48 ++++ .../gen/var/select/bb8aae.wgsl.expected.glsl | 58 +++++ .../gen/var/select/bb8aae.wgsl.expected.hlsl | 33 +++ .../gen/var/select/bb8aae.wgsl.expected.msl | 36 +++ .../var/select/bb8aae.wgsl.expected.spvasm | 80 ++++++ .../gen/var/select/bb8aae.wgsl.expected.wgsl | 22 ++ test/tint/builtins/gen/var/select/bf3d29.wgsl | 48 ++++ .../gen/var/select/bf3d29.wgsl.expected.glsl | 58 +++++ .../gen/var/select/bf3d29.wgsl.expected.hlsl | 33 +++ .../gen/var/select/bf3d29.wgsl.expected.msl | 36 +++ .../var/select/bf3d29.wgsl.expected.spvasm | 86 +++++++ .../gen/var/select/bf3d29.wgsl.expected.wgsl | 22 ++ test/tint/builtins/gen/var/select/c31f9e.wgsl | 48 ++++ .../gen/var/select/c31f9e.wgsl.expected.glsl | 58 +++++ .../gen/var/select/c31f9e.wgsl.expected.hlsl | 33 +++ .../gen/var/select/c31f9e.wgsl.expected.msl | 36 +++ .../var/select/c31f9e.wgsl.expected.spvasm | 78 ++++++ .../gen/var/select/c31f9e.wgsl.expected.wgsl | 22 ++ test/tint/builtins/gen/var/select/c41bd1.wgsl | 48 ++++ .../gen/var/select/c41bd1.wgsl.expected.glsl | 58 +++++ .../gen/var/select/c41bd1.wgsl.expected.hlsl | 33 +++ .../gen/var/select/c41bd1.wgsl.expected.msl | 36 +++ .../var/select/c41bd1.wgsl.expected.spvasm | 83 ++++++ .../gen/var/select/c41bd1.wgsl.expected.wgsl | 22 ++ test/tint/builtins/gen/var/select/c4a4ef.wgsl | 48 ++++ .../gen/var/select/c4a4ef.wgsl.expected.glsl | 58 +++++ .../gen/var/select/c4a4ef.wgsl.expected.hlsl | 33 +++ .../gen/var/select/c4a4ef.wgsl.expected.msl | 36 +++ .../var/select/c4a4ef.wgsl.expected.spvasm | 83 ++++++ .../gen/var/select/c4a4ef.wgsl.expected.wgsl | 22 ++ test/tint/builtins/gen/var/select/cb9301.wgsl | 48 ++++ .../gen/var/select/cb9301.wgsl.expected.glsl | 58 +++++ .../gen/var/select/cb9301.wgsl.expected.hlsl | 33 +++ .../gen/var/select/cb9301.wgsl.expected.msl | 36 +++ .../var/select/cb9301.wgsl.expected.spvasm | 79 ++++++ .../gen/var/select/cb9301.wgsl.expected.wgsl | 22 ++ test/tint/builtins/gen/var/select/e3e028.wgsl | 48 ++++ .../gen/var/select/e3e028.wgsl.expected.glsl | 58 +++++ .../gen/var/select/e3e028.wgsl.expected.hlsl | 33 +++ .../gen/var/select/e3e028.wgsl.expected.msl | 36 +++ .../var/select/e3e028.wgsl.expected.spvasm | 79 ++++++ .../gen/var/select/e3e028.wgsl.expected.wgsl | 22 ++ test/tint/builtins/gen/var/select/ebfea2.wgsl | 48 ++++ .../gen/var/select/ebfea2.wgsl.expected.glsl | 58 +++++ .../gen/var/select/ebfea2.wgsl.expected.hlsl | 33 +++ .../gen/var/select/ebfea2.wgsl.expected.msl | 36 +++ .../var/select/ebfea2.wgsl.expected.spvasm | 82 ++++++ .../gen/var/select/ebfea2.wgsl.expected.wgsl | 22 ++ test/tint/builtins/gen/var/select/ed8a15.wgsl | 48 ++++ .../gen/var/select/ed8a15.wgsl.expected.glsl | 58 +++++ .../gen/var/select/ed8a15.wgsl.expected.hlsl | 33 +++ .../gen/var/select/ed8a15.wgsl.expected.msl | 36 +++ .../var/select/ed8a15.wgsl.expected.spvasm | 82 ++++++ .../gen/var/select/ed8a15.wgsl.expected.wgsl | 22 ++ test/tint/builtins/gen/var/select/fb7e53.wgsl | 48 ++++ .../gen/var/select/fb7e53.wgsl.expected.glsl | 58 +++++ .../gen/var/select/fb7e53.wgsl.expected.hlsl | 33 +++ .../gen/var/select/fb7e53.wgsl.expected.msl | 36 +++ .../var/select/fb7e53.wgsl.expected.spvasm | 83 ++++++ .../gen/var/select/fb7e53.wgsl.expected.wgsl | 22 ++ test/tint/builtins/gen/var/sign/159665.wgsl | 46 ++++ .../gen/var/sign/159665.wgsl.expected.glsl | 52 ++++ .../gen/var/sign/159665.wgsl.expected.hlsl | 31 +++ .../gen/var/sign/159665.wgsl.expected.msl | 34 +++ .../gen/var/sign/159665.wgsl.expected.spvasm | 71 +++++ .../gen/var/sign/159665.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/sign/b8f634.wgsl | 46 ++++ .../gen/var/sign/b8f634.wgsl.expected.glsl | 52 ++++ .../gen/var/sign/b8f634.wgsl.expected.hlsl | 31 +++ .../gen/var/sign/b8f634.wgsl.expected.msl | 34 +++ .../gen/var/sign/b8f634.wgsl.expected.spvasm | 69 +++++ .../gen/var/sign/b8f634.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/sign/d065d8.wgsl | 46 ++++ .../gen/var/sign/d065d8.wgsl.expected.glsl | 52 ++++ .../gen/var/sign/d065d8.wgsl.expected.hlsl | 31 +++ .../gen/var/sign/d065d8.wgsl.expected.msl | 34 +++ .../gen/var/sign/d065d8.wgsl.expected.spvasm | 71 +++++ .../gen/var/sign/d065d8.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/sign/dd790e.wgsl | 46 ++++ .../gen/var/sign/dd790e.wgsl.expected.glsl | 52 ++++ .../gen/var/sign/dd790e.wgsl.expected.hlsl | 31 +++ .../gen/var/sign/dd790e.wgsl.expected.msl | 34 +++ .../gen/var/sign/dd790e.wgsl.expected.spvasm | 69 +++++ .../gen/var/sign/dd790e.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/sin/01f241.wgsl | 46 ++++ .../gen/var/sin/01f241.wgsl.expected.glsl | 52 ++++ .../gen/var/sin/01f241.wgsl.expected.hlsl | 31 +++ .../gen/var/sin/01f241.wgsl.expected.msl | 34 +++ .../gen/var/sin/01f241.wgsl.expected.spvasm | 71 +++++ .../gen/var/sin/01f241.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/sin/4e3979.wgsl | 46 ++++ .../gen/var/sin/4e3979.wgsl.expected.glsl | 52 ++++ .../gen/var/sin/4e3979.wgsl.expected.hlsl | 31 +++ .../gen/var/sin/4e3979.wgsl.expected.msl | 34 +++ .../gen/var/sin/4e3979.wgsl.expected.spvasm | 69 +++++ .../gen/var/sin/4e3979.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/sin/b78c91.wgsl | 46 ++++ .../gen/var/sin/b78c91.wgsl.expected.glsl | 52 ++++ .../gen/var/sin/b78c91.wgsl.expected.hlsl | 31 +++ .../gen/var/sin/b78c91.wgsl.expected.msl | 34 +++ .../gen/var/sin/b78c91.wgsl.expected.spvasm | 69 +++++ .../gen/var/sin/b78c91.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/sin/fc8bc4.wgsl | 46 ++++ .../gen/var/sin/fc8bc4.wgsl.expected.glsl | 52 ++++ .../gen/var/sin/fc8bc4.wgsl.expected.hlsl | 31 +++ .../gen/var/sin/fc8bc4.wgsl.expected.msl | 34 +++ .../gen/var/sin/fc8bc4.wgsl.expected.spvasm | 71 +++++ .../gen/var/sin/fc8bc4.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/sinh/445e33.wgsl | 46 ++++ .../gen/var/sinh/445e33.wgsl.expected.glsl | 52 ++++ .../gen/var/sinh/445e33.wgsl.expected.hlsl | 31 +++ .../gen/var/sinh/445e33.wgsl.expected.msl | 34 +++ .../gen/var/sinh/445e33.wgsl.expected.spvasm | 69 +++++ .../gen/var/sinh/445e33.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/sinh/7bb598.wgsl | 46 ++++ .../gen/var/sinh/7bb598.wgsl.expected.glsl | 52 ++++ .../gen/var/sinh/7bb598.wgsl.expected.hlsl | 31 +++ .../gen/var/sinh/7bb598.wgsl.expected.msl | 34 +++ .../gen/var/sinh/7bb598.wgsl.expected.spvasm | 69 +++++ .../gen/var/sinh/7bb598.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/sinh/b9860e.wgsl | 46 ++++ .../gen/var/sinh/b9860e.wgsl.expected.glsl | 52 ++++ .../gen/var/sinh/b9860e.wgsl.expected.hlsl | 31 +++ .../gen/var/sinh/b9860e.wgsl.expected.msl | 34 +++ .../gen/var/sinh/b9860e.wgsl.expected.spvasm | 71 +++++ .../gen/var/sinh/b9860e.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/sinh/c9a5eb.wgsl | 46 ++++ .../gen/var/sinh/c9a5eb.wgsl.expected.glsl | 52 ++++ .../gen/var/sinh/c9a5eb.wgsl.expected.hlsl | 31 +++ .../gen/var/sinh/c9a5eb.wgsl.expected.msl | 34 +++ .../gen/var/sinh/c9a5eb.wgsl.expected.spvasm | 71 +++++ .../gen/var/sinh/c9a5eb.wgsl.expected.wgsl | 20 ++ .../builtins/gen/var/smoothstep/392c19.wgsl | 48 ++++ .../var/smoothstep/392c19.wgsl.expected.glsl | 58 +++++ .../var/smoothstep/392c19.wgsl.expected.hlsl | 33 +++ .../var/smoothstep/392c19.wgsl.expected.msl | 36 +++ .../smoothstep/392c19.wgsl.expected.spvasm | 79 ++++++ .../var/smoothstep/392c19.wgsl.expected.wgsl | 22 ++ .../builtins/gen/var/smoothstep/40864c.wgsl | 48 ++++ .../var/smoothstep/40864c.wgsl.expected.glsl | 58 +++++ .../var/smoothstep/40864c.wgsl.expected.hlsl | 33 +++ .../var/smoothstep/40864c.wgsl.expected.msl | 36 +++ .../smoothstep/40864c.wgsl.expected.spvasm | 77 ++++++ .../var/smoothstep/40864c.wgsl.expected.wgsl | 22 ++ .../builtins/gen/var/smoothstep/6c4975.wgsl | 48 ++++ .../var/smoothstep/6c4975.wgsl.expected.glsl | 58 +++++ .../var/smoothstep/6c4975.wgsl.expected.hlsl | 33 +++ .../var/smoothstep/6c4975.wgsl.expected.msl | 36 +++ .../smoothstep/6c4975.wgsl.expected.spvasm | 77 ++++++ .../var/smoothstep/6c4975.wgsl.expected.wgsl | 22 ++ .../builtins/gen/var/smoothstep/aad1db.wgsl | 48 ++++ .../var/smoothstep/aad1db.wgsl.expected.glsl | 58 +++++ .../var/smoothstep/aad1db.wgsl.expected.hlsl | 33 +++ .../var/smoothstep/aad1db.wgsl.expected.msl | 36 +++ .../smoothstep/aad1db.wgsl.expected.spvasm | 79 ++++++ .../var/smoothstep/aad1db.wgsl.expected.wgsl | 22 ++ test/tint/builtins/gen/var/sqrt/20c74e.wgsl | 46 ++++ .../gen/var/sqrt/20c74e.wgsl.expected.glsl | 52 ++++ .../gen/var/sqrt/20c74e.wgsl.expected.hlsl | 31 +++ .../gen/var/sqrt/20c74e.wgsl.expected.msl | 34 +++ .../gen/var/sqrt/20c74e.wgsl.expected.spvasm | 69 +++++ .../gen/var/sqrt/20c74e.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/sqrt/8c7024.wgsl | 46 ++++ .../gen/var/sqrt/8c7024.wgsl.expected.glsl | 52 ++++ .../gen/var/sqrt/8c7024.wgsl.expected.hlsl | 31 +++ .../gen/var/sqrt/8c7024.wgsl.expected.msl | 34 +++ .../gen/var/sqrt/8c7024.wgsl.expected.spvasm | 71 +++++ .../gen/var/sqrt/8c7024.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/sqrt/aa0d7a.wgsl | 46 ++++ .../gen/var/sqrt/aa0d7a.wgsl.expected.glsl | 52 ++++ .../gen/var/sqrt/aa0d7a.wgsl.expected.hlsl | 31 +++ .../gen/var/sqrt/aa0d7a.wgsl.expected.msl | 34 +++ .../gen/var/sqrt/aa0d7a.wgsl.expected.spvasm | 69 +++++ .../gen/var/sqrt/aa0d7a.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/sqrt/f8c59a.wgsl | 46 ++++ .../gen/var/sqrt/f8c59a.wgsl.expected.glsl | 52 ++++ .../gen/var/sqrt/f8c59a.wgsl.expected.hlsl | 31 +++ .../gen/var/sqrt/f8c59a.wgsl.expected.msl | 34 +++ .../gen/var/sqrt/f8c59a.wgsl.expected.spvasm | 71 +++++ .../gen/var/sqrt/f8c59a.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/step/0b073b.wgsl | 47 ++++ .../gen/var/step/0b073b.wgsl.expected.glsl | 55 ++++ .../gen/var/step/0b073b.wgsl.expected.hlsl | 32 +++ .../gen/var/step/0b073b.wgsl.expected.msl | 35 +++ .../gen/var/step/0b073b.wgsl.expected.spvasm | 73 ++++++ .../gen/var/step/0b073b.wgsl.expected.wgsl | 21 ++ test/tint/builtins/gen/var/step/19accd.wgsl | 47 ++++ .../gen/var/step/19accd.wgsl.expected.glsl | 55 ++++ .../gen/var/step/19accd.wgsl.expected.hlsl | 32 +++ .../gen/var/step/19accd.wgsl.expected.msl | 35 +++ .../gen/var/step/19accd.wgsl.expected.spvasm | 75 ++++++ .../gen/var/step/19accd.wgsl.expected.wgsl | 21 ++ test/tint/builtins/gen/var/step/334303.wgsl | 47 ++++ .../gen/var/step/334303.wgsl.expected.glsl | 55 ++++ .../gen/var/step/334303.wgsl.expected.hlsl | 32 +++ .../gen/var/step/334303.wgsl.expected.msl | 35 +++ .../gen/var/step/334303.wgsl.expected.spvasm | 75 ++++++ .../gen/var/step/334303.wgsl.expected.wgsl | 21 ++ test/tint/builtins/gen/var/step/e2b337.wgsl | 47 ++++ .../gen/var/step/e2b337.wgsl.expected.glsl | 55 ++++ .../gen/var/step/e2b337.wgsl.expected.hlsl | 32 +++ .../gen/var/step/e2b337.wgsl.expected.msl | 35 +++ .../gen/var/step/e2b337.wgsl.expected.spvasm | 73 ++++++ .../gen/var/step/e2b337.wgsl.expected.wgsl | 21 ++ .../gen/var/storageBarrier/d87211.wgsl | 34 +++ .../storageBarrier/d87211.wgsl.expected.glsl | 15 ++ .../storageBarrier/d87211.wgsl.expected.hlsl | 9 + .../storageBarrier/d87211.wgsl.expected.msl | 12 + .../d87211.wgsl.expected.spvasm | 26 ++ .../storageBarrier/d87211.wgsl.expected.wgsl | 8 + test/tint/builtins/gen/var/tan/244e2a.wgsl | 46 ++++ .../gen/var/tan/244e2a.wgsl.expected.glsl | 52 ++++ .../gen/var/tan/244e2a.wgsl.expected.hlsl | 31 +++ .../gen/var/tan/244e2a.wgsl.expected.msl | 34 +++ .../gen/var/tan/244e2a.wgsl.expected.spvasm | 69 +++++ .../gen/var/tan/244e2a.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/tan/2f030e.wgsl | 46 ++++ .../gen/var/tan/2f030e.wgsl.expected.glsl | 52 ++++ .../gen/var/tan/2f030e.wgsl.expected.hlsl | 31 +++ .../gen/var/tan/2f030e.wgsl.expected.msl | 34 +++ .../gen/var/tan/2f030e.wgsl.expected.spvasm | 69 +++++ .../gen/var/tan/2f030e.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/tan/7ea104.wgsl | 46 ++++ .../gen/var/tan/7ea104.wgsl.expected.glsl | 52 ++++ .../gen/var/tan/7ea104.wgsl.expected.hlsl | 31 +++ .../gen/var/tan/7ea104.wgsl.expected.msl | 34 +++ .../gen/var/tan/7ea104.wgsl.expected.spvasm | 71 +++++ .../gen/var/tan/7ea104.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/tan/8ce3e9.wgsl | 46 ++++ .../gen/var/tan/8ce3e9.wgsl.expected.glsl | 52 ++++ .../gen/var/tan/8ce3e9.wgsl.expected.hlsl | 31 +++ .../gen/var/tan/8ce3e9.wgsl.expected.msl | 34 +++ .../gen/var/tan/8ce3e9.wgsl.expected.spvasm | 71 +++++ .../gen/var/tan/8ce3e9.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/tanh/5663c5.wgsl | 46 ++++ .../gen/var/tanh/5663c5.wgsl.expected.glsl | 52 ++++ .../gen/var/tanh/5663c5.wgsl.expected.hlsl | 31 +++ .../gen/var/tanh/5663c5.wgsl.expected.msl | 34 +++ .../gen/var/tanh/5663c5.wgsl.expected.spvasm | 69 +++++ .../gen/var/tanh/5663c5.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/tanh/5724b3.wgsl | 46 ++++ .../gen/var/tanh/5724b3.wgsl.expected.glsl | 52 ++++ .../gen/var/tanh/5724b3.wgsl.expected.hlsl | 31 +++ .../gen/var/tanh/5724b3.wgsl.expected.msl | 34 +++ .../gen/var/tanh/5724b3.wgsl.expected.spvasm | 71 +++++ .../gen/var/tanh/5724b3.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/tanh/9f9fb9.wgsl | 46 ++++ .../gen/var/tanh/9f9fb9.wgsl.expected.glsl | 52 ++++ .../gen/var/tanh/9f9fb9.wgsl.expected.hlsl | 31 +++ .../gen/var/tanh/9f9fb9.wgsl.expected.msl | 34 +++ .../gen/var/tanh/9f9fb9.wgsl.expected.spvasm | 71 +++++ .../gen/var/tanh/9f9fb9.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/tanh/c15fdb.wgsl | 46 ++++ .../gen/var/tanh/c15fdb.wgsl.expected.glsl | 52 ++++ .../gen/var/tanh/c15fdb.wgsl.expected.hlsl | 31 +++ .../gen/var/tanh/c15fdb.wgsl.expected.msl | 34 +++ .../gen/var/tanh/c15fdb.wgsl.expected.spvasm | 69 +++++ .../gen/var/tanh/c15fdb.wgsl.expected.wgsl | 20 ++ .../gen/var/textureDimensions/002b2a.wgsl | 46 ++++ .../002b2a.wgsl.expected.glsl | 75 ++++++ .../002b2a.wgsl.expected.hlsl | 34 +++ .../002b2a.wgsl.expected.msl | 33 +++ .../002b2a.wgsl.expected.spvasm | 76 ++++++ .../002b2a.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/012b82.wgsl | 46 ++++ .../012b82.wgsl.expected.glsl | 52 ++++ .../012b82.wgsl.expected.hlsl | 34 +++ .../012b82.wgsl.expected.msl | 33 +++ .../012b82.wgsl.expected.spvasm | 78 ++++++ .../012b82.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/08753d.wgsl | 46 ++++ .../08753d.wgsl.expected.glsl | 78 ++++++ .../08753d.wgsl.expected.hlsl | 34 +++ .../08753d.wgsl.expected.msl | 33 +++ .../08753d.wgsl.expected.spvasm | 76 ++++++ .../08753d.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/0c4772.wgsl | 46 ++++ .../0c4772.wgsl.expected.glsl | 52 ++++ .../0c4772.wgsl.expected.hlsl | 34 +++ .../0c4772.wgsl.expected.msl | 33 +++ .../0c4772.wgsl.expected.spvasm | 76 ++++++ .../0c4772.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/0cce40.wgsl | 46 ++++ .../0cce40.wgsl.expected.glsl | 78 ++++++ .../0cce40.wgsl.expected.hlsl | 34 +++ .../0cce40.wgsl.expected.msl | 33 +++ .../0cce40.wgsl.expected.spvasm | 76 ++++++ .../0cce40.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/0cf2ff.wgsl | 46 ++++ .../0cf2ff.wgsl.expected.glsl | 52 ++++ .../0cf2ff.wgsl.expected.hlsl | 34 +++ .../0cf2ff.wgsl.expected.msl | 33 +++ .../0cf2ff.wgsl.expected.spvasm | 77 ++++++ .../0cf2ff.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/0d8b7e.wgsl | 46 ++++ .../0d8b7e.wgsl.expected.glsl | 52 ++++ .../0d8b7e.wgsl.expected.hlsl | 34 +++ .../0d8b7e.wgsl.expected.msl | 33 +++ .../0d8b7e.wgsl.expected.spvasm | 79 ++++++ .../0d8b7e.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/0e32ee.wgsl | 46 ++++ .../0e32ee.wgsl.expected.glsl | 52 ++++ .../0e32ee.wgsl.expected.hlsl | 34 +++ .../0e32ee.wgsl.expected.msl | 33 +++ .../0e32ee.wgsl.expected.spvasm | 77 ++++++ .../0e32ee.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/0f3c50.wgsl | 46 ++++ .../0f3c50.wgsl.expected.glsl | 52 ++++ .../0f3c50.wgsl.expected.hlsl | 34 +++ .../0f3c50.wgsl.expected.msl | 33 +++ .../0f3c50.wgsl.expected.spvasm | 78 ++++++ .../0f3c50.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/1191a5.wgsl | 46 ++++ .../1191a5.wgsl.expected.glsl | 52 ++++ .../1191a5.wgsl.expected.hlsl | 34 +++ .../1191a5.wgsl.expected.msl | 33 +++ .../1191a5.wgsl.expected.spvasm | 77 ++++++ .../1191a5.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/12c9bb.wgsl | 47 ++++ .../12c9bb.wgsl.expected.glsl | 55 ++++ .../12c9bb.wgsl.expected.hlsl | 35 +++ .../12c9bb.wgsl.expected.msl | 34 +++ .../12c9bb.wgsl.expected.spvasm | 81 ++++++ .../12c9bb.wgsl.expected.wgsl | 22 ++ .../gen/var/textureDimensions/147998.wgsl | 46 ++++ .../147998.wgsl.expected.glsl | 75 ++++++ .../147998.wgsl.expected.hlsl | 34 +++ .../147998.wgsl.expected.msl | 33 +++ .../147998.wgsl.expected.spvasm | 77 ++++++ .../147998.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/16036c.wgsl | 46 ++++ .../16036c.wgsl.expected.glsl | 52 ++++ .../16036c.wgsl.expected.hlsl | 34 +++ .../16036c.wgsl.expected.msl | 33 +++ .../16036c.wgsl.expected.spvasm | 78 ++++++ .../16036c.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/1b71f0.wgsl | 46 ++++ .../1b71f0.wgsl.expected.glsl | 52 ++++ .../1b71f0.wgsl.expected.hlsl | 34 +++ .../1b71f0.wgsl.expected.msl | 33 +++ .../1b71f0.wgsl.expected.spvasm | 76 ++++++ .../1b71f0.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/1d6c26.wgsl | 46 ++++ .../1d6c26.wgsl.expected.glsl | 52 ++++ .../1d6c26.wgsl.expected.hlsl | 34 +++ .../1d6c26.wgsl.expected.msl | 33 +++ .../1d6c26.wgsl.expected.spvasm | 78 ++++++ .../1d6c26.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/1e9e39.wgsl | 46 ++++ .../1e9e39.wgsl.expected.glsl | 78 ++++++ .../1e9e39.wgsl.expected.hlsl | 34 +++ .../1e9e39.wgsl.expected.msl | 33 +++ .../1e9e39.wgsl.expected.spvasm | 76 ++++++ .../1e9e39.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/1f20c5.wgsl | 46 ++++ .../1f20c5.wgsl.expected.glsl | 52 ++++ .../1f20c5.wgsl.expected.hlsl | 34 +++ .../1f20c5.wgsl.expected.msl | 33 +++ .../1f20c5.wgsl.expected.spvasm | 79 ++++++ .../1f20c5.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/214dd4.wgsl | 46 ++++ .../214dd4.wgsl.expected.glsl | 52 ++++ .../214dd4.wgsl.expected.hlsl | 34 +++ .../214dd4.wgsl.expected.msl | 33 +++ .../214dd4.wgsl.expected.spvasm | 76 ++++++ .../214dd4.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/221f22.wgsl | 47 ++++ .../221f22.wgsl.expected.glsl | 78 ++++++ .../221f22.wgsl.expected.hlsl | 35 +++ .../221f22.wgsl.expected.msl | 34 +++ .../221f22.wgsl.expected.spvasm | 84 ++++++ .../221f22.wgsl.expected.wgsl | 22 ++ .../gen/var/textureDimensions/267788.wgsl | 47 ++++ .../267788.wgsl.expected.glsl | 55 ++++ .../267788.wgsl.expected.hlsl | 35 +++ .../267788.wgsl.expected.msl | 34 +++ .../267788.wgsl.expected.spvasm | 84 ++++++ .../267788.wgsl.expected.wgsl | 22 ++ .../gen/var/textureDimensions/26bdfa.wgsl | 47 ++++ .../26bdfa.wgsl.expected.glsl | 55 ++++ .../26bdfa.wgsl.expected.hlsl | 35 +++ .../26bdfa.wgsl.expected.msl | 34 +++ .../26bdfa.wgsl.expected.spvasm | 81 ++++++ .../26bdfa.wgsl.expected.wgsl | 22 ++ .../gen/var/textureDimensions/26ef6c.wgsl | 46 ++++ .../26ef6c.wgsl.expected.glsl | 52 ++++ .../26ef6c.wgsl.expected.hlsl | 34 +++ .../26ef6c.wgsl.expected.msl | 33 +++ .../26ef6c.wgsl.expected.spvasm | 79 ++++++ .../26ef6c.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/2ad087.wgsl | 46 ++++ .../2ad087.wgsl.expected.glsl | 52 ++++ .../2ad087.wgsl.expected.hlsl | 34 +++ .../2ad087.wgsl.expected.msl | 33 +++ .../2ad087.wgsl.expected.spvasm | 76 ++++++ .../2ad087.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/2efa05.wgsl | 47 ++++ .../2efa05.wgsl.expected.glsl | 55 ++++ .../2efa05.wgsl.expected.hlsl | 35 +++ .../2efa05.wgsl.expected.msl | 34 +++ .../2efa05.wgsl.expected.spvasm | 82 ++++++ .../2efa05.wgsl.expected.wgsl | 22 ++ .../gen/var/textureDimensions/2f289f.wgsl | 46 ++++ .../2f289f.wgsl.expected.glsl | 52 ++++ .../2f289f.wgsl.expected.hlsl | 34 +++ .../2f289f.wgsl.expected.msl | 33 +++ .../2f289f.wgsl.expected.spvasm | 76 ++++++ .../2f289f.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/2fe1cc.wgsl | 47 ++++ .../2fe1cc.wgsl.expected.glsl | 55 ++++ .../2fe1cc.wgsl.expected.hlsl | 35 +++ .../2fe1cc.wgsl.expected.msl | 34 +++ .../2fe1cc.wgsl.expected.spvasm | 81 ++++++ .../2fe1cc.wgsl.expected.wgsl | 22 ++ .../gen/var/textureDimensions/318ecc.wgsl | 46 ++++ .../318ecc.wgsl.expected.glsl | 78 ++++++ .../318ecc.wgsl.expected.hlsl | 34 +++ .../318ecc.wgsl.expected.msl | 33 +++ .../318ecc.wgsl.expected.spvasm | 77 ++++++ .../318ecc.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/340d06.wgsl | 46 ++++ .../340d06.wgsl.expected.glsl | 52 ++++ .../340d06.wgsl.expected.hlsl | 34 +++ .../340d06.wgsl.expected.msl | 33 +++ .../340d06.wgsl.expected.spvasm | 77 ++++++ .../340d06.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/398e30.wgsl | 46 ++++ .../398e30.wgsl.expected.glsl | 52 ++++ .../398e30.wgsl.expected.hlsl | 34 +++ .../398e30.wgsl.expected.msl | 33 +++ .../398e30.wgsl.expected.spvasm | 79 ++++++ .../398e30.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/3a94ea.wgsl | 46 ++++ .../3a94ea.wgsl.expected.glsl | 75 ++++++ .../3a94ea.wgsl.expected.hlsl | 34 +++ .../3a94ea.wgsl.expected.msl | 33 +++ .../3a94ea.wgsl.expected.spvasm | 78 ++++++ .../3a94ea.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/3aca08.wgsl | 46 ++++ .../3aca08.wgsl.expected.glsl | 78 ++++++ .../3aca08.wgsl.expected.hlsl | 34 +++ .../3aca08.wgsl.expected.msl | 33 +++ .../3aca08.wgsl.expected.spvasm | 76 ++++++ .../3aca08.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/3c5ad8.wgsl | 46 ++++ .../3c5ad8.wgsl.expected.glsl | 52 ++++ .../3c5ad8.wgsl.expected.hlsl | 34 +++ .../3c5ad8.wgsl.expected.msl | 33 +++ .../3c5ad8.wgsl.expected.spvasm | 76 ++++++ .../3c5ad8.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/4152a6.wgsl | 46 ++++ .../4152a6.wgsl.expected.glsl | 75 ++++++ .../4152a6.wgsl.expected.hlsl | 34 +++ .../4152a6.wgsl.expected.msl | 33 +++ .../4152a6.wgsl.expected.spvasm | 80 ++++++ .../4152a6.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/423f99.wgsl | 46 ++++ .../423f99.wgsl.expected.glsl | 75 ++++++ .../423f99.wgsl.expected.hlsl | 34 +++ .../423f99.wgsl.expected.msl | 33 +++ .../423f99.wgsl.expected.spvasm | 76 ++++++ .../423f99.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/4267ee.wgsl | 46 ++++ .../4267ee.wgsl.expected.glsl | 52 ++++ .../4267ee.wgsl.expected.hlsl | 34 +++ .../4267ee.wgsl.expected.msl | 33 +++ .../4267ee.wgsl.expected.spvasm | 76 ++++++ .../4267ee.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/42d4e6.wgsl | 46 ++++ .../42d4e6.wgsl.expected.glsl | 78 ++++++ .../42d4e6.wgsl.expected.hlsl | 34 +++ .../42d4e6.wgsl.expected.msl | 33 +++ .../42d4e6.wgsl.expected.spvasm | 76 ++++++ .../42d4e6.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/48cb89.wgsl | 46 ++++ .../48cb89.wgsl.expected.glsl | 52 ++++ .../48cb89.wgsl.expected.hlsl | 34 +++ .../48cb89.wgsl.expected.msl | 33 +++ .../48cb89.wgsl.expected.spvasm | 76 ++++++ .../48cb89.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/49d274.wgsl | 46 ++++ .../49d274.wgsl.expected.glsl | 75 ++++++ .../49d274.wgsl.expected.hlsl | 34 +++ .../49d274.wgsl.expected.msl | 33 +++ .../49d274.wgsl.expected.spvasm | 79 ++++++ .../49d274.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/4df9a8.wgsl | 46 ++++ .../4df9a8.wgsl.expected.glsl | 75 ++++++ .../4df9a8.wgsl.expected.hlsl | 34 +++ .../4df9a8.wgsl.expected.msl | 33 +++ .../4df9a8.wgsl.expected.spvasm | 78 ++++++ .../4df9a8.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/50a9ee.wgsl | 47 ++++ .../50a9ee.wgsl.expected.glsl | 78 ++++++ .../50a9ee.wgsl.expected.hlsl | 35 +++ .../50a9ee.wgsl.expected.msl | 34 +++ .../50a9ee.wgsl.expected.spvasm | 84 ++++++ .../50a9ee.wgsl.expected.wgsl | 22 ++ .../gen/var/textureDimensions/52045c.wgsl | 47 ++++ .../52045c.wgsl.expected.glsl | 78 ++++++ .../52045c.wgsl.expected.hlsl | 35 +++ .../52045c.wgsl.expected.msl | 34 +++ .../52045c.wgsl.expected.spvasm | 79 ++++++ .../52045c.wgsl.expected.wgsl | 22 ++ .../gen/var/textureDimensions/55b23e.wgsl | 46 ++++ .../55b23e.wgsl.expected.glsl | 75 ++++++ .../55b23e.wgsl.expected.hlsl | 34 +++ .../55b23e.wgsl.expected.msl | 33 +++ .../55b23e.wgsl.expected.spvasm | 77 ++++++ .../55b23e.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/579629.wgsl | 46 ++++ .../579629.wgsl.expected.glsl | 52 ++++ .../579629.wgsl.expected.hlsl | 34 +++ .../579629.wgsl.expected.msl | 33 +++ .../579629.wgsl.expected.spvasm | 76 ++++++ .../579629.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/57da0b.wgsl | 46 ++++ .../57da0b.wgsl.expected.glsl | 78 ++++++ .../57da0b.wgsl.expected.hlsl | 34 +++ .../57da0b.wgsl.expected.msl | 33 +++ .../57da0b.wgsl.expected.spvasm | 77 ++++++ .../57da0b.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/57e28f.wgsl | 46 ++++ .../57e28f.wgsl.expected.glsl | 52 ++++ .../57e28f.wgsl.expected.hlsl | 34 +++ .../57e28f.wgsl.expected.msl | 33 +++ .../57e28f.wgsl.expected.spvasm | 76 ++++++ .../57e28f.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/58a515.wgsl | 46 ++++ .../58a515.wgsl.expected.glsl | 52 ++++ .../58a515.wgsl.expected.hlsl | 34 +++ .../58a515.wgsl.expected.msl | 33 +++ .../58a515.wgsl.expected.spvasm | 78 ++++++ .../58a515.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/5985f3.wgsl | 46 ++++ .../5985f3.wgsl.expected.glsl | 52 ++++ .../5985f3.wgsl.expected.hlsl | 34 +++ .../5985f3.wgsl.expected.msl | 33 +++ .../5985f3.wgsl.expected.spvasm | 78 ++++++ .../5985f3.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/5caa5e.wgsl | 46 ++++ .../5caa5e.wgsl.expected.glsl | 78 ++++++ .../5caa5e.wgsl.expected.hlsl | 34 +++ .../5caa5e.wgsl.expected.msl | 33 +++ .../5caa5e.wgsl.expected.spvasm | 77 ++++++ .../5caa5e.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/5e295d.wgsl | 46 ++++ .../5e295d.wgsl.expected.glsl | 52 ++++ .../5e295d.wgsl.expected.hlsl | 34 +++ .../5e295d.wgsl.expected.msl | 33 +++ .../5e295d.wgsl.expected.spvasm | 79 ++++++ .../5e295d.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/60bf54.wgsl | 46 ++++ .../60bf54.wgsl.expected.glsl | 75 ++++++ .../60bf54.wgsl.expected.hlsl | 34 +++ .../60bf54.wgsl.expected.msl | 33 +++ .../60bf54.wgsl.expected.spvasm | 77 ++++++ .../60bf54.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/63f3cf.wgsl | 46 ++++ .../63f3cf.wgsl.expected.glsl | 75 ++++++ .../63f3cf.wgsl.expected.hlsl | 34 +++ .../63f3cf.wgsl.expected.msl | 33 +++ .../63f3cf.wgsl.expected.spvasm | 77 ++++++ .../63f3cf.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/68105c.wgsl | 46 ++++ .../68105c.wgsl.expected.glsl | 52 ++++ .../68105c.wgsl.expected.hlsl | 34 +++ .../68105c.wgsl.expected.msl | 33 +++ .../68105c.wgsl.expected.spvasm | 77 ++++++ .../68105c.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/686ef2.wgsl | 47 ++++ .../686ef2.wgsl.expected.glsl | 55 ++++ .../686ef2.wgsl.expected.hlsl | 35 +++ .../686ef2.wgsl.expected.msl | 34 +++ .../686ef2.wgsl.expected.spvasm | 81 ++++++ .../686ef2.wgsl.expected.wgsl | 22 ++ .../gen/var/textureDimensions/6adac6.wgsl | 46 ++++ .../6adac6.wgsl.expected.glsl | 78 ++++++ .../6adac6.wgsl.expected.hlsl | 34 +++ .../6adac6.wgsl.expected.msl | 33 +++ .../6adac6.wgsl.expected.spvasm | 76 ++++++ .../6adac6.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/6ec1b4.wgsl | 46 ++++ .../6ec1b4.wgsl.expected.glsl | 52 ++++ .../6ec1b4.wgsl.expected.hlsl | 34 +++ .../6ec1b4.wgsl.expected.msl | 33 +++ .../6ec1b4.wgsl.expected.spvasm | 77 ++++++ .../6ec1b4.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/6f0d79.wgsl | 46 ++++ .../6f0d79.wgsl.expected.glsl | 52 ++++ .../6f0d79.wgsl.expected.hlsl | 34 +++ .../6f0d79.wgsl.expected.msl | 33 +++ .../6f0d79.wgsl.expected.spvasm | 78 ++++++ .../6f0d79.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/702c53.wgsl | 46 ++++ .../702c53.wgsl.expected.glsl | 52 ++++ .../702c53.wgsl.expected.hlsl | 34 +++ .../702c53.wgsl.expected.msl | 33 +++ .../702c53.wgsl.expected.spvasm | 76 ++++++ .../702c53.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/72e5d6.wgsl | 47 ++++ .../72e5d6.wgsl.expected.glsl | 55 ++++ .../72e5d6.wgsl.expected.hlsl | 35 +++ .../72e5d6.wgsl.expected.msl | 34 +++ .../72e5d6.wgsl.expected.spvasm | 83 ++++++ .../72e5d6.wgsl.expected.wgsl | 22 ++ .../gen/var/textureDimensions/79df87.wgsl | 47 ++++ .../79df87.wgsl.expected.glsl | 78 ++++++ .../79df87.wgsl.expected.hlsl | 35 +++ .../79df87.wgsl.expected.msl | 34 +++ .../79df87.wgsl.expected.spvasm | 80 ++++++ .../79df87.wgsl.expected.wgsl | 22 ++ .../gen/var/textureDimensions/7bf826.wgsl | 46 ++++ .../7bf826.wgsl.expected.glsl | 52 ++++ .../7bf826.wgsl.expected.hlsl | 34 +++ .../7bf826.wgsl.expected.msl | 33 +++ .../7bf826.wgsl.expected.spvasm | 78 ++++++ .../7bf826.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/7f5c2e.wgsl | 46 ++++ .../7f5c2e.wgsl.expected.glsl | 75 ++++++ .../7f5c2e.wgsl.expected.hlsl | 34 +++ .../7f5c2e.wgsl.expected.msl | 33 +++ .../7f5c2e.wgsl.expected.spvasm | 77 ++++++ .../7f5c2e.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/8028f3.wgsl | 46 ++++ .../8028f3.wgsl.expected.glsl | 52 ++++ .../8028f3.wgsl.expected.hlsl | 34 +++ .../8028f3.wgsl.expected.msl | 33 +++ .../8028f3.wgsl.expected.spvasm | 76 ++++++ .../8028f3.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/811679.wgsl | 46 ++++ .../811679.wgsl.expected.glsl | 52 ++++ .../811679.wgsl.expected.hlsl | 34 +++ .../811679.wgsl.expected.msl | 33 +++ .../811679.wgsl.expected.spvasm | 77 ++++++ .../811679.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/820596.wgsl | 46 ++++ .../820596.wgsl.expected.glsl | 75 ++++++ .../820596.wgsl.expected.hlsl | 34 +++ .../820596.wgsl.expected.msl | 33 +++ .../820596.wgsl.expected.spvasm | 78 ++++++ .../820596.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/83ee5a.wgsl | 46 ++++ .../83ee5a.wgsl.expected.glsl | 52 ++++ .../83ee5a.wgsl.expected.hlsl | 34 +++ .../83ee5a.wgsl.expected.msl | 33 +++ .../83ee5a.wgsl.expected.spvasm | 76 ++++++ .../83ee5a.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/85d556.wgsl | 47 ++++ .../85d556.wgsl.expected.glsl | 55 ++++ .../85d556.wgsl.expected.hlsl | 35 +++ .../85d556.wgsl.expected.msl | 34 +++ .../85d556.wgsl.expected.spvasm | 83 ++++++ .../85d556.wgsl.expected.wgsl | 22 ++ .../gen/var/textureDimensions/88ad17.wgsl | 47 ++++ .../88ad17.wgsl.expected.glsl | 55 ++++ .../88ad17.wgsl.expected.hlsl | 35 +++ .../88ad17.wgsl.expected.msl | 34 +++ .../88ad17.wgsl.expected.spvasm | 82 ++++++ .../88ad17.wgsl.expected.wgsl | 22 ++ .../gen/var/textureDimensions/8aa4c4.wgsl | 46 ++++ .../8aa4c4.wgsl.expected.glsl | 52 ++++ .../8aa4c4.wgsl.expected.hlsl | 34 +++ .../8aa4c4.wgsl.expected.msl | 33 +++ .../8aa4c4.wgsl.expected.spvasm | 76 ++++++ .../8aa4c4.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/8deb5e.wgsl | 46 ++++ .../8deb5e.wgsl.expected.glsl | 52 ++++ .../8deb5e.wgsl.expected.hlsl | 34 +++ .../8deb5e.wgsl.expected.msl | 33 +++ .../8deb5e.wgsl.expected.spvasm | 76 ++++++ .../8deb5e.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/8f20bf.wgsl | 46 ++++ .../8f20bf.wgsl.expected.glsl | 75 ++++++ .../8f20bf.wgsl.expected.hlsl | 34 +++ .../8f20bf.wgsl.expected.msl | 33 +++ .../8f20bf.wgsl.expected.spvasm | 79 ++++++ .../8f20bf.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/8fca0f.wgsl | 46 ++++ .../8fca0f.wgsl.expected.glsl | 52 ++++ .../8fca0f.wgsl.expected.hlsl | 34 +++ .../8fca0f.wgsl.expected.msl | 33 +++ .../8fca0f.wgsl.expected.spvasm | 76 ++++++ .../8fca0f.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/90340b.wgsl | 46 ++++ .../90340b.wgsl.expected.glsl | 75 ++++++ .../90340b.wgsl.expected.hlsl | 34 +++ .../90340b.wgsl.expected.msl | 33 +++ .../90340b.wgsl.expected.spvasm | 79 ++++++ .../90340b.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/9042ab.wgsl | 46 ++++ .../9042ab.wgsl.expected.glsl | 75 ++++++ .../9042ab.wgsl.expected.hlsl | 34 +++ .../9042ab.wgsl.expected.msl | 33 +++ .../9042ab.wgsl.expected.spvasm | 80 ++++++ .../9042ab.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/9393b0.wgsl | 47 ++++ .../9393b0.wgsl.expected.glsl | 55 ++++ .../9393b0.wgsl.expected.hlsl | 35 +++ .../9393b0.wgsl.expected.msl | 34 +++ .../9393b0.wgsl.expected.spvasm | 81 ++++++ .../9393b0.wgsl.expected.wgsl | 22 ++ .../gen/var/textureDimensions/939fdb.wgsl | 46 ++++ .../939fdb.wgsl.expected.glsl | 52 ++++ .../939fdb.wgsl.expected.hlsl | 34 +++ .../939fdb.wgsl.expected.msl | 33 +++ .../939fdb.wgsl.expected.spvasm | 76 ++++++ .../939fdb.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/962dcd.wgsl | 46 ++++ .../962dcd.wgsl.expected.glsl | 52 ++++ .../962dcd.wgsl.expected.hlsl | 34 +++ .../962dcd.wgsl.expected.msl | 33 +++ .../962dcd.wgsl.expected.spvasm | 76 ++++++ .../962dcd.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/9abfe5.wgsl | 46 ++++ .../9abfe5.wgsl.expected.glsl | 52 ++++ .../9abfe5.wgsl.expected.hlsl | 34 +++ .../9abfe5.wgsl.expected.msl | 33 +++ .../9abfe5.wgsl.expected.spvasm | 78 ++++++ .../9abfe5.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/9c9c57.wgsl | 47 ++++ .../9c9c57.wgsl.expected.glsl | 55 ++++ .../9c9c57.wgsl.expected.hlsl | 35 +++ .../9c9c57.wgsl.expected.msl | 34 +++ .../9c9c57.wgsl.expected.spvasm | 83 ++++++ .../9c9c57.wgsl.expected.wgsl | 22 ++ .../gen/var/textureDimensions/9da9e2.wgsl | 46 ++++ .../9da9e2.wgsl.expected.glsl | 78 ++++++ .../9da9e2.wgsl.expected.hlsl | 34 +++ .../9da9e2.wgsl.expected.msl | 33 +++ .../9da9e2.wgsl.expected.spvasm | 76 ++++++ .../9da9e2.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/9eb8d8.wgsl | 46 ++++ .../9eb8d8.wgsl.expected.glsl | 52 ++++ .../9eb8d8.wgsl.expected.hlsl | 34 +++ .../9eb8d8.wgsl.expected.msl | 33 +++ .../9eb8d8.wgsl.expected.spvasm | 77 ++++++ .../9eb8d8.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/9f8e46.wgsl | 46 ++++ .../9f8e46.wgsl.expected.glsl | 52 ++++ .../9f8e46.wgsl.expected.hlsl | 34 +++ .../9f8e46.wgsl.expected.msl | 33 +++ .../9f8e46.wgsl.expected.spvasm | 76 ++++++ .../9f8e46.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/a01845.wgsl | 47 ++++ .../a01845.wgsl.expected.glsl | 78 ++++++ .../a01845.wgsl.expected.hlsl | 35 +++ .../a01845.wgsl.expected.msl | 34 +++ .../a01845.wgsl.expected.spvasm | 84 ++++++ .../a01845.wgsl.expected.wgsl | 22 ++ .../gen/var/textureDimensions/a7d565.wgsl | 46 ++++ .../a7d565.wgsl.expected.glsl | 75 ++++++ .../a7d565.wgsl.expected.hlsl | 34 +++ .../a7d565.wgsl.expected.msl | 33 +++ .../a7d565.wgsl.expected.spvasm | 77 ++++++ .../a7d565.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/a863f2.wgsl | 46 ++++ .../a863f2.wgsl.expected.glsl | 78 ++++++ .../a863f2.wgsl.expected.hlsl | 34 +++ .../a863f2.wgsl.expected.msl | 33 +++ .../a863f2.wgsl.expected.spvasm | 76 ++++++ .../a863f2.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/a9c9c1.wgsl | 47 ++++ .../a9c9c1.wgsl.expected.glsl | 55 ++++ .../a9c9c1.wgsl.expected.hlsl | 35 +++ .../a9c9c1.wgsl.expected.msl | 34 +++ .../a9c9c1.wgsl.expected.spvasm | 81 ++++++ .../a9c9c1.wgsl.expected.wgsl | 22 ++ .../gen/var/textureDimensions/b0e16d.wgsl | 47 ++++ .../b0e16d.wgsl.expected.glsl | 55 ++++ .../b0e16d.wgsl.expected.hlsl | 35 +++ .../b0e16d.wgsl.expected.msl | 34 +++ .../b0e16d.wgsl.expected.spvasm | 81 ++++++ .../b0e16d.wgsl.expected.wgsl | 22 ++ .../gen/var/textureDimensions/b3c954.wgsl | 46 ++++ .../b3c954.wgsl.expected.glsl | 52 ++++ .../b3c954.wgsl.expected.hlsl | 34 +++ .../b3c954.wgsl.expected.msl | 33 +++ .../b3c954.wgsl.expected.spvasm | 77 ++++++ .../b3c954.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/b3e407.wgsl | 47 ++++ .../b3e407.wgsl.expected.glsl | 78 ++++++ .../b3e407.wgsl.expected.hlsl | 35 +++ .../b3e407.wgsl.expected.msl | 34 +++ .../b3e407.wgsl.expected.spvasm | 79 ++++++ .../b3e407.wgsl.expected.wgsl | 22 ++ .../gen/var/textureDimensions/b91240.wgsl | 46 ++++ .../b91240.wgsl.expected.glsl | 52 ++++ .../b91240.wgsl.expected.hlsl | 34 +++ .../b91240.wgsl.expected.msl | 33 +++ .../b91240.wgsl.expected.spvasm | 76 ++++++ .../b91240.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/ba1481.wgsl | 46 ++++ .../ba1481.wgsl.expected.glsl | 133 ++++++++++ .../ba1481.wgsl.expected.hlsl | 38 +++ .../ba1481.wgsl.expected.msl | 52 ++++ .../ba1481.wgsl.expected.spvasm | 125 +++++++++ .../ba1481.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/bb3dde.wgsl | 46 ++++ .../bb3dde.wgsl.expected.glsl | 52 ++++ .../bb3dde.wgsl.expected.hlsl | 34 +++ .../bb3dde.wgsl.expected.msl | 33 +++ .../bb3dde.wgsl.expected.spvasm | 76 ++++++ .../bb3dde.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/c30e75.wgsl | 46 ++++ .../c30e75.wgsl.expected.glsl | 52 ++++ .../c30e75.wgsl.expected.hlsl | 34 +++ .../c30e75.wgsl.expected.msl | 33 +++ .../c30e75.wgsl.expected.spvasm | 76 ++++++ .../c30e75.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/c7943d.wgsl | 46 ++++ .../c7943d.wgsl.expected.glsl | 52 ++++ .../c7943d.wgsl.expected.hlsl | 34 +++ .../c7943d.wgsl.expected.msl | 33 +++ .../c7943d.wgsl.expected.spvasm | 77 ++++++ .../c7943d.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/cc968c.wgsl | 46 ++++ .../cc968c.wgsl.expected.glsl | 75 ++++++ .../cc968c.wgsl.expected.hlsl | 34 +++ .../cc968c.wgsl.expected.msl | 33 +++ .../cc968c.wgsl.expected.spvasm | 77 ++++++ .../cc968c.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/cccc8f.wgsl | 46 ++++ .../cccc8f.wgsl.expected.glsl | 78 ++++++ .../cccc8f.wgsl.expected.hlsl | 34 +++ .../cccc8f.wgsl.expected.msl | 33 +++ .../cccc8f.wgsl.expected.spvasm | 76 ++++++ .../cccc8f.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/cd76a7.wgsl | 46 ++++ .../cd76a7.wgsl.expected.glsl | 52 ++++ .../cd76a7.wgsl.expected.hlsl | 34 +++ .../cd76a7.wgsl.expected.msl | 33 +++ .../cd76a7.wgsl.expected.spvasm | 76 ++++++ .../cd76a7.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/cdf473.wgsl | 46 ++++ .../cdf473.wgsl.expected.glsl | 52 ++++ .../cdf473.wgsl.expected.hlsl | 34 +++ .../cdf473.wgsl.expected.msl | 33 +++ .../cdf473.wgsl.expected.spvasm | 78 ++++++ .../cdf473.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/cec841.wgsl | 46 ++++ .../cec841.wgsl.expected.glsl | 52 ++++ .../cec841.wgsl.expected.hlsl | 34 +++ .../cec841.wgsl.expected.msl | 33 +++ .../cec841.wgsl.expected.spvasm | 78 ++++++ .../cec841.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/cf7e43.wgsl | 46 ++++ .../cf7e43.wgsl.expected.glsl | 52 ++++ .../cf7e43.wgsl.expected.hlsl | 34 +++ .../cf7e43.wgsl.expected.msl | 33 +++ .../cf7e43.wgsl.expected.spvasm | 76 ++++++ .../cf7e43.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/d125bc.wgsl | 46 ++++ .../d125bc.wgsl.expected.glsl | 52 ++++ .../d125bc.wgsl.expected.hlsl | 34 +++ .../d125bc.wgsl.expected.msl | 33 +++ .../d125bc.wgsl.expected.spvasm | 76 ++++++ .../d125bc.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/d83c45.wgsl | 47 ++++ .../d83c45.wgsl.expected.glsl | 78 ++++++ .../d83c45.wgsl.expected.hlsl | 35 +++ .../d83c45.wgsl.expected.msl | 34 +++ .../d83c45.wgsl.expected.spvasm | 85 ++++++ .../d83c45.wgsl.expected.wgsl | 22 ++ .../gen/var/textureDimensions/daf7c0.wgsl | 46 ++++ .../daf7c0.wgsl.expected.glsl | 52 ++++ .../daf7c0.wgsl.expected.hlsl | 34 +++ .../daf7c0.wgsl.expected.msl | 33 +++ .../daf7c0.wgsl.expected.spvasm | 75 ++++++ .../daf7c0.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/dc2dd0.wgsl | 46 ++++ .../dc2dd0.wgsl.expected.glsl | 78 ++++++ .../dc2dd0.wgsl.expected.hlsl | 34 +++ .../dc2dd0.wgsl.expected.msl | 33 +++ .../dc2dd0.wgsl.expected.spvasm | 77 ++++++ .../dc2dd0.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/e927be.wgsl | 46 ++++ .../e927be.wgsl.expected.glsl | 75 ++++++ .../e927be.wgsl.expected.hlsl | 34 +++ .../e927be.wgsl.expected.msl | 33 +++ .../e927be.wgsl.expected.spvasm | 79 ++++++ .../e927be.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/e9e96c.wgsl | 46 ++++ .../e9e96c.wgsl.expected.glsl | 52 ++++ .../e9e96c.wgsl.expected.hlsl | 34 +++ .../e9e96c.wgsl.expected.msl | 33 +++ .../e9e96c.wgsl.expected.spvasm | 78 ++++++ .../e9e96c.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/ef5b89.wgsl | 46 ++++ .../ef5b89.wgsl.expected.glsl | 52 ++++ .../ef5b89.wgsl.expected.hlsl | 34 +++ .../ef5b89.wgsl.expected.msl | 33 +++ .../ef5b89.wgsl.expected.spvasm | 75 ++++++ .../ef5b89.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/efc8a4.wgsl | 47 ++++ .../efc8a4.wgsl.expected.glsl | 55 ++++ .../efc8a4.wgsl.expected.hlsl | 35 +++ .../efc8a4.wgsl.expected.msl | 34 +++ .../efc8a4.wgsl.expected.spvasm | 81 ++++++ .../efc8a4.wgsl.expected.wgsl | 22 ++ .../gen/var/textureDimensions/f60bdb.wgsl | 46 ++++ .../f60bdb.wgsl.expected.glsl | 52 ++++ .../f60bdb.wgsl.expected.hlsl | 34 +++ .../f60bdb.wgsl.expected.msl | 33 +++ .../f60bdb.wgsl.expected.spvasm | 75 ++++++ .../f60bdb.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/f7145b.wgsl | 47 ++++ .../f7145b.wgsl.expected.glsl | 55 ++++ .../f7145b.wgsl.expected.hlsl | 35 +++ .../f7145b.wgsl.expected.msl | 34 +++ .../f7145b.wgsl.expected.spvasm | 82 ++++++ .../f7145b.wgsl.expected.wgsl | 22 ++ .../gen/var/textureDimensions/f931c7.wgsl | 46 ++++ .../f931c7.wgsl.expected.glsl | 52 ++++ .../f931c7.wgsl.expected.hlsl | 34 +++ .../f931c7.wgsl.expected.msl | 33 +++ .../f931c7.wgsl.expected.spvasm | 76 ++++++ .../f931c7.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/fa9859.wgsl | 46 ++++ .../fa9859.wgsl.expected.glsl | 52 ++++ .../fa9859.wgsl.expected.hlsl | 34 +++ .../fa9859.wgsl.expected.msl | 33 +++ .../fa9859.wgsl.expected.spvasm | 76 ++++++ .../fa9859.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/fb5670.wgsl | 46 ++++ .../fb5670.wgsl.expected.glsl | 75 ++++++ .../fb5670.wgsl.expected.hlsl | 34 +++ .../fb5670.wgsl.expected.msl | 33 +++ .../fb5670.wgsl.expected.spvasm | 79 ++++++ .../fb5670.wgsl.expected.wgsl | 21 ++ .../gen/var/textureDimensions/fcac78.wgsl | 46 ++++ .../fcac78.wgsl.expected.glsl | 52 ++++ .../fcac78.wgsl.expected.hlsl | 34 +++ .../fcac78.wgsl.expected.msl | 33 +++ .../fcac78.wgsl.expected.spvasm | 77 ++++++ .../fcac78.wgsl.expected.wgsl | 21 ++ .../gen/var/textureGather/10c554.wgsl | 48 ++++ .../textureGather/10c554.wgsl.expected.glsl | 58 +++++ .../textureGather/10c554.wgsl.expected.hlsl | 34 +++ .../textureGather/10c554.wgsl.expected.msl | 34 +++ .../textureGather/10c554.wgsl.expected.spvasm | 89 +++++++ .../textureGather/10c554.wgsl.expected.wgsl | 24 ++ .../gen/var/textureGather/1f7f6b.wgsl | 48 ++++ .../textureGather/1f7f6b.wgsl.expected.glsl | 58 +++++ .../textureGather/1f7f6b.wgsl.expected.hlsl | 34 +++ .../textureGather/1f7f6b.wgsl.expected.msl | 34 +++ .../textureGather/1f7f6b.wgsl.expected.spvasm | 91 +++++++ .../textureGather/1f7f6b.wgsl.expected.wgsl | 24 ++ .../gen/var/textureGather/22e930.wgsl | 49 ++++ .../textureGather/22e930.wgsl.expected.glsl | 61 +++++ .../textureGather/22e930.wgsl.expected.hlsl | 35 +++ .../textureGather/22e930.wgsl.expected.msl | 35 +++ .../textureGather/22e930.wgsl.expected.spvasm | 100 +++++++ .../textureGather/22e930.wgsl.expected.wgsl | 25 ++ .../gen/var/textureGather/2cc066.wgsl | 49 ++++ .../textureGather/2cc066.wgsl.expected.glsl | 61 +++++ .../textureGather/2cc066.wgsl.expected.hlsl | 35 +++ .../textureGather/2cc066.wgsl.expected.msl | 35 +++ .../textureGather/2cc066.wgsl.expected.spvasm | 103 ++++++++ .../textureGather/2cc066.wgsl.expected.wgsl | 25 ++ .../gen/var/textureGather/2e0ed5.wgsl | 48 ++++ .../textureGather/2e0ed5.wgsl.expected.glsl | 58 +++++ .../textureGather/2e0ed5.wgsl.expected.hlsl | 34 +++ .../textureGather/2e0ed5.wgsl.expected.msl | 34 +++ .../textureGather/2e0ed5.wgsl.expected.spvasm | 89 +++++++ .../textureGather/2e0ed5.wgsl.expected.wgsl | 24 ++ .../gen/var/textureGather/32c4e8.wgsl | 48 ++++ .../textureGather/32c4e8.wgsl.expected.glsl | 58 +++++ .../textureGather/32c4e8.wgsl.expected.hlsl | 34 +++ .../textureGather/32c4e8.wgsl.expected.msl | 34 +++ .../textureGather/32c4e8.wgsl.expected.spvasm | 89 +++++++ .../textureGather/32c4e8.wgsl.expected.wgsl | 24 ++ .../gen/var/textureGather/3b32cc.wgsl | 48 ++++ .../textureGather/3b32cc.wgsl.expected.glsl | 58 +++++ .../textureGather/3b32cc.wgsl.expected.hlsl | 34 +++ .../textureGather/3b32cc.wgsl.expected.msl | 34 +++ .../textureGather/3b32cc.wgsl.expected.spvasm | 92 +++++++ .../textureGather/3b32cc.wgsl.expected.wgsl | 24 ++ .../gen/var/textureGather/43025d.wgsl | 49 ++++ .../textureGather/43025d.wgsl.expected.glsl | 84 ++++++ .../textureGather/43025d.wgsl.expected.hlsl | 35 +++ .../textureGather/43025d.wgsl.expected.msl | 35 +++ .../textureGather/43025d.wgsl.expected.spvasm | 102 ++++++++ .../textureGather/43025d.wgsl.expected.wgsl | 25 ++ .../gen/var/textureGather/49b07f.wgsl | 48 ++++ .../textureGather/49b07f.wgsl.expected.glsl | 58 +++++ .../textureGather/49b07f.wgsl.expected.hlsl | 34 +++ .../textureGather/49b07f.wgsl.expected.msl | 34 +++ .../textureGather/49b07f.wgsl.expected.spvasm | 94 +++++++ .../textureGather/49b07f.wgsl.expected.wgsl | 24 ++ .../gen/var/textureGather/4b8103.wgsl | 49 ++++ .../textureGather/4b8103.wgsl.expected.glsl | 61 +++++ .../textureGather/4b8103.wgsl.expected.hlsl | 35 +++ .../textureGather/4b8103.wgsl.expected.msl | 35 +++ .../textureGather/4b8103.wgsl.expected.spvasm | 102 ++++++++ .../textureGather/4b8103.wgsl.expected.wgsl | 25 ++ .../gen/var/textureGather/5266da.wgsl | 48 ++++ .../textureGather/5266da.wgsl.expected.glsl | 58 +++++ .../textureGather/5266da.wgsl.expected.hlsl | 34 +++ .../textureGather/5266da.wgsl.expected.msl | 34 +++ .../textureGather/5266da.wgsl.expected.spvasm | 89 +++++++ .../textureGather/5266da.wgsl.expected.wgsl | 24 ++ .../gen/var/textureGather/5ba85f.wgsl | 48 ++++ .../textureGather/5ba85f.wgsl.expected.glsl | 58 +++++ .../textureGather/5ba85f.wgsl.expected.hlsl | 34 +++ .../textureGather/5ba85f.wgsl.expected.msl | 34 +++ .../textureGather/5ba85f.wgsl.expected.spvasm | 91 +++++++ .../textureGather/5ba85f.wgsl.expected.wgsl | 24 ++ .../gen/var/textureGather/5bd491.wgsl | 48 ++++ .../textureGather/5bd491.wgsl.expected.glsl | 58 +++++ .../textureGather/5bd491.wgsl.expected.hlsl | 34 +++ .../textureGather/5bd491.wgsl.expected.msl | 34 +++ .../textureGather/5bd491.wgsl.expected.spvasm | 92 +++++++ .../textureGather/5bd491.wgsl.expected.wgsl | 24 ++ .../gen/var/textureGather/751f8a.wgsl | 49 ++++ .../textureGather/751f8a.wgsl.expected.glsl | 84 ++++++ .../textureGather/751f8a.wgsl.expected.hlsl | 35 +++ .../textureGather/751f8a.wgsl.expected.msl | 35 +++ .../textureGather/751f8a.wgsl.expected.spvasm | 101 ++++++++ .../textureGather/751f8a.wgsl.expected.wgsl | 25 ++ .../gen/var/textureGather/7c3828.wgsl | 48 ++++ .../textureGather/7c3828.wgsl.expected.glsl | 58 +++++ .../textureGather/7c3828.wgsl.expected.hlsl | 34 +++ .../textureGather/7c3828.wgsl.expected.msl | 34 +++ .../textureGather/7c3828.wgsl.expected.spvasm | 93 +++++++ .../textureGather/7c3828.wgsl.expected.wgsl | 24 ++ .../gen/var/textureGather/8b754c.wgsl | 49 ++++ .../textureGather/8b754c.wgsl.expected.glsl | 61 +++++ .../textureGather/8b754c.wgsl.expected.hlsl | 35 +++ .../textureGather/8b754c.wgsl.expected.msl | 35 +++ .../textureGather/8b754c.wgsl.expected.spvasm | 102 ++++++++ .../textureGather/8b754c.wgsl.expected.wgsl | 25 ++ .../gen/var/textureGather/9a6358.wgsl | 49 ++++ .../textureGather/9a6358.wgsl.expected.glsl | 61 +++++ .../textureGather/9a6358.wgsl.expected.hlsl | 35 +++ .../textureGather/9a6358.wgsl.expected.msl | 35 +++ .../textureGather/9a6358.wgsl.expected.spvasm | 101 ++++++++ .../textureGather/9a6358.wgsl.expected.wgsl | 25 ++ .../gen/var/textureGather/af55b3.wgsl | 48 ++++ .../textureGather/af55b3.wgsl.expected.glsl | 58 +++++ .../textureGather/af55b3.wgsl.expected.hlsl | 34 +++ .../textureGather/af55b3.wgsl.expected.msl | 34 +++ .../textureGather/af55b3.wgsl.expected.spvasm | 91 +++++++ .../textureGather/af55b3.wgsl.expected.wgsl | 24 ++ .../gen/var/textureGather/bb3ac5.wgsl | 48 ++++ .../textureGather/bb3ac5.wgsl.expected.glsl | 58 +++++ .../textureGather/bb3ac5.wgsl.expected.hlsl | 34 +++ .../textureGather/bb3ac5.wgsl.expected.msl | 34 +++ .../textureGather/bb3ac5.wgsl.expected.spvasm | 91 +++++++ .../textureGather/bb3ac5.wgsl.expected.wgsl | 24 ++ .../gen/var/textureGather/c0640c.wgsl | 49 ++++ .../textureGather/c0640c.wgsl.expected.glsl | 84 ++++++ .../textureGather/c0640c.wgsl.expected.hlsl | 35 +++ .../textureGather/c0640c.wgsl.expected.msl | 35 +++ .../textureGather/c0640c.wgsl.expected.spvasm | 103 ++++++++ .../textureGather/c0640c.wgsl.expected.wgsl | 25 ++ .../gen/var/textureGather/d1f187.wgsl | 49 ++++ .../textureGather/d1f187.wgsl.expected.glsl | 61 +++++ .../textureGather/d1f187.wgsl.expected.hlsl | 35 +++ .../textureGather/d1f187.wgsl.expected.msl | 35 +++ .../textureGather/d1f187.wgsl.expected.spvasm | 105 ++++++++ .../textureGather/d1f187.wgsl.expected.wgsl | 25 ++ .../gen/var/textureGather/d90605.wgsl | 49 ++++ .../textureGather/d90605.wgsl.expected.glsl | 61 +++++ .../textureGather/d90605.wgsl.expected.hlsl | 35 +++ .../textureGather/d90605.wgsl.expected.msl | 35 +++ .../textureGather/d90605.wgsl.expected.spvasm | 103 ++++++++ .../textureGather/d90605.wgsl.expected.wgsl | 25 ++ .../gen/var/textureGather/e9d390.wgsl | 49 ++++ .../textureGather/e9d390.wgsl.expected.glsl | 61 +++++ .../textureGather/e9d390.wgsl.expected.hlsl | 35 +++ .../textureGather/e9d390.wgsl.expected.msl | 35 +++ .../textureGather/e9d390.wgsl.expected.spvasm | 104 ++++++++ .../textureGather/e9d390.wgsl.expected.wgsl | 25 ++ .../gen/var/textureGather/f2c6e3.wgsl | 49 ++++ .../textureGather/f2c6e3.wgsl.expected.glsl | 84 ++++++ .../textureGather/f2c6e3.wgsl.expected.hlsl | 35 +++ .../textureGather/f2c6e3.wgsl.expected.msl | 35 +++ .../textureGather/f2c6e3.wgsl.expected.spvasm | 104 ++++++++ .../textureGather/f2c6e3.wgsl.expected.wgsl | 25 ++ .../gen/var/textureGatherCompare/182fd4.wgsl | 49 ++++ .../182fd4.wgsl.expected.glsl | 61 +++++ .../182fd4.wgsl.expected.hlsl | 35 +++ .../182fd4.wgsl.expected.msl | 35 +++ .../182fd4.wgsl.expected.spvasm | 92 +++++++ .../182fd4.wgsl.expected.wgsl | 25 ++ .../gen/var/textureGatherCompare/313add.wgsl | 49 ++++ .../313add.wgsl.expected.glsl | 61 +++++ .../313add.wgsl.expected.hlsl | 35 +++ .../313add.wgsl.expected.msl | 35 +++ .../313add.wgsl.expected.spvasm | 95 +++++++ .../313add.wgsl.expected.wgsl | 25 ++ .../gen/var/textureGatherCompare/60d2d1.wgsl | 50 ++++ .../60d2d1.wgsl.expected.glsl | 87 +++++++ .../60d2d1.wgsl.expected.hlsl | 36 +++ .../60d2d1.wgsl.expected.msl | 36 +++ .../60d2d1.wgsl.expected.spvasm | 106 ++++++++ .../60d2d1.wgsl.expected.wgsl | 26 ++ .../gen/var/textureGatherCompare/6d9352.wgsl | 49 ++++ .../6d9352.wgsl.expected.glsl | 61 +++++ .../6d9352.wgsl.expected.hlsl | 35 +++ .../6d9352.wgsl.expected.msl | 35 +++ .../6d9352.wgsl.expected.spvasm | 92 +++++++ .../6d9352.wgsl.expected.wgsl | 25 ++ .../gen/var/textureGatherCompare/783e65.wgsl | 50 ++++ .../783e65.wgsl.expected.glsl | 64 +++++ .../783e65.wgsl.expected.hlsl | 36 +++ .../783e65.wgsl.expected.msl | 36 +++ .../783e65.wgsl.expected.spvasm | 105 ++++++++ .../783e65.wgsl.expected.wgsl | 26 ++ .../gen/var/textureGatherCompare/f585cc.wgsl | 50 ++++ .../f585cc.wgsl.expected.glsl | 64 +++++ .../f585cc.wgsl.expected.hlsl | 36 +++ .../f585cc.wgsl.expected.msl | 36 +++ .../f585cc.wgsl.expected.spvasm | 107 ++++++++ .../f585cc.wgsl.expected.wgsl | 26 ++ .../builtins/gen/var/textureLoad/19cf87.wgsl | 48 ++++ .../var/textureLoad/19cf87.wgsl.expected.glsl | 58 +++++ .../var/textureLoad/19cf87.wgsl.expected.hlsl | 34 +++ .../var/textureLoad/19cf87.wgsl.expected.msl | 35 +++ .../textureLoad/19cf87.wgsl.expected.spvasm | 86 +++++++ .../var/textureLoad/19cf87.wgsl.expected.wgsl | 23 ++ .../builtins/gen/var/textureLoad/1b8588.wgsl | 48 ++++ .../var/textureLoad/1b8588.wgsl.expected.glsl | 81 ++++++ .../var/textureLoad/1b8588.wgsl.expected.hlsl | 34 +++ .../var/textureLoad/1b8588.wgsl.expected.msl | 35 +++ .../textureLoad/1b8588.wgsl.expected.spvasm | 87 +++++++ .../var/textureLoad/1b8588.wgsl.expected.wgsl | 23 ++ .../builtins/gen/var/textureLoad/1f2016.wgsl | 48 ++++ .../var/textureLoad/1f2016.wgsl.expected.glsl | 58 +++++ .../var/textureLoad/1f2016.wgsl.expected.hlsl | 34 +++ .../var/textureLoad/1f2016.wgsl.expected.msl | 35 +++ .../textureLoad/1f2016.wgsl.expected.spvasm | 85 ++++++ .../var/textureLoad/1f2016.wgsl.expected.wgsl | 23 ++ .../builtins/gen/var/textureLoad/484344.wgsl | 48 ++++ .../var/textureLoad/484344.wgsl.expected.glsl | 58 +++++ .../var/textureLoad/484344.wgsl.expected.hlsl | 34 +++ .../var/textureLoad/484344.wgsl.expected.msl | 35 +++ .../textureLoad/484344.wgsl.expected.spvasm | 85 ++++++ .../var/textureLoad/484344.wgsl.expected.wgsl | 23 ++ .../builtins/gen/var/textureLoad/4fd803.wgsl | 48 ++++ .../var/textureLoad/4fd803.wgsl.expected.glsl | 58 +++++ .../var/textureLoad/4fd803.wgsl.expected.hlsl | 34 +++ .../var/textureLoad/4fd803.wgsl.expected.msl | 35 +++ .../textureLoad/4fd803.wgsl.expected.spvasm | 87 +++++++ .../var/textureLoad/4fd803.wgsl.expected.wgsl | 23 ++ .../builtins/gen/var/textureLoad/5a2f9d.wgsl | 48 ++++ .../var/textureLoad/5a2f9d.wgsl.expected.glsl | 81 ++++++ .../var/textureLoad/5a2f9d.wgsl.expected.hlsl | 34 +++ .../var/textureLoad/5a2f9d.wgsl.expected.msl | 35 +++ .../textureLoad/5a2f9d.wgsl.expected.spvasm | 86 +++++++ .../var/textureLoad/5a2f9d.wgsl.expected.wgsl | 23 ++ .../builtins/gen/var/textureLoad/6154d4.wgsl | 48 ++++ .../var/textureLoad/6154d4.wgsl.expected.glsl | 58 +++++ .../var/textureLoad/6154d4.wgsl.expected.hlsl | 34 +++ .../var/textureLoad/6154d4.wgsl.expected.msl | 35 +++ .../textureLoad/6154d4.wgsl.expected.spvasm | 88 +++++++ .../var/textureLoad/6154d4.wgsl.expected.wgsl | 23 ++ .../builtins/gen/var/textureLoad/6273b1.wgsl | 48 ++++ .../var/textureLoad/6273b1.wgsl.expected.glsl | 58 +++++ .../var/textureLoad/6273b1.wgsl.expected.hlsl | 34 +++ .../var/textureLoad/6273b1.wgsl.expected.msl | 35 +++ .../textureLoad/6273b1.wgsl.expected.spvasm | 87 +++++++ .../var/textureLoad/6273b1.wgsl.expected.wgsl | 23 ++ .../builtins/gen/var/textureLoad/79e697.wgsl | 49 ++++ .../var/textureLoad/79e697.wgsl.expected.glsl | 61 +++++ .../var/textureLoad/79e697.wgsl.expected.hlsl | 35 +++ .../var/textureLoad/79e697.wgsl.expected.msl | 36 +++ .../textureLoad/79e697.wgsl.expected.spvasm | 96 +++++++ .../var/textureLoad/79e697.wgsl.expected.wgsl | 24 ++ .../builtins/gen/var/textureLoad/7c90e5.wgsl | 49 ++++ .../var/textureLoad/7c90e5.wgsl.expected.glsl | 61 +++++ .../var/textureLoad/7c90e5.wgsl.expected.hlsl | 35 +++ .../var/textureLoad/7c90e5.wgsl.expected.msl | 36 +++ .../textureLoad/7c90e5.wgsl.expected.spvasm | 97 +++++++ .../var/textureLoad/7c90e5.wgsl.expected.wgsl | 24 ++ .../builtins/gen/var/textureLoad/81c381.wgsl | 48 ++++ .../var/textureLoad/81c381.wgsl.expected.glsl | 81 ++++++ .../var/textureLoad/81c381.wgsl.expected.hlsl | 34 +++ .../var/textureLoad/81c381.wgsl.expected.msl | 35 +++ .../textureLoad/81c381.wgsl.expected.spvasm | 84 ++++++ .../var/textureLoad/81c381.wgsl.expected.wgsl | 23 ++ .../builtins/gen/var/textureLoad/87be85.wgsl | 49 ++++ .../var/textureLoad/87be85.wgsl.expected.glsl | 61 +++++ .../var/textureLoad/87be85.wgsl.expected.hlsl | 35 +++ .../var/textureLoad/87be85.wgsl.expected.msl | 36 +++ .../textureLoad/87be85.wgsl.expected.spvasm | 94 +++++++ .../var/textureLoad/87be85.wgsl.expected.wgsl | 24 ++ .../builtins/gen/var/textureLoad/8acf41.wgsl | 47 ++++ .../var/textureLoad/8acf41.wgsl.expected.glsl | 225 ++++++++++++++++ .../var/textureLoad/8acf41.wgsl.expected.hlsl | 108 ++++++++ .../var/textureLoad/8acf41.wgsl.expected.msl | 74 ++++++ .../textureLoad/8acf41.wgsl.expected.spvasm | 233 +++++++++++++++++ .../var/textureLoad/8acf41.wgsl.expected.wgsl | 22 ++ .../builtins/gen/var/textureLoad/9b2667.wgsl | 49 ++++ .../var/textureLoad/9b2667.wgsl.expected.glsl | 61 +++++ .../var/textureLoad/9b2667.wgsl.expected.hlsl | 35 +++ .../var/textureLoad/9b2667.wgsl.expected.msl | 36 +++ .../textureLoad/9b2667.wgsl.expected.spvasm | 95 +++++++ .../var/textureLoad/9b2667.wgsl.expected.wgsl | 24 ++ .../builtins/gen/var/textureLoad/a583c9.wgsl | 48 ++++ .../var/textureLoad/a583c9.wgsl.expected.glsl | 58 +++++ .../var/textureLoad/a583c9.wgsl.expected.hlsl | 34 +++ .../var/textureLoad/a583c9.wgsl.expected.msl | 35 +++ .../textureLoad/a583c9.wgsl.expected.spvasm | 86 +++++++ .../var/textureLoad/a583c9.wgsl.expected.wgsl | 23 ++ .../builtins/gen/var/textureLoad/a9a9f5.wgsl | 48 ++++ .../var/textureLoad/a9a9f5.wgsl.expected.glsl | 58 +++++ .../var/textureLoad/a9a9f5.wgsl.expected.hlsl | 34 +++ .../var/textureLoad/a9a9f5.wgsl.expected.msl | 35 +++ .../textureLoad/a9a9f5.wgsl.expected.spvasm | 88 +++++++ .../var/textureLoad/a9a9f5.wgsl.expected.wgsl | 23 ++ .../builtins/gen/var/textureLoad/c2a480.wgsl | 48 ++++ .../var/textureLoad/c2a480.wgsl.expected.glsl | 58 +++++ .../var/textureLoad/c2a480.wgsl.expected.hlsl | 34 +++ .../var/textureLoad/c2a480.wgsl.expected.msl | 35 +++ .../textureLoad/c2a480.wgsl.expected.spvasm | 87 +++++++ .../var/textureLoad/c2a480.wgsl.expected.wgsl | 23 ++ .../builtins/gen/var/textureLoad/c378ee.wgsl | 48 ++++ .../var/textureLoad/c378ee.wgsl.expected.glsl | 58 +++++ .../var/textureLoad/c378ee.wgsl.expected.hlsl | 34 +++ .../var/textureLoad/c378ee.wgsl.expected.msl | 35 +++ .../textureLoad/c378ee.wgsl.expected.spvasm | 89 +++++++ .../var/textureLoad/c378ee.wgsl.expected.wgsl | 23 ++ .../builtins/gen/var/textureLoad/e3d2cc.wgsl | 48 ++++ .../var/textureLoad/e3d2cc.wgsl.expected.glsl | 58 +++++ .../var/textureLoad/e3d2cc.wgsl.expected.hlsl | 34 +++ .../var/textureLoad/e3d2cc.wgsl.expected.msl | 35 +++ .../textureLoad/e3d2cc.wgsl.expected.spvasm | 88 +++++++ .../var/textureLoad/e3d2cc.wgsl.expected.wgsl | 23 ++ .../gen/var/textureNumLayers/024820.wgsl | 46 ++++ .../024820.wgsl.expected.glsl | 52 ++++ .../024820.wgsl.expected.hlsl | 34 +++ .../textureNumLayers/024820.wgsl.expected.msl | 33 +++ .../024820.wgsl.expected.spvasm | 77 ++++++ .../024820.wgsl.expected.wgsl | 21 ++ .../gen/var/textureNumLayers/053df7.wgsl | 46 ++++ .../053df7.wgsl.expected.glsl | 75 ++++++ .../053df7.wgsl.expected.hlsl | 34 +++ .../textureNumLayers/053df7.wgsl.expected.msl | 33 +++ .../053df7.wgsl.expected.spvasm | 79 ++++++ .../053df7.wgsl.expected.wgsl | 21 ++ .../gen/var/textureNumLayers/058cc3.wgsl | 46 ++++ .../058cc3.wgsl.expected.glsl | 75 ++++++ .../058cc3.wgsl.expected.hlsl | 34 +++ .../textureNumLayers/058cc3.wgsl.expected.msl | 33 +++ .../058cc3.wgsl.expected.spvasm | 78 ++++++ .../058cc3.wgsl.expected.wgsl | 21 ++ .../gen/var/textureNumLayers/09d05d.wgsl | 46 ++++ .../09d05d.wgsl.expected.glsl | 52 ++++ .../09d05d.wgsl.expected.hlsl | 34 +++ .../textureNumLayers/09d05d.wgsl.expected.msl | 33 +++ .../09d05d.wgsl.expected.spvasm | 77 ++++++ .../09d05d.wgsl.expected.wgsl | 21 ++ .../gen/var/textureNumLayers/13b4ce.wgsl | 46 ++++ .../13b4ce.wgsl.expected.glsl | 52 ++++ .../13b4ce.wgsl.expected.hlsl | 34 +++ .../textureNumLayers/13b4ce.wgsl.expected.msl | 33 +++ .../13b4ce.wgsl.expected.spvasm | 77 ++++++ .../13b4ce.wgsl.expected.wgsl | 21 ++ .../gen/var/textureNumLayers/22e53b.wgsl | 46 ++++ .../22e53b.wgsl.expected.glsl | 52 ++++ .../22e53b.wgsl.expected.hlsl | 34 +++ .../textureNumLayers/22e53b.wgsl.expected.msl | 33 +++ .../22e53b.wgsl.expected.spvasm | 77 ++++++ .../22e53b.wgsl.expected.wgsl | 21 ++ .../gen/var/textureNumLayers/562013.wgsl | 46 ++++ .../562013.wgsl.expected.glsl | 52 ++++ .../562013.wgsl.expected.hlsl | 34 +++ .../textureNumLayers/562013.wgsl.expected.msl | 33 +++ .../562013.wgsl.expected.spvasm | 77 ++++++ .../562013.wgsl.expected.wgsl | 21 ++ .../gen/var/textureNumLayers/5d59cd.wgsl | 46 ++++ .../5d59cd.wgsl.expected.glsl | 75 ++++++ .../5d59cd.wgsl.expected.hlsl | 34 +++ .../textureNumLayers/5d59cd.wgsl.expected.msl | 33 +++ .../5d59cd.wgsl.expected.spvasm | 78 ++++++ .../5d59cd.wgsl.expected.wgsl | 21 ++ .../gen/var/textureNumLayers/68a65b.wgsl | 46 ++++ .../68a65b.wgsl.expected.glsl | 52 ++++ .../68a65b.wgsl.expected.hlsl | 34 +++ .../textureNumLayers/68a65b.wgsl.expected.msl | 33 +++ .../68a65b.wgsl.expected.spvasm | 77 ++++++ .../68a65b.wgsl.expected.wgsl | 21 ++ .../gen/var/textureNumLayers/778bd1.wgsl | 46 ++++ .../778bd1.wgsl.expected.glsl | 75 ++++++ .../778bd1.wgsl.expected.hlsl | 34 +++ .../textureNumLayers/778bd1.wgsl.expected.msl | 33 +++ .../778bd1.wgsl.expected.spvasm | 78 ++++++ .../778bd1.wgsl.expected.wgsl | 21 ++ .../gen/var/textureNumLayers/7f1937.wgsl | 46 ++++ .../7f1937.wgsl.expected.glsl | 75 ++++++ .../7f1937.wgsl.expected.hlsl | 34 +++ .../textureNumLayers/7f1937.wgsl.expected.msl | 33 +++ .../7f1937.wgsl.expected.spvasm | 78 ++++++ .../7f1937.wgsl.expected.wgsl | 21 ++ .../gen/var/textureNumLayers/85f980.wgsl | 46 ++++ .../85f980.wgsl.expected.glsl | 75 ++++++ .../85f980.wgsl.expected.hlsl | 34 +++ .../textureNumLayers/85f980.wgsl.expected.msl | 33 +++ .../85f980.wgsl.expected.spvasm | 78 ++++++ .../85f980.wgsl.expected.wgsl | 21 ++ .../gen/var/textureNumLayers/87953e.wgsl | 46 ++++ .../87953e.wgsl.expected.glsl | 52 ++++ .../87953e.wgsl.expected.hlsl | 34 +++ .../textureNumLayers/87953e.wgsl.expected.msl | 33 +++ .../87953e.wgsl.expected.spvasm | 78 ++++++ .../87953e.wgsl.expected.wgsl | 21 ++ .../gen/var/textureNumLayers/893e7c.wgsl | 46 ++++ .../893e7c.wgsl.expected.glsl | 52 ++++ .../893e7c.wgsl.expected.hlsl | 34 +++ .../textureNumLayers/893e7c.wgsl.expected.msl | 33 +++ .../893e7c.wgsl.expected.spvasm | 77 ++++++ .../893e7c.wgsl.expected.wgsl | 21 ++ .../gen/var/textureNumLayers/9700fb.wgsl | 46 ++++ .../9700fb.wgsl.expected.glsl | 52 ++++ .../9700fb.wgsl.expected.hlsl | 34 +++ .../textureNumLayers/9700fb.wgsl.expected.msl | 33 +++ .../9700fb.wgsl.expected.spvasm | 78 ++++++ .../9700fb.wgsl.expected.wgsl | 21 ++ .../gen/var/textureNumLayers/a216d2.wgsl | 46 ++++ .../a216d2.wgsl.expected.glsl | 52 ++++ .../a216d2.wgsl.expected.hlsl | 34 +++ .../textureNumLayers/a216d2.wgsl.expected.msl | 33 +++ .../a216d2.wgsl.expected.spvasm | 77 ++++++ .../a216d2.wgsl.expected.wgsl | 21 ++ .../gen/var/textureNumLayers/cd5dc8.wgsl | 46 ++++ .../cd5dc8.wgsl.expected.glsl | 52 ++++ .../cd5dc8.wgsl.expected.hlsl | 34 +++ .../textureNumLayers/cd5dc8.wgsl.expected.msl | 33 +++ .../cd5dc8.wgsl.expected.spvasm | 78 ++++++ .../cd5dc8.wgsl.expected.wgsl | 21 ++ .../gen/var/textureNumLayers/d5b228.wgsl | 46 ++++ .../d5b228.wgsl.expected.glsl | 52 ++++ .../d5b228.wgsl.expected.hlsl | 34 +++ .../textureNumLayers/d5b228.wgsl.expected.msl | 33 +++ .../d5b228.wgsl.expected.spvasm | 77 ++++++ .../d5b228.wgsl.expected.wgsl | 21 ++ .../gen/var/textureNumLayers/e31be1.wgsl | 46 ++++ .../e31be1.wgsl.expected.glsl | 52 ++++ .../e31be1.wgsl.expected.hlsl | 34 +++ .../textureNumLayers/e31be1.wgsl.expected.msl | 33 +++ .../e31be1.wgsl.expected.spvasm | 77 ++++++ .../e31be1.wgsl.expected.wgsl | 21 ++ .../gen/var/textureNumLayers/e653c0.wgsl | 46 ++++ .../e653c0.wgsl.expected.glsl | 52 ++++ .../e653c0.wgsl.expected.hlsl | 34 +++ .../textureNumLayers/e653c0.wgsl.expected.msl | 33 +++ .../e653c0.wgsl.expected.spvasm | 77 ++++++ .../e653c0.wgsl.expected.wgsl | 21 ++ .../gen/var/textureNumLayers/ee942f.wgsl | 46 ++++ .../ee942f.wgsl.expected.glsl | 52 ++++ .../ee942f.wgsl.expected.hlsl | 34 +++ .../textureNumLayers/ee942f.wgsl.expected.msl | 33 +++ .../ee942f.wgsl.expected.spvasm | 78 ++++++ .../ee942f.wgsl.expected.wgsl | 21 ++ .../gen/var/textureNumLayers/f33005.wgsl | 46 ++++ .../f33005.wgsl.expected.glsl | 52 ++++ .../f33005.wgsl.expected.hlsl | 34 +++ .../textureNumLayers/f33005.wgsl.expected.msl | 33 +++ .../f33005.wgsl.expected.spvasm | 77 ++++++ .../f33005.wgsl.expected.wgsl | 21 ++ .../gen/var/textureNumLayers/fcec98.wgsl | 46 ++++ .../fcec98.wgsl.expected.glsl | 75 ++++++ .../fcec98.wgsl.expected.hlsl | 34 +++ .../textureNumLayers/fcec98.wgsl.expected.msl | 33 +++ .../fcec98.wgsl.expected.spvasm | 79 ++++++ .../fcec98.wgsl.expected.wgsl | 21 ++ .../gen/var/textureNumLayers/ff5e89.wgsl | 46 ++++ .../ff5e89.wgsl.expected.glsl | 52 ++++ .../ff5e89.wgsl.expected.hlsl | 34 +++ .../textureNumLayers/ff5e89.wgsl.expected.msl | 33 +++ .../ff5e89.wgsl.expected.spvasm | 78 ++++++ .../ff5e89.wgsl.expected.wgsl | 21 ++ .../gen/var/textureNumLevels/076cb5.wgsl | 46 ++++ .../076cb5.wgsl.expected.glsl | 78 ++++++ .../076cb5.wgsl.expected.hlsl | 34 +++ .../textureNumLevels/076cb5.wgsl.expected.msl | 33 +++ .../076cb5.wgsl.expected.spvasm | 74 ++++++ .../076cb5.wgsl.expected.wgsl | 21 ++ .../gen/var/textureNumLevels/080d95.wgsl | 46 ++++ .../080d95.wgsl.expected.glsl | 78 ++++++ .../080d95.wgsl.expected.hlsl | 34 +++ .../textureNumLevels/080d95.wgsl.expected.msl | 33 +++ .../080d95.wgsl.expected.spvasm | 74 ++++++ .../080d95.wgsl.expected.wgsl | 21 ++ .../gen/var/textureNumLevels/09ddd0.wgsl | 46 ++++ .../09ddd0.wgsl.expected.glsl | 78 ++++++ .../09ddd0.wgsl.expected.hlsl | 34 +++ .../textureNumLevels/09ddd0.wgsl.expected.msl | 33 +++ .../09ddd0.wgsl.expected.spvasm | 75 ++++++ .../09ddd0.wgsl.expected.wgsl | 21 ++ .../gen/var/textureNumLevels/105988.wgsl | 46 ++++ .../105988.wgsl.expected.glsl | 78 ++++++ .../105988.wgsl.expected.hlsl | 34 +++ .../textureNumLevels/105988.wgsl.expected.msl | 33 +++ .../105988.wgsl.expected.spvasm | 74 ++++++ .../105988.wgsl.expected.wgsl | 21 ++ .../gen/var/textureNumLevels/1e6f3b.wgsl | 46 ++++ .../1e6f3b.wgsl.expected.glsl | 75 ++++++ .../1e6f3b.wgsl.expected.hlsl | 34 +++ .../textureNumLevels/1e6f3b.wgsl.expected.msl | 33 +++ .../1e6f3b.wgsl.expected.spvasm | 76 ++++++ .../1e6f3b.wgsl.expected.wgsl | 21 ++ .../gen/var/textureNumLevels/23f750.wgsl | 46 ++++ .../23f750.wgsl.expected.glsl | 78 ++++++ .../23f750.wgsl.expected.hlsl | 34 +++ .../textureNumLevels/23f750.wgsl.expected.msl | 33 +++ .../23f750.wgsl.expected.spvasm | 74 ++++++ .../23f750.wgsl.expected.wgsl | 21 ++ .../gen/var/textureNumLevels/2c3575.wgsl | 46 ++++ .../2c3575.wgsl.expected.glsl | 75 ++++++ .../2c3575.wgsl.expected.hlsl | 34 +++ .../textureNumLevels/2c3575.wgsl.expected.msl | 33 +++ .../2c3575.wgsl.expected.spvasm | 75 ++++++ .../2c3575.wgsl.expected.wgsl | 21 ++ .../gen/var/textureNumLevels/32a0ae.wgsl | 46 ++++ .../32a0ae.wgsl.expected.glsl | 75 ++++++ .../32a0ae.wgsl.expected.hlsl | 34 +++ .../textureNumLevels/32a0ae.wgsl.expected.msl | 33 +++ .../32a0ae.wgsl.expected.spvasm | 75 ++++++ .../32a0ae.wgsl.expected.wgsl | 21 ++ .../gen/var/textureNumLevels/5101cf.wgsl | 46 ++++ .../5101cf.wgsl.expected.glsl | 78 ++++++ .../5101cf.wgsl.expected.hlsl | 34 +++ .../textureNumLevels/5101cf.wgsl.expected.msl | 33 +++ .../5101cf.wgsl.expected.spvasm | 75 ++++++ .../5101cf.wgsl.expected.wgsl | 21 ++ .../gen/var/textureNumLevels/51b5bb.wgsl | 46 ++++ .../51b5bb.wgsl.expected.glsl | 75 ++++++ .../51b5bb.wgsl.expected.hlsl | 34 +++ .../textureNumLevels/51b5bb.wgsl.expected.msl | 33 +++ .../51b5bb.wgsl.expected.spvasm | 75 ++++++ .../51b5bb.wgsl.expected.wgsl | 21 ++ .../gen/var/textureNumLevels/897aaf.wgsl | 46 ++++ .../897aaf.wgsl.expected.glsl | 78 ++++++ .../897aaf.wgsl.expected.hlsl | 34 +++ .../textureNumLevels/897aaf.wgsl.expected.msl | 33 +++ .../897aaf.wgsl.expected.spvasm | 74 ++++++ .../897aaf.wgsl.expected.wgsl | 21 ++ .../gen/var/textureNumLevels/9da7a5.wgsl | 46 ++++ .../9da7a5.wgsl.expected.glsl | 78 ++++++ .../9da7a5.wgsl.expected.hlsl | 34 +++ .../textureNumLevels/9da7a5.wgsl.expected.msl | 33 +++ .../9da7a5.wgsl.expected.spvasm | 74 ++++++ .../9da7a5.wgsl.expected.wgsl | 21 ++ .../gen/var/textureNumLevels/a91c03.wgsl | 46 ++++ .../a91c03.wgsl.expected.glsl | 75 ++++++ .../a91c03.wgsl.expected.hlsl | 34 +++ .../textureNumLevels/a91c03.wgsl.expected.msl | 33 +++ .../a91c03.wgsl.expected.spvasm | 75 ++++++ .../a91c03.wgsl.expected.wgsl | 21 ++ .../gen/var/textureNumLevels/aee7c8.wgsl | 46 ++++ .../aee7c8.wgsl.expected.glsl | 75 ++++++ .../aee7c8.wgsl.expected.hlsl | 34 +++ .../textureNumLevels/aee7c8.wgsl.expected.msl | 33 +++ .../aee7c8.wgsl.expected.spvasm | 75 ++++++ .../aee7c8.wgsl.expected.wgsl | 21 ++ .../gen/var/textureNumLevels/b1b12b.wgsl | 46 ++++ .../b1b12b.wgsl.expected.glsl | 78 ++++++ .../b1b12b.wgsl.expected.hlsl | 34 +++ .../textureNumLevels/b1b12b.wgsl.expected.msl | 33 +++ .../b1b12b.wgsl.expected.spvasm | 74 ++++++ .../b1b12b.wgsl.expected.wgsl | 21 ++ .../gen/var/textureNumLevels/b4f5ea.wgsl | 46 ++++ .../b4f5ea.wgsl.expected.glsl | 78 ++++++ .../b4f5ea.wgsl.expected.hlsl | 34 +++ .../textureNumLevels/b4f5ea.wgsl.expected.msl | 33 +++ .../b4f5ea.wgsl.expected.spvasm | 75 ++++++ .../b4f5ea.wgsl.expected.wgsl | 21 ++ .../gen/var/textureNumLevels/d004a9.wgsl | 46 ++++ .../d004a9.wgsl.expected.glsl | 78 ++++++ .../d004a9.wgsl.expected.hlsl | 34 +++ .../textureNumLevels/d004a9.wgsl.expected.msl | 33 +++ .../d004a9.wgsl.expected.spvasm | 74 ++++++ .../d004a9.wgsl.expected.wgsl | 21 ++ .../gen/var/textureNumLevels/dca09e.wgsl | 46 ++++ .../dca09e.wgsl.expected.glsl | 78 ++++++ .../dca09e.wgsl.expected.hlsl | 34 +++ .../textureNumLevels/dca09e.wgsl.expected.msl | 33 +++ .../dca09e.wgsl.expected.spvasm | 74 ++++++ .../dca09e.wgsl.expected.wgsl | 21 ++ .../gen/var/textureNumLevels/e67231.wgsl | 46 ++++ .../e67231.wgsl.expected.glsl | 78 ++++++ .../e67231.wgsl.expected.hlsl | 34 +++ .../textureNumLevels/e67231.wgsl.expected.msl | 33 +++ .../e67231.wgsl.expected.spvasm | 74 ++++++ .../e67231.wgsl.expected.wgsl | 21 ++ .../gen/var/textureNumLevels/ed078b.wgsl | 46 ++++ .../ed078b.wgsl.expected.glsl | 78 ++++++ .../ed078b.wgsl.expected.hlsl | 34 +++ .../textureNumLevels/ed078b.wgsl.expected.msl | 33 +++ .../ed078b.wgsl.expected.spvasm | 75 ++++++ .../ed078b.wgsl.expected.wgsl | 21 ++ .../gen/var/textureNumLevels/f46ec6.wgsl | 46 ++++ .../f46ec6.wgsl.expected.glsl | 75 ++++++ .../f46ec6.wgsl.expected.hlsl | 34 +++ .../textureNumLevels/f46ec6.wgsl.expected.msl | 33 +++ .../f46ec6.wgsl.expected.spvasm | 76 ++++++ .../f46ec6.wgsl.expected.wgsl | 21 ++ .../gen/var/textureNumLevels/f5828d.wgsl | 46 ++++ .../f5828d.wgsl.expected.glsl | 78 ++++++ .../f5828d.wgsl.expected.hlsl | 34 +++ .../textureNumLevels/f5828d.wgsl.expected.msl | 33 +++ .../f5828d.wgsl.expected.spvasm | 74 ++++++ .../f5828d.wgsl.expected.wgsl | 21 ++ .../gen/var/textureNumSamples/2c6f14.wgsl | 46 ++++ .../2c6f14.wgsl.expected.glsl | 78 ++++++ .../2c6f14.wgsl.expected.hlsl | 34 +++ .../2c6f14.wgsl.expected.msl | 33 +++ .../2c6f14.wgsl.expected.spvasm | 74 ++++++ .../2c6f14.wgsl.expected.wgsl | 21 ++ .../gen/var/textureNumSamples/42f8bb.wgsl | 46 ++++ .../42f8bb.wgsl.expected.glsl | 78 ++++++ .../42f8bb.wgsl.expected.hlsl | 34 +++ .../42f8bb.wgsl.expected.msl | 33 +++ .../42f8bb.wgsl.expected.spvasm | 75 ++++++ .../42f8bb.wgsl.expected.wgsl | 21 ++ .../gen/var/textureNumSamples/449d23.wgsl | 46 ++++ .../449d23.wgsl.expected.glsl | 78 ++++++ .../449d23.wgsl.expected.hlsl | 34 +++ .../449d23.wgsl.expected.msl | 33 +++ .../449d23.wgsl.expected.spvasm | 74 ++++++ .../449d23.wgsl.expected.wgsl | 21 ++ .../gen/var/textureNumSamples/a3c8a0.wgsl | 46 ++++ .../a3c8a0.wgsl.expected.glsl | 78 ++++++ .../a3c8a0.wgsl.expected.hlsl | 34 +++ .../a3c8a0.wgsl.expected.msl | 33 +++ .../a3c8a0.wgsl.expected.spvasm | 74 ++++++ .../a3c8a0.wgsl.expected.wgsl | 21 ++ .../gen/var/textureSample/0dff6c.wgsl | 37 +++ .../textureSample/0dff6c.wgsl.expected.glsl | 18 ++ .../textureSample/0dff6c.wgsl.expected.hlsl | 12 + .../textureSample/0dff6c.wgsl.expected.msl | 13 + .../textureSample/0dff6c.wgsl.expected.spvasm | 57 ++++ .../textureSample/0dff6c.wgsl.expected.wgsl | 13 + .../gen/var/textureSample/17e988.wgsl | 38 +++ .../textureSample/17e988.wgsl.expected.glsl | 19 ++ .../textureSample/17e988.wgsl.expected.hlsl | 13 + .../textureSample/17e988.wgsl.expected.msl | 14 + .../textureSample/17e988.wgsl.expected.spvasm | 68 +++++ .../textureSample/17e988.wgsl.expected.wgsl | 14 + .../gen/var/textureSample/2149ec.wgsl | 37 +++ .../textureSample/2149ec.wgsl.expected.glsl | 18 ++ .../textureSample/2149ec.wgsl.expected.hlsl | 12 + .../textureSample/2149ec.wgsl.expected.msl | 13 + .../textureSample/2149ec.wgsl.expected.spvasm | 56 ++++ .../textureSample/2149ec.wgsl.expected.wgsl | 13 + .../gen/var/textureSample/38bbb9.wgsl | 37 +++ .../textureSample/38bbb9.wgsl.expected.glsl | 18 ++ .../textureSample/38bbb9.wgsl.expected.hlsl | 12 + .../textureSample/38bbb9.wgsl.expected.msl | 13 + .../textureSample/38bbb9.wgsl.expected.spvasm | 54 ++++ .../textureSample/38bbb9.wgsl.expected.wgsl | 13 + .../gen/var/textureSample/3b50bd.wgsl | 37 +++ .../textureSample/3b50bd.wgsl.expected.glsl | 18 ++ .../textureSample/3b50bd.wgsl.expected.hlsl | 12 + .../textureSample/3b50bd.wgsl.expected.msl | 13 + .../textureSample/3b50bd.wgsl.expected.spvasm | 53 ++++ .../textureSample/3b50bd.wgsl.expected.wgsl | 13 + .../gen/var/textureSample/4dd1bf.wgsl | 38 +++ .../textureSample/4dd1bf.wgsl.expected.glsl | 28 ++ .../textureSample/4dd1bf.wgsl.expected.hlsl | 13 + .../textureSample/4dd1bf.wgsl.expected.msl | 14 + .../textureSample/4dd1bf.wgsl.expected.spvasm | 67 +++++ .../textureSample/4dd1bf.wgsl.expected.wgsl | 14 + .../gen/var/textureSample/51b514.wgsl | 37 +++ .../textureSample/51b514.wgsl.expected.glsl | 18 ++ .../textureSample/51b514.wgsl.expected.hlsl | 12 + .../textureSample/51b514.wgsl.expected.msl | 13 + .../textureSample/51b514.wgsl.expected.spvasm | 53 ++++ .../textureSample/51b514.wgsl.expected.wgsl | 13 + .../gen/var/textureSample/60bf45.wgsl | 38 +++ .../textureSample/60bf45.wgsl.expected.glsl | 28 ++ .../textureSample/60bf45.wgsl.expected.hlsl | 13 + .../textureSample/60bf45.wgsl.expected.msl | 14 + .../textureSample/60bf45.wgsl.expected.spvasm | 69 +++++ .../textureSample/60bf45.wgsl.expected.wgsl | 14 + .../gen/var/textureSample/6717ca.wgsl | 38 +++ .../textureSample/6717ca.wgsl.expected.glsl | 19 ++ .../textureSample/6717ca.wgsl.expected.hlsl | 13 + .../textureSample/6717ca.wgsl.expected.msl | 14 + .../textureSample/6717ca.wgsl.expected.spvasm | 66 +++++ .../textureSample/6717ca.wgsl.expected.wgsl | 14 + .../gen/var/textureSample/6e64fb.wgsl | 37 +++ .../textureSample/6e64fb.wgsl.expected.glsl | 27 ++ .../textureSample/6e64fb.wgsl.expected.hlsl | 12 + .../textureSample/6e64fb.wgsl.expected.msl | 13 + .../textureSample/6e64fb.wgsl.expected.spvasm | 54 ++++ .../textureSample/6e64fb.wgsl.expected.wgsl | 13 + .../gen/var/textureSample/7e9ffd.wgsl | 38 +++ .../textureSample/7e9ffd.wgsl.expected.glsl | 19 ++ .../textureSample/7e9ffd.wgsl.expected.hlsl | 13 + .../textureSample/7e9ffd.wgsl.expected.msl | 14 + .../textureSample/7e9ffd.wgsl.expected.spvasm | 67 +++++ .../textureSample/7e9ffd.wgsl.expected.wgsl | 14 + .../gen/var/textureSample/85c4ba.wgsl | 37 +++ .../textureSample/85c4ba.wgsl.expected.glsl | 18 ++ .../textureSample/85c4ba.wgsl.expected.hlsl | 12 + .../textureSample/85c4ba.wgsl.expected.msl | 13 + .../textureSample/85c4ba.wgsl.expected.spvasm | 56 ++++ .../textureSample/85c4ba.wgsl.expected.wgsl | 13 + .../gen/var/textureSample/c2f4e8.wgsl | 38 +++ .../textureSample/c2f4e8.wgsl.expected.glsl | 28 ++ .../textureSample/c2f4e8.wgsl.expected.hlsl | 13 + .../textureSample/c2f4e8.wgsl.expected.msl | 14 + .../textureSample/c2f4e8.wgsl.expected.spvasm | 68 +++++ .../textureSample/c2f4e8.wgsl.expected.wgsl | 14 + .../gen/var/textureSample/e53267.wgsl | 37 +++ .../textureSample/e53267.wgsl.expected.glsl | 18 ++ .../textureSample/e53267.wgsl.expected.hlsl | 12 + .../textureSample/e53267.wgsl.expected.msl | 13 + .../textureSample/e53267.wgsl.expected.spvasm | 53 ++++ .../textureSample/e53267.wgsl.expected.wgsl | 13 + .../gen/var/textureSample/ea7030.wgsl | 37 +++ .../textureSample/ea7030.wgsl.expected.glsl | 18 ++ .../textureSample/ea7030.wgsl.expected.hlsl | 12 + .../textureSample/ea7030.wgsl.expected.msl | 13 + .../textureSample/ea7030.wgsl.expected.spvasm | 54 ++++ .../textureSample/ea7030.wgsl.expected.wgsl | 13 + .../gen/var/textureSampleBias/53b9f7.wgsl | 38 +++ .../53b9f7.wgsl.expected.glsl | 19 ++ .../53b9f7.wgsl.expected.hlsl | 13 + .../53b9f7.wgsl.expected.msl | 14 + .../53b9f7.wgsl.expected.spvasm | 60 +++++ .../53b9f7.wgsl.expected.wgsl | 14 + .../gen/var/textureSampleBias/594824.wgsl | 38 +++ .../594824.wgsl.expected.glsl | 19 ++ .../594824.wgsl.expected.hlsl | 13 + .../594824.wgsl.expected.msl | 14 + .../594824.wgsl.expected.spvasm | 63 +++++ .../594824.wgsl.expected.wgsl | 14 + .../gen/var/textureSampleBias/6a9113.wgsl | 38 +++ .../6a9113.wgsl.expected.glsl | 19 ++ .../6a9113.wgsl.expected.hlsl | 13 + .../6a9113.wgsl.expected.msl | 14 + .../6a9113.wgsl.expected.spvasm | 60 +++++ .../6a9113.wgsl.expected.wgsl | 14 + .../gen/var/textureSampleBias/80e579.wgsl | 39 +++ .../80e579.wgsl.expected.glsl | 20 ++ .../80e579.wgsl.expected.hlsl | 14 + .../80e579.wgsl.expected.msl | 15 ++ .../80e579.wgsl.expected.spvasm | 73 ++++++ .../80e579.wgsl.expected.wgsl | 15 ++ .../gen/var/textureSampleBias/9dbb51.wgsl | 39 +++ .../9dbb51.wgsl.expected.glsl | 20 ++ .../9dbb51.wgsl.expected.hlsl | 14 + .../9dbb51.wgsl.expected.msl | 15 ++ .../9dbb51.wgsl.expected.spvasm | 75 ++++++ .../9dbb51.wgsl.expected.wgsl | 15 ++ .../gen/var/textureSampleBias/a161cf.wgsl | 38 +++ .../a161cf.wgsl.expected.glsl | 19 ++ .../a161cf.wgsl.expected.hlsl | 13 + .../a161cf.wgsl.expected.msl | 14 + .../a161cf.wgsl.expected.spvasm | 63 +++++ .../a161cf.wgsl.expected.wgsl | 14 + .../gen/var/textureSampleBias/d3fa1b.wgsl | 38 +++ .../d3fa1b.wgsl.expected.glsl | 19 ++ .../d3fa1b.wgsl.expected.hlsl | 13 + .../d3fa1b.wgsl.expected.msl | 14 + .../d3fa1b.wgsl.expected.spvasm | 60 +++++ .../d3fa1b.wgsl.expected.wgsl | 14 + .../gen/var/textureSampleBias/eed7c4.wgsl | 39 +++ .../eed7c4.wgsl.expected.glsl | 29 +++ .../eed7c4.wgsl.expected.hlsl | 14 + .../eed7c4.wgsl.expected.msl | 15 ++ .../eed7c4.wgsl.expected.spvasm | 74 ++++++ .../eed7c4.wgsl.expected.wgsl | 15 ++ .../gen/var/textureSampleCompare/3a5923.wgsl | 38 +++ .../3a5923.wgsl.expected.glsl | 19 ++ .../3a5923.wgsl.expected.hlsl | 13 + .../3a5923.wgsl.expected.msl | 14 + .../3a5923.wgsl.expected.spvasm | 57 ++++ .../3a5923.wgsl.expected.wgsl | 14 + .../gen/var/textureSampleCompare/63fb83.wgsl | 38 +++ .../63fb83.wgsl.expected.glsl | 19 ++ .../63fb83.wgsl.expected.hlsl | 13 + .../63fb83.wgsl.expected.msl | 14 + .../63fb83.wgsl.expected.spvasm | 57 ++++ .../63fb83.wgsl.expected.wgsl | 14 + .../gen/var/textureSampleCompare/a3ca7e.wgsl | 39 +++ .../a3ca7e.wgsl.expected.glsl | 29 +++ .../a3ca7e.wgsl.expected.hlsl | 14 + .../a3ca7e.wgsl.expected.msl | 15 ++ .../a3ca7e.wgsl.expected.spvasm | 72 ++++++ .../a3ca7e.wgsl.expected.wgsl | 15 ++ .../gen/var/textureSampleCompare/af1051.wgsl | 39 +++ .../af1051.wgsl.expected.glsl | 29 +++ .../af1051.wgsl.expected.hlsl | 14 + .../af1051.wgsl.expected.msl | 15 ++ .../af1051.wgsl.expected.spvasm | 72 ++++++ .../af1051.wgsl.expected.wgsl | 15 ++ .../gen/var/textureSampleCompare/dd431d.wgsl | 39 +++ .../dd431d.wgsl.expected.glsl | 20 ++ .../dd431d.wgsl.expected.hlsl | 14 + .../dd431d.wgsl.expected.msl | 15 ++ .../dd431d.wgsl.expected.spvasm | 70 +++++ .../dd431d.wgsl.expected.wgsl | 15 ++ .../gen/var/textureSampleCompare/dec064.wgsl | 38 +++ .../dec064.wgsl.expected.glsl | 19 ++ .../dec064.wgsl.expected.hlsl | 13 + .../dec064.wgsl.expected.msl | 14 + .../dec064.wgsl.expected.spvasm | 60 +++++ .../dec064.wgsl.expected.wgsl | 14 + .../var/textureSampleCompareLevel/1116ed.wgsl | 50 ++++ .../1116ed.wgsl.expected.glsl | 64 +++++ .../1116ed.wgsl.expected.hlsl | 36 +++ .../1116ed.wgsl.expected.msl | 36 +++ .../1116ed.wgsl.expected.spvasm | 105 ++++++++ .../1116ed.wgsl.expected.wgsl | 26 ++ .../var/textureSampleCompareLevel/1568e3.wgsl | 49 ++++ .../1568e3.wgsl.expected.glsl | 61 +++++ .../1568e3.wgsl.expected.hlsl | 35 +++ .../1568e3.wgsl.expected.msl | 35 +++ .../1568e3.wgsl.expected.spvasm | 92 +++++++ .../1568e3.wgsl.expected.wgsl | 25 ++ .../var/textureSampleCompareLevel/2ad2b1.wgsl | 49 ++++ .../2ad2b1.wgsl.expected.glsl | 61 +++++ .../2ad2b1.wgsl.expected.hlsl | 35 +++ .../2ad2b1.wgsl.expected.msl | 35 +++ .../2ad2b1.wgsl.expected.spvasm | 92 +++++++ .../2ad2b1.wgsl.expected.wgsl | 25 ++ .../var/textureSampleCompareLevel/4cf3a2.wgsl | 50 ++++ .../4cf3a2.wgsl.expected.glsl | 87 +++++++ .../4cf3a2.wgsl.expected.hlsl | 36 +++ .../4cf3a2.wgsl.expected.msl | 36 +++ .../4cf3a2.wgsl.expected.spvasm | 106 ++++++++ .../4cf3a2.wgsl.expected.wgsl | 26 ++ .../var/textureSampleCompareLevel/7f2b9a.wgsl | 49 ++++ .../7f2b9a.wgsl.expected.glsl | 61 +++++ .../7f2b9a.wgsl.expected.hlsl | 35 +++ .../7f2b9a.wgsl.expected.msl | 35 +++ .../7f2b9a.wgsl.expected.spvasm | 95 +++++++ .../7f2b9a.wgsl.expected.wgsl | 25 ++ .../var/textureSampleCompareLevel/b6e47c.wgsl | 50 ++++ .../b6e47c.wgsl.expected.glsl | 87 +++++++ .../b6e47c.wgsl.expected.hlsl | 36 +++ .../b6e47c.wgsl.expected.msl | 36 +++ .../b6e47c.wgsl.expected.spvasm | 107 ++++++++ .../b6e47c.wgsl.expected.wgsl | 26 ++ .../gen/var/textureSampleGrad/21402b.wgsl | 50 ++++ .../21402b.wgsl.expected.glsl | 64 +++++ .../21402b.wgsl.expected.hlsl | 36 +++ .../21402b.wgsl.expected.msl | 36 +++ .../21402b.wgsl.expected.spvasm | 95 +++++++ .../21402b.wgsl.expected.wgsl | 26 ++ .../gen/var/textureSampleGrad/2ecd8f.wgsl | 51 ++++ .../2ecd8f.wgsl.expected.glsl | 67 +++++ .../2ecd8f.wgsl.expected.hlsl | 37 +++ .../2ecd8f.wgsl.expected.msl | 37 +++ .../2ecd8f.wgsl.expected.spvasm | 108 ++++++++ .../2ecd8f.wgsl.expected.wgsl | 27 ++ .../gen/var/textureSampleGrad/521263.wgsl | 50 ++++ .../521263.wgsl.expected.glsl | 64 +++++ .../521263.wgsl.expected.hlsl | 36 +++ .../521263.wgsl.expected.msl | 36 +++ .../521263.wgsl.expected.spvasm | 95 +++++++ .../521263.wgsl.expected.wgsl | 26 ++ .../gen/var/textureSampleGrad/5312f4.wgsl | 50 ++++ .../5312f4.wgsl.expected.glsl | 64 +++++ .../5312f4.wgsl.expected.hlsl | 36 +++ .../5312f4.wgsl.expected.msl | 36 +++ .../5312f4.wgsl.expected.spvasm | 95 +++++++ .../5312f4.wgsl.expected.wgsl | 26 ++ .../gen/var/textureSampleGrad/5884dd.wgsl | 50 ++++ .../5884dd.wgsl.expected.glsl | 64 +++++ .../5884dd.wgsl.expected.hlsl | 36 +++ .../5884dd.wgsl.expected.msl | 36 +++ .../5884dd.wgsl.expected.spvasm | 98 +++++++ .../5884dd.wgsl.expected.wgsl | 26 ++ .../gen/var/textureSampleGrad/d4e3c5.wgsl | 50 ++++ .../d4e3c5.wgsl.expected.glsl | 64 +++++ .../d4e3c5.wgsl.expected.hlsl | 36 +++ .../d4e3c5.wgsl.expected.msl | 36 +++ .../d4e3c5.wgsl.expected.spvasm | 98 +++++++ .../d4e3c5.wgsl.expected.wgsl | 26 ++ .../gen/var/textureSampleGrad/d65515.wgsl | 51 ++++ .../d65515.wgsl.expected.glsl | 67 +++++ .../d65515.wgsl.expected.hlsl | 37 +++ .../d65515.wgsl.expected.msl | 37 +++ .../d65515.wgsl.expected.spvasm | 110 ++++++++ .../d65515.wgsl.expected.wgsl | 27 ++ .../gen/var/textureSampleGrad/e383db.wgsl | 51 ++++ .../e383db.wgsl.expected.glsl | 90 +++++++ .../e383db.wgsl.expected.hlsl | 37 +++ .../e383db.wgsl.expected.msl | 37 +++ .../e383db.wgsl.expected.spvasm | 109 ++++++++ .../e383db.wgsl.expected.wgsl | 27 ++ .../gen/var/textureSampleLevel/02be59.wgsl | 49 ++++ .../02be59.wgsl.expected.glsl | 61 +++++ .../02be59.wgsl.expected.hlsl | 35 +++ .../02be59.wgsl.expected.msl | 35 +++ .../02be59.wgsl.expected.spvasm | 96 +++++++ .../02be59.wgsl.expected.wgsl | 25 ++ .../gen/var/textureSampleLevel/0b0a1b.wgsl | 49 ++++ .../0b0a1b.wgsl.expected.glsl | 61 +++++ .../0b0a1b.wgsl.expected.hlsl | 35 +++ .../0b0a1b.wgsl.expected.msl | 35 +++ .../0b0a1b.wgsl.expected.spvasm | 95 +++++++ .../0b0a1b.wgsl.expected.wgsl | 25 ++ .../gen/var/textureSampleLevel/0bdd9a.wgsl | 50 ++++ .../0bdd9a.wgsl.expected.glsl | 87 +++++++ .../0bdd9a.wgsl.expected.hlsl | 36 +++ .../0bdd9a.wgsl.expected.msl | 36 +++ .../0bdd9a.wgsl.expected.spvasm | 106 ++++++++ .../0bdd9a.wgsl.expected.wgsl | 26 ++ .../gen/var/textureSampleLevel/1b0291.wgsl | 49 ++++ .../1b0291.wgsl.expected.glsl | 84 ++++++ .../1b0291.wgsl.expected.hlsl | 35 +++ .../1b0291.wgsl.expected.msl | 35 +++ .../1b0291.wgsl.expected.spvasm | 96 +++++++ .../1b0291.wgsl.expected.wgsl | 25 ++ .../gen/var/textureSampleLevel/1bf73e.wgsl | 50 ++++ .../1bf73e.wgsl.expected.glsl | 87 +++++++ .../1bf73e.wgsl.expected.hlsl | 36 +++ .../1bf73e.wgsl.expected.msl | 36 +++ .../1bf73e.wgsl.expected.spvasm | 106 ++++++++ .../1bf73e.wgsl.expected.wgsl | 26 ++ .../gen/var/textureSampleLevel/302be4.wgsl | 50 ++++ .../302be4.wgsl.expected.glsl | 64 +++++ .../302be4.wgsl.expected.hlsl | 36 +++ .../302be4.wgsl.expected.msl | 36 +++ .../302be4.wgsl.expected.spvasm | 105 ++++++++ .../302be4.wgsl.expected.wgsl | 26 ++ .../gen/var/textureSampleLevel/36780e.wgsl | 50 ++++ .../36780e.wgsl.expected.glsl | 87 +++++++ .../36780e.wgsl.expected.hlsl | 36 +++ .../36780e.wgsl.expected.msl | 36 +++ .../36780e.wgsl.expected.spvasm | 108 ++++++++ .../36780e.wgsl.expected.wgsl | 26 ++ .../gen/var/textureSampleLevel/749baf.wgsl | 49 ++++ .../749baf.wgsl.expected.glsl | 61 +++++ .../749baf.wgsl.expected.hlsl | 35 +++ .../749baf.wgsl.expected.msl | 35 +++ .../749baf.wgsl.expected.spvasm | 98 +++++++ .../749baf.wgsl.expected.wgsl | 25 ++ .../gen/var/textureSampleLevel/979816.wgsl | 48 ++++ .../979816.wgsl.expected.glsl | 228 ++++++++++++++++ .../979816.wgsl.expected.hlsl | 109 ++++++++ .../979816.wgsl.expected.msl | 74 ++++++ .../979816.wgsl.expected.spvasm | 243 ++++++++++++++++++ .../979816.wgsl.expected.wgsl | 24 ++ .../gen/var/textureSampleLevel/abfcc0.wgsl | 49 ++++ .../abfcc0.wgsl.expected.glsl | 61 +++++ .../abfcc0.wgsl.expected.hlsl | 35 +++ .../abfcc0.wgsl.expected.msl | 35 +++ .../abfcc0.wgsl.expected.spvasm | 92 +++++++ .../abfcc0.wgsl.expected.wgsl | 25 ++ .../gen/var/textureSampleLevel/ae5e39.wgsl | 50 ++++ .../ae5e39.wgsl.expected.glsl | 87 +++++++ .../ae5e39.wgsl.expected.hlsl | 36 +++ .../ae5e39.wgsl.expected.msl | 36 +++ .../ae5e39.wgsl.expected.spvasm | 107 ++++++++ .../ae5e39.wgsl.expected.wgsl | 26 ++ .../gen/var/textureSampleLevel/b7c55c.wgsl | 50 ++++ .../b7c55c.wgsl.expected.glsl | 64 +++++ .../b7c55c.wgsl.expected.hlsl | 36 +++ .../b7c55c.wgsl.expected.msl | 36 +++ .../b7c55c.wgsl.expected.spvasm | 107 ++++++++ .../b7c55c.wgsl.expected.wgsl | 26 ++ .../gen/var/textureSampleLevel/c32df7.wgsl | 49 ++++ .../c32df7.wgsl.expected.glsl | 61 +++++ .../c32df7.wgsl.expected.hlsl | 35 +++ .../c32df7.wgsl.expected.msl | 35 +++ .../c32df7.wgsl.expected.spvasm | 92 +++++++ .../c32df7.wgsl.expected.wgsl | 25 ++ .../gen/var/textureSampleLevel/c6aca6.wgsl | 49 ++++ .../c6aca6.wgsl.expected.glsl | 61 +++++ .../c6aca6.wgsl.expected.hlsl | 35 +++ .../c6aca6.wgsl.expected.msl | 35 +++ .../c6aca6.wgsl.expected.spvasm | 92 +++++++ .../c6aca6.wgsl.expected.wgsl | 25 ++ .../gen/var/textureSampleLevel/dcbecb.wgsl | 49 ++++ .../dcbecb.wgsl.expected.glsl | 61 +++++ .../dcbecb.wgsl.expected.hlsl | 35 +++ .../dcbecb.wgsl.expected.msl | 35 +++ .../dcbecb.wgsl.expected.spvasm | 95 +++++++ .../dcbecb.wgsl.expected.wgsl | 25 ++ .../builtins/gen/var/textureStore/05ce15.wgsl | 48 ++++ .../textureStore/05ce15.wgsl.expected.glsl | 58 +++++ .../textureStore/05ce15.wgsl.expected.hlsl | 34 +++ .../var/textureStore/05ce15.wgsl.expected.msl | 35 +++ .../textureStore/05ce15.wgsl.expected.spvasm | 81 ++++++ .../textureStore/05ce15.wgsl.expected.wgsl | 23 ++ .../builtins/gen/var/textureStore/064c7f.wgsl | 48 ++++ .../textureStore/064c7f.wgsl.expected.glsl | 81 ++++++ .../textureStore/064c7f.wgsl.expected.hlsl | 34 +++ .../var/textureStore/064c7f.wgsl.expected.msl | 35 +++ .../textureStore/064c7f.wgsl.expected.spvasm | 82 ++++++ .../textureStore/064c7f.wgsl.expected.wgsl | 23 ++ .../builtins/gen/var/textureStore/068641.wgsl | 48 ++++ .../textureStore/068641.wgsl.expected.glsl | 58 +++++ .../textureStore/068641.wgsl.expected.hlsl | 34 +++ .../var/textureStore/068641.wgsl.expected.msl | 35 +++ .../textureStore/068641.wgsl.expected.spvasm | 84 ++++++ .../textureStore/068641.wgsl.expected.wgsl | 23 ++ .../builtins/gen/var/textureStore/0af6b5.wgsl | 48 ++++ .../textureStore/0af6b5.wgsl.expected.glsl | 58 +++++ .../textureStore/0af6b5.wgsl.expected.hlsl | 34 +++ .../var/textureStore/0af6b5.wgsl.expected.msl | 35 +++ .../textureStore/0af6b5.wgsl.expected.spvasm | 81 ++++++ .../textureStore/0af6b5.wgsl.expected.wgsl | 23 ++ .../builtins/gen/var/textureStore/0c3dff.wgsl | 48 ++++ .../textureStore/0c3dff.wgsl.expected.glsl | 58 +++++ .../textureStore/0c3dff.wgsl.expected.hlsl | 34 +++ .../var/textureStore/0c3dff.wgsl.expected.msl | 35 +++ .../textureStore/0c3dff.wgsl.expected.spvasm | 84 ++++++ .../textureStore/0c3dff.wgsl.expected.wgsl | 23 ++ .../builtins/gen/var/textureStore/102722.wgsl | 48 ++++ .../textureStore/102722.wgsl.expected.glsl | 84 ++++++ .../textureStore/102722.wgsl.expected.hlsl | 34 +++ .../var/textureStore/102722.wgsl.expected.msl | 35 +++ .../textureStore/102722.wgsl.expected.spvasm | 85 ++++++ .../textureStore/102722.wgsl.expected.wgsl | 23 ++ .../builtins/gen/var/textureStore/1bbd08.wgsl | 48 ++++ .../textureStore/1bbd08.wgsl.expected.glsl | 58 +++++ .../textureStore/1bbd08.wgsl.expected.hlsl | 34 +++ .../var/textureStore/1bbd08.wgsl.expected.msl | 35 +++ .../textureStore/1bbd08.wgsl.expected.spvasm | 81 ++++++ .../textureStore/1bbd08.wgsl.expected.wgsl | 23 ++ .../builtins/gen/var/textureStore/1c02e7.wgsl | 49 ++++ .../textureStore/1c02e7.wgsl.expected.glsl | 61 +++++ .../textureStore/1c02e7.wgsl.expected.hlsl | 35 +++ .../var/textureStore/1c02e7.wgsl.expected.msl | 36 +++ .../textureStore/1c02e7.wgsl.expected.spvasm | 94 +++++++ .../textureStore/1c02e7.wgsl.expected.wgsl | 24 ++ .../builtins/gen/var/textureStore/22d955.wgsl | 49 ++++ .../textureStore/22d955.wgsl.expected.glsl | 61 +++++ .../textureStore/22d955.wgsl.expected.hlsl | 35 +++ .../var/textureStore/22d955.wgsl.expected.msl | 36 +++ .../textureStore/22d955.wgsl.expected.spvasm | 95 +++++++ .../textureStore/22d955.wgsl.expected.wgsl | 24 ++ .../builtins/gen/var/textureStore/26bf70.wgsl | 48 ++++ .../textureStore/26bf70.wgsl.expected.glsl | 58 +++++ .../textureStore/26bf70.wgsl.expected.hlsl | 34 +++ .../var/textureStore/26bf70.wgsl.expected.msl | 35 +++ .../textureStore/26bf70.wgsl.expected.spvasm | 84 ++++++ .../textureStore/26bf70.wgsl.expected.wgsl | 23 ++ .../builtins/gen/var/textureStore/2796b4.wgsl | 48 ++++ .../textureStore/2796b4.wgsl.expected.glsl | 81 ++++++ .../textureStore/2796b4.wgsl.expected.hlsl | 34 +++ .../var/textureStore/2796b4.wgsl.expected.msl | 35 +++ .../textureStore/2796b4.wgsl.expected.spvasm | 84 ++++++ .../textureStore/2796b4.wgsl.expected.wgsl | 23 ++ .../builtins/gen/var/textureStore/2ac6c7.wgsl | 48 ++++ .../textureStore/2ac6c7.wgsl.expected.glsl | 84 ++++++ .../textureStore/2ac6c7.wgsl.expected.hlsl | 34 +++ .../var/textureStore/2ac6c7.wgsl.expected.msl | 35 +++ .../textureStore/2ac6c7.wgsl.expected.spvasm | 82 ++++++ .../textureStore/2ac6c7.wgsl.expected.wgsl | 23 ++ .../builtins/gen/var/textureStore/2eb2a4.wgsl | 48 ++++ .../textureStore/2eb2a4.wgsl.expected.glsl | 84 ++++++ .../textureStore/2eb2a4.wgsl.expected.hlsl | 34 +++ .../var/textureStore/2eb2a4.wgsl.expected.msl | 35 +++ .../textureStore/2eb2a4.wgsl.expected.spvasm | 85 ++++++ .../textureStore/2eb2a4.wgsl.expected.wgsl | 23 ++ .../builtins/gen/var/textureStore/2ed2a3.wgsl | 48 ++++ .../textureStore/2ed2a3.wgsl.expected.glsl | 84 ++++++ .../textureStore/2ed2a3.wgsl.expected.hlsl | 34 +++ .../var/textureStore/2ed2a3.wgsl.expected.msl | 35 +++ .../textureStore/2ed2a3.wgsl.expected.spvasm | 82 ++++++ .../textureStore/2ed2a3.wgsl.expected.wgsl | 23 ++ .../builtins/gen/var/textureStore/31745b.wgsl | 48 ++++ .../textureStore/31745b.wgsl.expected.glsl | 81 ++++++ .../textureStore/31745b.wgsl.expected.hlsl | 34 +++ .../var/textureStore/31745b.wgsl.expected.msl | 35 +++ .../textureStore/31745b.wgsl.expected.spvasm | 84 ++++++ .../textureStore/31745b.wgsl.expected.wgsl | 23 ++ .../builtins/gen/var/textureStore/32f368.wgsl | 49 ++++ .../textureStore/32f368.wgsl.expected.glsl | 61 +++++ .../textureStore/32f368.wgsl.expected.hlsl | 35 +++ .../var/textureStore/32f368.wgsl.expected.msl | 36 +++ .../textureStore/32f368.wgsl.expected.spvasm | 92 +++++++ .../textureStore/32f368.wgsl.expected.wgsl | 24 ++ .../builtins/gen/var/textureStore/331aee.wgsl | 48 ++++ .../textureStore/331aee.wgsl.expected.glsl | 58 +++++ .../textureStore/331aee.wgsl.expected.hlsl | 34 +++ .../var/textureStore/331aee.wgsl.expected.msl | 35 +++ .../textureStore/331aee.wgsl.expected.spvasm | 81 ++++++ .../textureStore/331aee.wgsl.expected.wgsl | 23 ++ .../builtins/gen/var/textureStore/38e8d7.wgsl | 49 ++++ .../textureStore/38e8d7.wgsl.expected.glsl | 61 +++++ .../textureStore/38e8d7.wgsl.expected.hlsl | 35 +++ .../var/textureStore/38e8d7.wgsl.expected.msl | 36 +++ .../textureStore/38e8d7.wgsl.expected.spvasm | 95 +++++++ .../textureStore/38e8d7.wgsl.expected.wgsl | 24 ++ .../builtins/gen/var/textureStore/3a52ac.wgsl | 49 ++++ .../textureStore/3a52ac.wgsl.expected.glsl | 61 +++++ .../textureStore/3a52ac.wgsl.expected.hlsl | 35 +++ .../var/textureStore/3a52ac.wgsl.expected.msl | 36 +++ .../textureStore/3a52ac.wgsl.expected.spvasm | 94 +++++++ .../textureStore/3a52ac.wgsl.expected.wgsl | 24 ++ .../builtins/gen/var/textureStore/3bb7a1.wgsl | 49 ++++ .../textureStore/3bb7a1.wgsl.expected.glsl | 61 +++++ .../textureStore/3bb7a1.wgsl.expected.hlsl | 35 +++ .../var/textureStore/3bb7a1.wgsl.expected.msl | 36 +++ .../textureStore/3bb7a1.wgsl.expected.spvasm | 92 +++++++ .../textureStore/3bb7a1.wgsl.expected.wgsl | 24 ++ .../builtins/gen/var/textureStore/3bec15.wgsl | 48 ++++ .../textureStore/3bec15.wgsl.expected.glsl | 84 ++++++ .../textureStore/3bec15.wgsl.expected.hlsl | 34 +++ .../var/textureStore/3bec15.wgsl.expected.msl | 35 +++ .../textureStore/3bec15.wgsl.expected.spvasm | 85 ++++++ .../textureStore/3bec15.wgsl.expected.wgsl | 23 ++ .../builtins/gen/var/textureStore/441ba8.wgsl | 48 ++++ .../textureStore/441ba8.wgsl.expected.glsl | 58 +++++ .../textureStore/441ba8.wgsl.expected.hlsl | 34 +++ .../var/textureStore/441ba8.wgsl.expected.msl | 35 +++ .../textureStore/441ba8.wgsl.expected.spvasm | 84 ++++++ .../textureStore/441ba8.wgsl.expected.wgsl | 23 ++ .../builtins/gen/var/textureStore/4fc057.wgsl | 49 ++++ .../textureStore/4fc057.wgsl.expected.glsl | 61 +++++ .../textureStore/4fc057.wgsl.expected.hlsl | 35 +++ .../var/textureStore/4fc057.wgsl.expected.msl | 36 +++ .../textureStore/4fc057.wgsl.expected.spvasm | 92 +++++++ .../textureStore/4fc057.wgsl.expected.wgsl | 24 ++ .../builtins/gen/var/textureStore/5a2f8f.wgsl | 48 ++++ .../textureStore/5a2f8f.wgsl.expected.glsl | 84 ++++++ .../textureStore/5a2f8f.wgsl.expected.hlsl | 34 +++ .../var/textureStore/5a2f8f.wgsl.expected.msl | 35 +++ .../textureStore/5a2f8f.wgsl.expected.spvasm | 84 ++++++ .../textureStore/5a2f8f.wgsl.expected.wgsl | 23 ++ .../builtins/gen/var/textureStore/60975f.wgsl | 49 ++++ .../textureStore/60975f.wgsl.expected.glsl | 61 +++++ .../textureStore/60975f.wgsl.expected.hlsl | 35 +++ .../var/textureStore/60975f.wgsl.expected.msl | 36 +++ .../textureStore/60975f.wgsl.expected.spvasm | 92 +++++++ .../textureStore/60975f.wgsl.expected.wgsl | 24 ++ .../builtins/gen/var/textureStore/682fd6.wgsl | 48 ++++ .../textureStore/682fd6.wgsl.expected.glsl | 81 ++++++ .../textureStore/682fd6.wgsl.expected.hlsl | 34 +++ .../var/textureStore/682fd6.wgsl.expected.msl | 35 +++ .../textureStore/682fd6.wgsl.expected.spvasm | 85 ++++++ .../textureStore/682fd6.wgsl.expected.wgsl | 23 ++ .../builtins/gen/var/textureStore/6b75c3.wgsl | 48 ++++ .../textureStore/6b75c3.wgsl.expected.glsl | 84 ++++++ .../textureStore/6b75c3.wgsl.expected.hlsl | 34 +++ .../var/textureStore/6b75c3.wgsl.expected.msl | 35 +++ .../textureStore/6b75c3.wgsl.expected.spvasm | 82 ++++++ .../textureStore/6b75c3.wgsl.expected.wgsl | 23 ++ .../builtins/gen/var/textureStore/6b80d2.wgsl | 48 ++++ .../textureStore/6b80d2.wgsl.expected.glsl | 84 ++++++ .../textureStore/6b80d2.wgsl.expected.hlsl | 34 +++ .../var/textureStore/6b80d2.wgsl.expected.msl | 35 +++ .../textureStore/6b80d2.wgsl.expected.spvasm | 84 ++++++ .../textureStore/6b80d2.wgsl.expected.wgsl | 23 ++ .../builtins/gen/var/textureStore/6cff2e.wgsl | 48 ++++ .../textureStore/6cff2e.wgsl.expected.glsl | 58 +++++ .../textureStore/6cff2e.wgsl.expected.hlsl | 34 +++ .../var/textureStore/6cff2e.wgsl.expected.msl | 35 +++ .../textureStore/6cff2e.wgsl.expected.spvasm | 84 ++++++ .../textureStore/6cff2e.wgsl.expected.wgsl | 23 ++ .../builtins/gen/var/textureStore/6da692.wgsl | 49 ++++ .../textureStore/6da692.wgsl.expected.glsl | 61 +++++ .../textureStore/6da692.wgsl.expected.hlsl | 35 +++ .../var/textureStore/6da692.wgsl.expected.msl | 36 +++ .../textureStore/6da692.wgsl.expected.spvasm | 95 +++++++ .../textureStore/6da692.wgsl.expected.wgsl | 24 ++ .../builtins/gen/var/textureStore/731349.wgsl | 48 ++++ .../textureStore/731349.wgsl.expected.glsl | 58 +++++ .../textureStore/731349.wgsl.expected.hlsl | 34 +++ .../var/textureStore/731349.wgsl.expected.msl | 35 +++ .../textureStore/731349.wgsl.expected.spvasm | 81 ++++++ .../textureStore/731349.wgsl.expected.wgsl | 23 ++ .../builtins/gen/var/textureStore/752da6.wgsl | 48 ++++ .../textureStore/752da6.wgsl.expected.glsl | 58 +++++ .../textureStore/752da6.wgsl.expected.hlsl | 34 +++ .../var/textureStore/752da6.wgsl.expected.msl | 35 +++ .../textureStore/752da6.wgsl.expected.spvasm | 83 ++++++ .../textureStore/752da6.wgsl.expected.wgsl | 23 ++ .../builtins/gen/var/textureStore/77c0ae.wgsl | 48 ++++ .../textureStore/77c0ae.wgsl.expected.glsl | 58 +++++ .../textureStore/77c0ae.wgsl.expected.hlsl | 34 +++ .../var/textureStore/77c0ae.wgsl.expected.msl | 35 +++ .../textureStore/77c0ae.wgsl.expected.spvasm | 84 ++++++ .../textureStore/77c0ae.wgsl.expected.wgsl | 23 ++ .../builtins/gen/var/textureStore/7cec8d.wgsl | 49 ++++ .../textureStore/7cec8d.wgsl.expected.glsl | 61 +++++ .../textureStore/7cec8d.wgsl.expected.hlsl | 35 +++ .../var/textureStore/7cec8d.wgsl.expected.msl | 36 +++ .../textureStore/7cec8d.wgsl.expected.spvasm | 94 +++++++ .../textureStore/7cec8d.wgsl.expected.wgsl | 24 ++ .../builtins/gen/var/textureStore/7f7fae.wgsl | 48 ++++ .../textureStore/7f7fae.wgsl.expected.glsl | 84 ++++++ .../textureStore/7f7fae.wgsl.expected.hlsl | 34 +++ .../var/textureStore/7f7fae.wgsl.expected.msl | 35 +++ .../textureStore/7f7fae.wgsl.expected.spvasm | 82 ++++++ .../textureStore/7f7fae.wgsl.expected.wgsl | 23 ++ .../builtins/gen/var/textureStore/804942.wgsl | 48 ++++ .../textureStore/804942.wgsl.expected.glsl | 58 +++++ .../textureStore/804942.wgsl.expected.hlsl | 34 +++ .../var/textureStore/804942.wgsl.expected.msl | 35 +++ .../textureStore/804942.wgsl.expected.spvasm | 83 ++++++ .../textureStore/804942.wgsl.expected.wgsl | 23 ++ .../builtins/gen/var/textureStore/805dae.wgsl | 48 ++++ .../textureStore/805dae.wgsl.expected.glsl | 58 +++++ .../textureStore/805dae.wgsl.expected.hlsl | 34 +++ .../var/textureStore/805dae.wgsl.expected.msl | 35 +++ .../textureStore/805dae.wgsl.expected.spvasm | 81 ++++++ .../textureStore/805dae.wgsl.expected.wgsl | 23 ++ .../builtins/gen/var/textureStore/83bcc1.wgsl | 48 ++++ .../textureStore/83bcc1.wgsl.expected.glsl | 81 ++++++ .../textureStore/83bcc1.wgsl.expected.hlsl | 34 +++ .../var/textureStore/83bcc1.wgsl.expected.msl | 35 +++ .../textureStore/83bcc1.wgsl.expected.spvasm | 86 +++++++ .../textureStore/83bcc1.wgsl.expected.wgsl | 23 ++ .../builtins/gen/var/textureStore/872747.wgsl | 48 ++++ .../textureStore/872747.wgsl.expected.glsl | 81 ++++++ .../textureStore/872747.wgsl.expected.hlsl | 34 +++ .../var/textureStore/872747.wgsl.expected.msl | 35 +++ .../textureStore/872747.wgsl.expected.spvasm | 83 ++++++ .../textureStore/872747.wgsl.expected.wgsl | 23 ++ .../builtins/gen/var/textureStore/8e0479.wgsl | 49 ++++ .../textureStore/8e0479.wgsl.expected.glsl | 61 +++++ .../textureStore/8e0479.wgsl.expected.hlsl | 35 +++ .../var/textureStore/8e0479.wgsl.expected.msl | 36 +++ .../textureStore/8e0479.wgsl.expected.spvasm | 95 +++++++ .../textureStore/8e0479.wgsl.expected.wgsl | 24 ++ .../builtins/gen/var/textureStore/8f71a1.wgsl | 48 ++++ .../textureStore/8f71a1.wgsl.expected.glsl | 58 +++++ .../textureStore/8f71a1.wgsl.expected.hlsl | 34 +++ .../var/textureStore/8f71a1.wgsl.expected.msl | 35 +++ .../textureStore/8f71a1.wgsl.expected.spvasm | 83 ++++++ .../textureStore/8f71a1.wgsl.expected.wgsl | 23 ++ .../builtins/gen/var/textureStore/969534.wgsl | 48 ++++ .../textureStore/969534.wgsl.expected.glsl | 84 ++++++ .../textureStore/969534.wgsl.expected.hlsl | 34 +++ .../var/textureStore/969534.wgsl.expected.msl | 35 +++ .../textureStore/969534.wgsl.expected.spvasm | 84 ++++++ .../textureStore/969534.wgsl.expected.wgsl | 23 ++ .../builtins/gen/var/textureStore/9a3ecc.wgsl | 48 ++++ .../textureStore/9a3ecc.wgsl.expected.glsl | 58 +++++ .../textureStore/9a3ecc.wgsl.expected.hlsl | 34 +++ .../var/textureStore/9a3ecc.wgsl.expected.msl | 35 +++ .../textureStore/9a3ecc.wgsl.expected.spvasm | 83 ++++++ .../textureStore/9a3ecc.wgsl.expected.wgsl | 23 ++ .../builtins/gen/var/textureStore/9d9cd5.wgsl | 49 ++++ .../textureStore/9d9cd5.wgsl.expected.glsl | 61 +++++ .../textureStore/9d9cd5.wgsl.expected.hlsl | 35 +++ .../var/textureStore/9d9cd5.wgsl.expected.msl | 36 +++ .../textureStore/9d9cd5.wgsl.expected.spvasm | 92 +++++++ .../textureStore/9d9cd5.wgsl.expected.wgsl | 24 ++ .../builtins/gen/var/textureStore/9e3ec5.wgsl | 48 ++++ .../textureStore/9e3ec5.wgsl.expected.glsl | 58 +++++ .../textureStore/9e3ec5.wgsl.expected.hlsl | 34 +++ .../var/textureStore/9e3ec5.wgsl.expected.msl | 35 +++ .../textureStore/9e3ec5.wgsl.expected.spvasm | 83 ++++++ .../textureStore/9e3ec5.wgsl.expected.wgsl | 23 ++ .../builtins/gen/var/textureStore/ac67aa.wgsl | 48 ++++ .../textureStore/ac67aa.wgsl.expected.glsl | 81 ++++++ .../textureStore/ac67aa.wgsl.expected.hlsl | 34 +++ .../var/textureStore/ac67aa.wgsl.expected.msl | 35 +++ .../textureStore/ac67aa.wgsl.expected.spvasm | 85 ++++++ .../textureStore/ac67aa.wgsl.expected.wgsl | 23 ++ .../builtins/gen/var/textureStore/b706b1.wgsl | 48 ++++ .../textureStore/b706b1.wgsl.expected.glsl | 58 +++++ .../textureStore/b706b1.wgsl.expected.hlsl | 34 +++ .../var/textureStore/b706b1.wgsl.expected.msl | 35 +++ .../textureStore/b706b1.wgsl.expected.spvasm | 83 ++++++ .../textureStore/b706b1.wgsl.expected.wgsl | 23 ++ .../builtins/gen/var/textureStore/bbcb7f.wgsl | 48 ++++ .../textureStore/bbcb7f.wgsl.expected.glsl | 58 +++++ .../textureStore/bbcb7f.wgsl.expected.hlsl | 34 +++ .../var/textureStore/bbcb7f.wgsl.expected.msl | 35 +++ .../textureStore/bbcb7f.wgsl.expected.spvasm | 83 ++++++ .../textureStore/bbcb7f.wgsl.expected.wgsl | 23 ++ .../builtins/gen/var/textureStore/be6e30.wgsl | 48 ++++ .../textureStore/be6e30.wgsl.expected.glsl | 58 +++++ .../textureStore/be6e30.wgsl.expected.hlsl | 34 +++ .../var/textureStore/be6e30.wgsl.expected.msl | 35 +++ .../textureStore/be6e30.wgsl.expected.spvasm | 81 ++++++ .../textureStore/be6e30.wgsl.expected.wgsl | 23 ++ .../builtins/gen/var/textureStore/bf775c.wgsl | 48 ++++ .../textureStore/bf775c.wgsl.expected.glsl | 84 ++++++ .../textureStore/bf775c.wgsl.expected.hlsl | 34 +++ .../var/textureStore/bf775c.wgsl.expected.msl | 35 +++ .../textureStore/bf775c.wgsl.expected.spvasm | 84 ++++++ .../textureStore/bf775c.wgsl.expected.wgsl | 23 ++ .../builtins/gen/var/textureStore/c5af1e.wgsl | 48 ++++ .../textureStore/c5af1e.wgsl.expected.glsl | 58 +++++ .../textureStore/c5af1e.wgsl.expected.hlsl | 34 +++ .../var/textureStore/c5af1e.wgsl.expected.msl | 35 +++ .../textureStore/c5af1e.wgsl.expected.spvasm | 81 ++++++ .../textureStore/c5af1e.wgsl.expected.wgsl | 23 ++ .../builtins/gen/var/textureStore/c863be.wgsl | 49 ++++ .../textureStore/c863be.wgsl.expected.glsl | 84 ++++++ .../textureStore/c863be.wgsl.expected.hlsl | 35 +++ .../var/textureStore/c863be.wgsl.expected.msl | 36 +++ .../textureStore/c863be.wgsl.expected.spvasm | 93 +++++++ .../textureStore/c863be.wgsl.expected.wgsl | 24 ++ .../builtins/gen/var/textureStore/d73b5c.wgsl | 48 ++++ .../textureStore/d73b5c.wgsl.expected.glsl | 81 ++++++ .../textureStore/d73b5c.wgsl.expected.hlsl | 34 +++ .../var/textureStore/d73b5c.wgsl.expected.msl | 35 +++ .../textureStore/d73b5c.wgsl.expected.spvasm | 85 ++++++ .../textureStore/d73b5c.wgsl.expected.wgsl | 23 ++ .../builtins/gen/var/textureStore/dd7d81.wgsl | 48 ++++ .../textureStore/dd7d81.wgsl.expected.glsl | 58 +++++ .../textureStore/dd7d81.wgsl.expected.hlsl | 34 +++ .../var/textureStore/dd7d81.wgsl.expected.msl | 35 +++ .../textureStore/dd7d81.wgsl.expected.spvasm | 81 ++++++ .../textureStore/dd7d81.wgsl.expected.wgsl | 23 ++ .../builtins/gen/var/textureStore/dde364.wgsl | 49 ++++ .../textureStore/dde364.wgsl.expected.glsl | 84 ++++++ .../textureStore/dde364.wgsl.expected.hlsl | 35 +++ .../var/textureStore/dde364.wgsl.expected.msl | 36 +++ .../textureStore/dde364.wgsl.expected.spvasm | 96 +++++++ .../textureStore/dde364.wgsl.expected.wgsl | 24 ++ .../builtins/gen/var/textureStore/e885e8.wgsl | 48 ++++ .../textureStore/e885e8.wgsl.expected.glsl | 84 ++++++ .../textureStore/e885e8.wgsl.expected.hlsl | 34 +++ .../var/textureStore/e885e8.wgsl.expected.msl | 35 +++ .../textureStore/e885e8.wgsl.expected.spvasm | 82 ++++++ .../textureStore/e885e8.wgsl.expected.wgsl | 23 ++ .../builtins/gen/var/textureStore/eb702f.wgsl | 48 ++++ .../textureStore/eb702f.wgsl.expected.glsl | 58 +++++ .../textureStore/eb702f.wgsl.expected.hlsl | 34 +++ .../var/textureStore/eb702f.wgsl.expected.msl | 35 +++ .../textureStore/eb702f.wgsl.expected.spvasm | 81 ++++++ .../textureStore/eb702f.wgsl.expected.wgsl | 23 ++ .../builtins/gen/var/textureStore/eb78b9.wgsl | 48 ++++ .../textureStore/eb78b9.wgsl.expected.glsl | 58 +++++ .../textureStore/eb78b9.wgsl.expected.hlsl | 34 +++ .../var/textureStore/eb78b9.wgsl.expected.msl | 35 +++ .../textureStore/eb78b9.wgsl.expected.spvasm | 83 ++++++ .../textureStore/eb78b9.wgsl.expected.wgsl | 23 ++ .../builtins/gen/var/textureStore/ee6acc.wgsl | 48 ++++ .../textureStore/ee6acc.wgsl.expected.glsl | 81 ++++++ .../textureStore/ee6acc.wgsl.expected.hlsl | 34 +++ .../var/textureStore/ee6acc.wgsl.expected.msl | 35 +++ .../textureStore/ee6acc.wgsl.expected.spvasm | 82 ++++++ .../textureStore/ee6acc.wgsl.expected.wgsl | 23 ++ .../builtins/gen/var/textureStore/ef9f2f.wgsl | 48 ++++ .../textureStore/ef9f2f.wgsl.expected.glsl | 58 +++++ .../textureStore/ef9f2f.wgsl.expected.hlsl | 34 +++ .../var/textureStore/ef9f2f.wgsl.expected.msl | 35 +++ .../textureStore/ef9f2f.wgsl.expected.spvasm | 84 ++++++ .../textureStore/ef9f2f.wgsl.expected.wgsl | 23 ++ .../builtins/gen/var/textureStore/f8dead.wgsl | 48 ++++ .../textureStore/f8dead.wgsl.expected.glsl | 58 +++++ .../textureStore/f8dead.wgsl.expected.hlsl | 34 +++ .../var/textureStore/f8dead.wgsl.expected.msl | 35 +++ .../textureStore/f8dead.wgsl.expected.spvasm | 84 ++++++ .../textureStore/f8dead.wgsl.expected.wgsl | 23 ++ .../builtins/gen/var/textureStore/f9be83.wgsl | 49 ++++ .../textureStore/f9be83.wgsl.expected.glsl | 84 ++++++ .../textureStore/f9be83.wgsl.expected.hlsl | 35 +++ .../var/textureStore/f9be83.wgsl.expected.msl | 36 +++ .../textureStore/f9be83.wgsl.expected.spvasm | 95 +++++++ .../textureStore/f9be83.wgsl.expected.wgsl | 24 ++ .../builtins/gen/var/textureStore/fb9a8f.wgsl | 48 ++++ .../textureStore/fb9a8f.wgsl.expected.glsl | 84 ++++++ .../textureStore/fb9a8f.wgsl.expected.hlsl | 34 +++ .../var/textureStore/fb9a8f.wgsl.expected.msl | 35 +++ .../textureStore/fb9a8f.wgsl.expected.spvasm | 85 ++++++ .../textureStore/fb9a8f.wgsl.expected.wgsl | 23 ++ .../builtins/gen/var/textureStore/fbf53f.wgsl | 49 ++++ .../textureStore/fbf53f.wgsl.expected.glsl | 61 +++++ .../textureStore/fbf53f.wgsl.expected.hlsl | 35 +++ .../var/textureStore/fbf53f.wgsl.expected.msl | 36 +++ .../textureStore/fbf53f.wgsl.expected.spvasm | 94 +++++++ .../textureStore/fbf53f.wgsl.expected.wgsl | 24 ++ .../builtins/gen/var/transpose/2585cd.wgsl | 46 ++++ .../var/transpose/2585cd.wgsl.expected.glsl | 52 ++++ .../var/transpose/2585cd.wgsl.expected.hlsl | 31 +++ .../var/transpose/2585cd.wgsl.expected.msl | 34 +++ .../var/transpose/2585cd.wgsl.expected.spvasm | 74 ++++++ .../var/transpose/2585cd.wgsl.expected.wgsl | 20 ++ .../builtins/gen/var/transpose/31d679.wgsl | 46 ++++ .../var/transpose/31d679.wgsl.expected.glsl | 52 ++++ .../var/transpose/31d679.wgsl.expected.hlsl | 31 +++ .../var/transpose/31d679.wgsl.expected.msl | 34 +++ .../var/transpose/31d679.wgsl.expected.spvasm | 71 +++++ .../var/transpose/31d679.wgsl.expected.wgsl | 20 ++ .../builtins/gen/var/transpose/31e37e.wgsl | 46 ++++ .../var/transpose/31e37e.wgsl.expected.glsl | 52 ++++ .../var/transpose/31e37e.wgsl.expected.hlsl | 31 +++ .../var/transpose/31e37e.wgsl.expected.msl | 34 +++ .../var/transpose/31e37e.wgsl.expected.spvasm | 74 ++++++ .../var/transpose/31e37e.wgsl.expected.wgsl | 20 ++ .../builtins/gen/var/transpose/4ce359.wgsl | 46 ++++ .../var/transpose/4ce359.wgsl.expected.glsl | 52 ++++ .../var/transpose/4ce359.wgsl.expected.hlsl | 31 +++ .../var/transpose/4ce359.wgsl.expected.msl | 34 +++ .../var/transpose/4ce359.wgsl.expected.spvasm | 74 ++++++ .../var/transpose/4ce359.wgsl.expected.wgsl | 20 ++ .../builtins/gen/var/transpose/4dc9a1.wgsl | 46 ++++ .../var/transpose/4dc9a1.wgsl.expected.glsl | 52 ++++ .../var/transpose/4dc9a1.wgsl.expected.hlsl | 31 +++ .../var/transpose/4dc9a1.wgsl.expected.msl | 34 +++ .../var/transpose/4dc9a1.wgsl.expected.spvasm | 75 ++++++ .../var/transpose/4dc9a1.wgsl.expected.wgsl | 20 ++ .../builtins/gen/var/transpose/854336.wgsl | 46 ++++ .../var/transpose/854336.wgsl.expected.glsl | 52 ++++ .../var/transpose/854336.wgsl.expected.hlsl | 31 +++ .../var/transpose/854336.wgsl.expected.msl | 34 +++ .../var/transpose/854336.wgsl.expected.spvasm | 71 +++++ .../var/transpose/854336.wgsl.expected.wgsl | 20 ++ .../builtins/gen/var/transpose/c1b600.wgsl | 46 ++++ .../var/transpose/c1b600.wgsl.expected.glsl | 52 ++++ .../var/transpose/c1b600.wgsl.expected.hlsl | 31 +++ .../var/transpose/c1b600.wgsl.expected.msl | 34 +++ .../var/transpose/c1b600.wgsl.expected.spvasm | 70 +++++ .../var/transpose/c1b600.wgsl.expected.wgsl | 20 ++ .../builtins/gen/var/transpose/d8f8ba.wgsl | 46 ++++ .../var/transpose/d8f8ba.wgsl.expected.glsl | 52 ++++ .../var/transpose/d8f8ba.wgsl.expected.hlsl | 31 +++ .../var/transpose/d8f8ba.wgsl.expected.msl | 34 +++ .../var/transpose/d8f8ba.wgsl.expected.spvasm | 74 ++++++ .../var/transpose/d8f8ba.wgsl.expected.wgsl | 20 ++ .../builtins/gen/var/transpose/ed4bdc.wgsl | 46 ++++ .../var/transpose/ed4bdc.wgsl.expected.glsl | 52 ++++ .../var/transpose/ed4bdc.wgsl.expected.hlsl | 31 +++ .../var/transpose/ed4bdc.wgsl.expected.msl | 34 +++ .../var/transpose/ed4bdc.wgsl.expected.spvasm | 75 ++++++ .../var/transpose/ed4bdc.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/trunc/562d05.wgsl | 46 ++++ .../gen/var/trunc/562d05.wgsl.expected.glsl | 52 ++++ .../gen/var/trunc/562d05.wgsl.expected.hlsl | 31 +++ .../gen/var/trunc/562d05.wgsl.expected.msl | 34 +++ .../gen/var/trunc/562d05.wgsl.expected.spvasm | 71 +++++ .../gen/var/trunc/562d05.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/trunc/e183aa.wgsl | 46 ++++ .../gen/var/trunc/e183aa.wgsl.expected.glsl | 52 ++++ .../gen/var/trunc/e183aa.wgsl.expected.hlsl | 31 +++ .../gen/var/trunc/e183aa.wgsl.expected.msl | 34 +++ .../gen/var/trunc/e183aa.wgsl.expected.spvasm | 69 +++++ .../gen/var/trunc/e183aa.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/trunc/eb83df.wgsl | 46 ++++ .../gen/var/trunc/eb83df.wgsl.expected.glsl | 52 ++++ .../gen/var/trunc/eb83df.wgsl.expected.hlsl | 31 +++ .../gen/var/trunc/eb83df.wgsl.expected.msl | 34 +++ .../gen/var/trunc/eb83df.wgsl.expected.spvasm | 69 +++++ .../gen/var/trunc/eb83df.wgsl.expected.wgsl | 20 ++ test/tint/builtins/gen/var/trunc/f370d3.wgsl | 46 ++++ .../gen/var/trunc/f370d3.wgsl.expected.glsl | 52 ++++ .../gen/var/trunc/f370d3.wgsl.expected.hlsl | 31 +++ .../gen/var/trunc/f370d3.wgsl.expected.msl | 34 +++ .../gen/var/trunc/f370d3.wgsl.expected.spvasm | 71 +++++ .../gen/var/trunc/f370d3.wgsl.expected.wgsl | 20 ++ .../gen/var/unpack2x16float/32a5cf.wgsl | 46 ++++ .../unpack2x16float/32a5cf.wgsl.expected.glsl | 52 ++++ .../unpack2x16float/32a5cf.wgsl.expected.hlsl | 36 +++ .../unpack2x16float/32a5cf.wgsl.expected.msl | 34 +++ .../32a5cf.wgsl.expected.spvasm | 75 ++++++ .../unpack2x16float/32a5cf.wgsl.expected.wgsl | 20 ++ .../gen/var/unpack2x16snorm/b4aea6.wgsl | 46 ++++ .../unpack2x16snorm/b4aea6.wgsl.expected.glsl | 52 ++++ .../unpack2x16snorm/b4aea6.wgsl.expected.hlsl | 37 +++ .../unpack2x16snorm/b4aea6.wgsl.expected.msl | 34 +++ .../b4aea6.wgsl.expected.spvasm | 75 ++++++ .../unpack2x16snorm/b4aea6.wgsl.expected.wgsl | 20 ++ .../gen/var/unpack2x16unorm/7699c0.wgsl | 46 ++++ .../unpack2x16unorm/7699c0.wgsl.expected.glsl | 52 ++++ .../unpack2x16unorm/7699c0.wgsl.expected.hlsl | 37 +++ .../unpack2x16unorm/7699c0.wgsl.expected.msl | 34 +++ .../7699c0.wgsl.expected.spvasm | 75 ++++++ .../unpack2x16unorm/7699c0.wgsl.expected.wgsl | 20 ++ .../gen/var/unpack4x8snorm/523fb3.wgsl | 46 ++++ .../unpack4x8snorm/523fb3.wgsl.expected.glsl | 52 ++++ .../unpack4x8snorm/523fb3.wgsl.expected.hlsl | 37 +++ .../unpack4x8snorm/523fb3.wgsl.expected.msl | 34 +++ .../523fb3.wgsl.expected.spvasm | 73 ++++++ .../unpack4x8snorm/523fb3.wgsl.expected.wgsl | 20 ++ .../gen/var/unpack4x8unorm/750c74.wgsl | 46 ++++ .../unpack4x8unorm/750c74.wgsl.expected.glsl | 52 ++++ .../unpack4x8unorm/750c74.wgsl.expected.hlsl | 37 +++ .../unpack4x8unorm/750c74.wgsl.expected.msl | 34 +++ .../750c74.wgsl.expected.spvasm | 73 ++++++ .../unpack4x8unorm/750c74.wgsl.expected.wgsl | 20 ++ .../gen/var/workgroupBarrier/a17f7f.wgsl | 34 +++ .../a17f7f.wgsl.expected.glsl | 15 ++ .../a17f7f.wgsl.expected.hlsl | 9 + .../workgroupBarrier/a17f7f.wgsl.expected.msl | 12 + .../a17f7f.wgsl.expected.spvasm | 26 ++ .../a17f7f.wgsl.expected.wgsl | 8 + tools/src/cmd/intrinsic-gen/ast/ast.go | 17 +- tools/src/cmd/intrinsic-gen/gen/permutate.go | 5 +- tools/src/cmd/intrinsic-gen/parser/parser.go | 13 +- .../cmd/intrinsic-gen/parser/parser_test.go | 14 + .../src/cmd/intrinsic-gen/resolver/resolve.go | 12 +- tools/src/cmd/intrinsic-gen/sem/sem.go | 8 +- 5031 files changed, 211402 insertions(+), 10539 deletions(-) delete mode 100644 test/tint/builtins/gen/literal/textureGather/01305f.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/01305f.wgsl.expected.glsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/01305f.wgsl.expected.hlsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/01305f.wgsl.expected.msl delete mode 100644 test/tint/builtins/gen/literal/textureGather/01305f.wgsl.expected.spvasm delete mode 100644 test/tint/builtins/gen/literal/textureGather/01305f.wgsl.expected.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/06030a.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/06030a.wgsl.expected.glsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/06030a.wgsl.expected.hlsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/06030a.wgsl.expected.msl delete mode 100644 test/tint/builtins/gen/literal/textureGather/06030a.wgsl.expected.spvasm delete mode 100644 test/tint/builtins/gen/literal/textureGather/06030a.wgsl.expected.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/15d79c.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/15d79c.wgsl.expected.glsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/15d79c.wgsl.expected.hlsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/15d79c.wgsl.expected.msl delete mode 100644 test/tint/builtins/gen/literal/textureGather/15d79c.wgsl.expected.spvasm delete mode 100644 test/tint/builtins/gen/literal/textureGather/15d79c.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/literal/textureGather/1f7f6b.wgsl create mode 100644 test/tint/builtins/gen/literal/textureGather/1f7f6b.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/literal/textureGather/1f7f6b.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/literal/textureGather/1f7f6b.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/literal/textureGather/1f7f6b.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/literal/textureGather/1f7f6b.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/literal/textureGather/22e930.wgsl create mode 100644 test/tint/builtins/gen/literal/textureGather/22e930.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/literal/textureGather/22e930.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/literal/textureGather/22e930.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/literal/textureGather/22e930.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/literal/textureGather/22e930.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/literal/textureGather/2cc066.wgsl create mode 100644 test/tint/builtins/gen/literal/textureGather/2cc066.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/literal/textureGather/2cc066.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/literal/textureGather/2cc066.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/literal/textureGather/2cc066.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/literal/textureGather/2cc066.wgsl.expected.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/3112e8.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/3112e8.wgsl.expected.glsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/3112e8.wgsl.expected.hlsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/3112e8.wgsl.expected.msl delete mode 100644 test/tint/builtins/gen/literal/textureGather/3112e8.wgsl.expected.spvasm delete mode 100644 test/tint/builtins/gen/literal/textureGather/3112e8.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/literal/textureGather/32c4e8.wgsl create mode 100644 test/tint/builtins/gen/literal/textureGather/32c4e8.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/literal/textureGather/32c4e8.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/literal/textureGather/32c4e8.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/literal/textureGather/32c4e8.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/literal/textureGather/32c4e8.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/literal/textureGather/3b32cc.wgsl create mode 100644 test/tint/builtins/gen/literal/textureGather/3b32cc.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/literal/textureGather/3b32cc.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/literal/textureGather/3b32cc.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/literal/textureGather/3b32cc.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/literal/textureGather/3b32cc.wgsl.expected.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/3c527e.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/3c527e.wgsl.expected.glsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/3c527e.wgsl.expected.hlsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/3c527e.wgsl.expected.msl delete mode 100644 test/tint/builtins/gen/literal/textureGather/3c527e.wgsl.expected.spvasm delete mode 100644 test/tint/builtins/gen/literal/textureGather/3c527e.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/literal/textureGather/49b07f.wgsl create mode 100644 test/tint/builtins/gen/literal/textureGather/49b07f.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/literal/textureGather/49b07f.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/literal/textureGather/49b07f.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/literal/textureGather/49b07f.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/literal/textureGather/49b07f.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/literal/textureGather/4b8103.wgsl create mode 100644 test/tint/builtins/gen/literal/textureGather/4b8103.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/literal/textureGather/4b8103.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/literal/textureGather/4b8103.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/literal/textureGather/4b8103.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/literal/textureGather/4b8103.wgsl.expected.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/4f2350.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/4f2350.wgsl.expected.glsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/4f2350.wgsl.expected.hlsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/4f2350.wgsl.expected.msl delete mode 100644 test/tint/builtins/gen/literal/textureGather/4f2350.wgsl.expected.spvasm delete mode 100644 test/tint/builtins/gen/literal/textureGather/4f2350.wgsl.expected.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/51cf0b.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/51cf0b.wgsl.expected.glsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/51cf0b.wgsl.expected.hlsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/51cf0b.wgsl.expected.msl delete mode 100644 test/tint/builtins/gen/literal/textureGather/51cf0b.wgsl.expected.spvasm delete mode 100644 test/tint/builtins/gen/literal/textureGather/51cf0b.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/literal/textureGather/5266da.wgsl create mode 100644 test/tint/builtins/gen/literal/textureGather/5266da.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/literal/textureGather/5266da.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/literal/textureGather/5266da.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/literal/textureGather/5266da.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/literal/textureGather/5266da.wgsl.expected.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/53ece6.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/53ece6.wgsl.expected.glsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/53ece6.wgsl.expected.hlsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/53ece6.wgsl.expected.msl delete mode 100644 test/tint/builtins/gen/literal/textureGather/53ece6.wgsl.expected.spvasm delete mode 100644 test/tint/builtins/gen/literal/textureGather/53ece6.wgsl.expected.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/57bfc6.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/57bfc6.wgsl.expected.glsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/57bfc6.wgsl.expected.hlsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/57bfc6.wgsl.expected.msl delete mode 100644 test/tint/builtins/gen/literal/textureGather/57bfc6.wgsl.expected.spvasm delete mode 100644 test/tint/builtins/gen/literal/textureGather/57bfc6.wgsl.expected.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/587ba3.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/587ba3.wgsl.expected.glsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/587ba3.wgsl.expected.hlsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/587ba3.wgsl.expected.msl delete mode 100644 test/tint/builtins/gen/literal/textureGather/587ba3.wgsl.expected.spvasm delete mode 100644 test/tint/builtins/gen/literal/textureGather/587ba3.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/literal/textureGather/5ba85f.wgsl create mode 100644 test/tint/builtins/gen/literal/textureGather/5ba85f.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/literal/textureGather/5ba85f.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/literal/textureGather/5ba85f.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/literal/textureGather/5ba85f.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/literal/textureGather/5ba85f.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/literal/textureGather/5bd491.wgsl create mode 100644 test/tint/builtins/gen/literal/textureGather/5bd491.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/literal/textureGather/5bd491.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/literal/textureGather/5bd491.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/literal/textureGather/5bd491.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/literal/textureGather/5bd491.wgsl.expected.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/69e0fb.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/69e0fb.wgsl.expected.glsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/69e0fb.wgsl.expected.hlsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/69e0fb.wgsl.expected.msl delete mode 100644 test/tint/builtins/gen/literal/textureGather/69e0fb.wgsl.expected.spvasm delete mode 100644 test/tint/builtins/gen/literal/textureGather/69e0fb.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/literal/textureGather/751f8a.wgsl create mode 100644 test/tint/builtins/gen/literal/textureGather/751f8a.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/literal/textureGather/751f8a.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/literal/textureGather/751f8a.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/literal/textureGather/751f8a.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/literal/textureGather/751f8a.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/literal/textureGather/7c3828.wgsl create mode 100644 test/tint/builtins/gen/literal/textureGather/7c3828.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/literal/textureGather/7c3828.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/literal/textureGather/7c3828.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/literal/textureGather/7c3828.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/literal/textureGather/7c3828.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/literal/textureGather/8b754c.wgsl create mode 100644 test/tint/builtins/gen/literal/textureGather/8b754c.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/literal/textureGather/8b754c.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/literal/textureGather/8b754c.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/literal/textureGather/8b754c.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/literal/textureGather/8b754c.wgsl.expected.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/93003d.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/93003d.wgsl.expected.glsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/93003d.wgsl.expected.hlsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/93003d.wgsl.expected.msl delete mode 100644 test/tint/builtins/gen/literal/textureGather/93003d.wgsl.expected.spvasm delete mode 100644 test/tint/builtins/gen/literal/textureGather/93003d.wgsl.expected.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/9efca2.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/9efca2.wgsl.expected.glsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/9efca2.wgsl.expected.hlsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/9efca2.wgsl.expected.msl delete mode 100644 test/tint/builtins/gen/literal/textureGather/9efca2.wgsl.expected.spvasm delete mode 100644 test/tint/builtins/gen/literal/textureGather/9efca2.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/literal/textureGather/af55b3.wgsl create mode 100644 test/tint/builtins/gen/literal/textureGather/af55b3.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/literal/textureGather/af55b3.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/literal/textureGather/af55b3.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/literal/textureGather/af55b3.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/literal/textureGather/af55b3.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/literal/textureGather/bb3ac5.wgsl create mode 100644 test/tint/builtins/gen/literal/textureGather/bb3ac5.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/literal/textureGather/bb3ac5.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/literal/textureGather/bb3ac5.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/literal/textureGather/bb3ac5.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/literal/textureGather/bb3ac5.wgsl.expected.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/bd0b1e.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/bd0b1e.wgsl.expected.glsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/bd0b1e.wgsl.expected.hlsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/bd0b1e.wgsl.expected.msl delete mode 100644 test/tint/builtins/gen/literal/textureGather/bd0b1e.wgsl.expected.spvasm delete mode 100644 test/tint/builtins/gen/literal/textureGather/bd0b1e.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/literal/textureGather/c0640c.wgsl create mode 100644 test/tint/builtins/gen/literal/textureGather/c0640c.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/literal/textureGather/c0640c.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/literal/textureGather/c0640c.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/literal/textureGather/c0640c.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/literal/textureGather/c0640c.wgsl.expected.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/c409ae.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/c409ae.wgsl.expected.glsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/c409ae.wgsl.expected.hlsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/c409ae.wgsl.expected.msl delete mode 100644 test/tint/builtins/gen/literal/textureGather/c409ae.wgsl.expected.spvasm delete mode 100644 test/tint/builtins/gen/literal/textureGather/c409ae.wgsl.expected.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/c55822.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/c55822.wgsl.expected.glsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/c55822.wgsl.expected.hlsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/c55822.wgsl.expected.msl delete mode 100644 test/tint/builtins/gen/literal/textureGather/c55822.wgsl.expected.spvasm delete mode 100644 test/tint/builtins/gen/literal/textureGather/c55822.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/literal/textureGather/d1f187.wgsl create mode 100644 test/tint/builtins/gen/literal/textureGather/d1f187.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/literal/textureGather/d1f187.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/literal/textureGather/d1f187.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/literal/textureGather/d1f187.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/literal/textureGather/d1f187.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/literal/textureGather/d90605.wgsl create mode 100644 test/tint/builtins/gen/literal/textureGather/d90605.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/literal/textureGather/d90605.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/literal/textureGather/d90605.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/literal/textureGather/d90605.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/literal/textureGather/d90605.wgsl.expected.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/e1b67d.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/e1b67d.wgsl.expected.glsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/e1b67d.wgsl.expected.hlsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/e1b67d.wgsl.expected.msl delete mode 100644 test/tint/builtins/gen/literal/textureGather/e1b67d.wgsl.expected.spvasm delete mode 100644 test/tint/builtins/gen/literal/textureGather/e1b67d.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/literal/textureGather/e9d390.wgsl create mode 100644 test/tint/builtins/gen/literal/textureGather/e9d390.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/literal/textureGather/e9d390.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/literal/textureGather/e9d390.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/literal/textureGather/e9d390.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/literal/textureGather/e9d390.wgsl.expected.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/e9eff6.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/e9eff6.wgsl.expected.glsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/e9eff6.wgsl.expected.hlsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/e9eff6.wgsl.expected.msl delete mode 100644 test/tint/builtins/gen/literal/textureGather/e9eff6.wgsl.expected.spvasm delete mode 100644 test/tint/builtins/gen/literal/textureGather/e9eff6.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/literal/textureGather/f2c6e3.wgsl create mode 100644 test/tint/builtins/gen/literal/textureGather/f2c6e3.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/literal/textureGather/f2c6e3.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/literal/textureGather/f2c6e3.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/literal/textureGather/f2c6e3.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/literal/textureGather/f2c6e3.wgsl.expected.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/f5f3ba.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/f5f3ba.wgsl.expected.glsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/f5f3ba.wgsl.expected.hlsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/f5f3ba.wgsl.expected.msl delete mode 100644 test/tint/builtins/gen/literal/textureGather/f5f3ba.wgsl.expected.spvasm delete mode 100644 test/tint/builtins/gen/literal/textureGather/f5f3ba.wgsl.expected.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/f7995a.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/f7995a.wgsl.expected.glsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/f7995a.wgsl.expected.hlsl delete mode 100644 test/tint/builtins/gen/literal/textureGather/f7995a.wgsl.expected.msl delete mode 100644 test/tint/builtins/gen/literal/textureGather/f7995a.wgsl.expected.spvasm delete mode 100644 test/tint/builtins/gen/literal/textureGather/f7995a.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/literal/textureGatherCompare/313add.wgsl create mode 100644 test/tint/builtins/gen/literal/textureGatherCompare/313add.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/literal/textureGatherCompare/313add.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/literal/textureGatherCompare/313add.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/literal/textureGatherCompare/313add.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/literal/textureGatherCompare/313add.wgsl.expected.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureGatherCompare/6f1267.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureGatherCompare/6f1267.wgsl.expected.glsl delete mode 100644 test/tint/builtins/gen/literal/textureGatherCompare/6f1267.wgsl.expected.hlsl delete mode 100644 test/tint/builtins/gen/literal/textureGatherCompare/6f1267.wgsl.expected.msl delete mode 100644 test/tint/builtins/gen/literal/textureGatherCompare/6f1267.wgsl.expected.spvasm delete mode 100644 test/tint/builtins/gen/literal/textureGatherCompare/6f1267.wgsl.expected.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureGatherCompare/a5f587.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureGatherCompare/a5f587.wgsl.expected.glsl delete mode 100644 test/tint/builtins/gen/literal/textureGatherCompare/a5f587.wgsl.expected.hlsl delete mode 100644 test/tint/builtins/gen/literal/textureGatherCompare/a5f587.wgsl.expected.msl delete mode 100644 test/tint/builtins/gen/literal/textureGatherCompare/a5f587.wgsl.expected.spvasm delete mode 100644 test/tint/builtins/gen/literal/textureGatherCompare/a5f587.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/literal/textureGatherCompare/f585cc.wgsl create mode 100644 test/tint/builtins/gen/literal/textureGatherCompare/f585cc.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/literal/textureGatherCompare/f585cc.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/literal/textureGatherCompare/f585cc.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/literal/textureGatherCompare/f585cc.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/literal/textureGatherCompare/f585cc.wgsl.expected.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureSample/02aa9b.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureSample/02aa9b.wgsl.expected.glsl delete mode 100644 test/tint/builtins/gen/literal/textureSample/02aa9b.wgsl.expected.hlsl delete mode 100644 test/tint/builtins/gen/literal/textureSample/02aa9b.wgsl.expected.msl delete mode 100644 test/tint/builtins/gen/literal/textureSample/02aa9b.wgsl.expected.spvasm delete mode 100644 test/tint/builtins/gen/literal/textureSample/02aa9b.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/literal/textureSample/0dff6c.wgsl create mode 100644 test/tint/builtins/gen/literal/textureSample/0dff6c.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/literal/textureSample/0dff6c.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/literal/textureSample/0dff6c.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/literal/textureSample/0dff6c.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/literal/textureSample/0dff6c.wgsl.expected.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureSample/100dc0.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureSample/100dc0.wgsl.expected.glsl delete mode 100644 test/tint/builtins/gen/literal/textureSample/100dc0.wgsl.expected.hlsl delete mode 100644 test/tint/builtins/gen/literal/textureSample/100dc0.wgsl.expected.msl delete mode 100644 test/tint/builtins/gen/literal/textureSample/100dc0.wgsl.expected.spvasm delete mode 100644 test/tint/builtins/gen/literal/textureSample/100dc0.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/literal/textureSample/17e988.wgsl create mode 100644 test/tint/builtins/gen/literal/textureSample/17e988.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/literal/textureSample/17e988.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/literal/textureSample/17e988.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/literal/textureSample/17e988.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/literal/textureSample/17e988.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/literal/textureSample/2149ec.wgsl create mode 100644 test/tint/builtins/gen/literal/textureSample/2149ec.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/literal/textureSample/2149ec.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/literal/textureSample/2149ec.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/literal/textureSample/2149ec.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/literal/textureSample/2149ec.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/literal/textureSample/60bf45.wgsl create mode 100644 test/tint/builtins/gen/literal/textureSample/60bf45.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/literal/textureSample/60bf45.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/literal/textureSample/60bf45.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/literal/textureSample/60bf45.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/literal/textureSample/60bf45.wgsl.expected.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureSample/667d76.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureSample/667d76.wgsl.expected.glsl delete mode 100644 test/tint/builtins/gen/literal/textureSample/667d76.wgsl.expected.hlsl delete mode 100644 test/tint/builtins/gen/literal/textureSample/667d76.wgsl.expected.msl delete mode 100644 test/tint/builtins/gen/literal/textureSample/667d76.wgsl.expected.spvasm delete mode 100644 test/tint/builtins/gen/literal/textureSample/667d76.wgsl.expected.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureSample/7c3baa.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureSample/7c3baa.wgsl.expected.glsl delete mode 100644 test/tint/builtins/gen/literal/textureSample/7c3baa.wgsl.expected.hlsl delete mode 100644 test/tint/builtins/gen/literal/textureSample/7c3baa.wgsl.expected.msl delete mode 100644 test/tint/builtins/gen/literal/textureSample/7c3baa.wgsl.expected.spvasm delete mode 100644 test/tint/builtins/gen/literal/textureSample/7c3baa.wgsl.expected.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureSample/8522e7.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureSample/8522e7.wgsl.expected.glsl delete mode 100644 test/tint/builtins/gen/literal/textureSample/8522e7.wgsl.expected.hlsl delete mode 100644 test/tint/builtins/gen/literal/textureSample/8522e7.wgsl.expected.msl delete mode 100644 test/tint/builtins/gen/literal/textureSample/8522e7.wgsl.expected.spvasm delete mode 100644 test/tint/builtins/gen/literal/textureSample/8522e7.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/literal/textureSample/85c4ba.wgsl create mode 100644 test/tint/builtins/gen/literal/textureSample/85c4ba.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/literal/textureSample/85c4ba.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/literal/textureSample/85c4ba.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/literal/textureSample/85c4ba.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/literal/textureSample/85c4ba.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/literal/textureSampleBias/594824.wgsl create mode 100644 test/tint/builtins/gen/literal/textureSampleBias/594824.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/literal/textureSampleBias/594824.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/literal/textureSampleBias/594824.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/literal/textureSampleBias/594824.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/literal/textureSampleBias/594824.wgsl.expected.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureSampleBias/65ac50.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureSampleBias/65ac50.wgsl.expected.glsl delete mode 100644 test/tint/builtins/gen/literal/textureSampleBias/65ac50.wgsl.expected.hlsl delete mode 100644 test/tint/builtins/gen/literal/textureSampleBias/65ac50.wgsl.expected.msl delete mode 100644 test/tint/builtins/gen/literal/textureSampleBias/65ac50.wgsl.expected.spvasm delete mode 100644 test/tint/builtins/gen/literal/textureSampleBias/65ac50.wgsl.expected.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureSampleBias/81c19a.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureSampleBias/81c19a.wgsl.expected.glsl delete mode 100644 test/tint/builtins/gen/literal/textureSampleBias/81c19a.wgsl.expected.hlsl delete mode 100644 test/tint/builtins/gen/literal/textureSampleBias/81c19a.wgsl.expected.msl delete mode 100644 test/tint/builtins/gen/literal/textureSampleBias/81c19a.wgsl.expected.spvasm delete mode 100644 test/tint/builtins/gen/literal/textureSampleBias/81c19a.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/literal/textureSampleBias/9dbb51.wgsl create mode 100644 test/tint/builtins/gen/literal/textureSampleBias/9dbb51.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/literal/textureSampleBias/9dbb51.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/literal/textureSampleBias/9dbb51.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/literal/textureSampleBias/9dbb51.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/literal/textureSampleBias/9dbb51.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/literal/textureSampleBias/a161cf.wgsl create mode 100644 test/tint/builtins/gen/literal/textureSampleBias/a161cf.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/literal/textureSampleBias/a161cf.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/literal/textureSampleBias/a161cf.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/literal/textureSampleBias/a161cf.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/literal/textureSampleBias/a161cf.wgsl.expected.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureSampleBias/df91bb.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureSampleBias/df91bb.wgsl.expected.glsl delete mode 100644 test/tint/builtins/gen/literal/textureSampleBias/df91bb.wgsl.expected.hlsl delete mode 100644 test/tint/builtins/gen/literal/textureSampleBias/df91bb.wgsl.expected.msl delete mode 100644 test/tint/builtins/gen/literal/textureSampleBias/df91bb.wgsl.expected.spvasm delete mode 100644 test/tint/builtins/gen/literal/textureSampleBias/df91bb.wgsl.expected.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureSampleCompare/25fcd1.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureSampleCompare/25fcd1.wgsl.expected.glsl delete mode 100644 test/tint/builtins/gen/literal/textureSampleCompare/25fcd1.wgsl.expected.hlsl delete mode 100644 test/tint/builtins/gen/literal/textureSampleCompare/25fcd1.wgsl.expected.msl delete mode 100644 test/tint/builtins/gen/literal/textureSampleCompare/25fcd1.wgsl.expected.spvasm delete mode 100644 test/tint/builtins/gen/literal/textureSampleCompare/25fcd1.wgsl.expected.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureSampleCompare/98b85c.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureSampleCompare/98b85c.wgsl.expected.glsl delete mode 100644 test/tint/builtins/gen/literal/textureSampleCompare/98b85c.wgsl.expected.hlsl delete mode 100644 test/tint/builtins/gen/literal/textureSampleCompare/98b85c.wgsl.expected.msl delete mode 100644 test/tint/builtins/gen/literal/textureSampleCompare/98b85c.wgsl.expected.spvasm delete mode 100644 test/tint/builtins/gen/literal/textureSampleCompare/98b85c.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/literal/textureSampleCompare/af1051.wgsl create mode 100644 test/tint/builtins/gen/literal/textureSampleCompare/af1051.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/literal/textureSampleCompare/af1051.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/literal/textureSampleCompare/af1051.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/literal/textureSampleCompare/af1051.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/literal/textureSampleCompare/af1051.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/literal/textureSampleCompare/dec064.wgsl create mode 100644 test/tint/builtins/gen/literal/textureSampleCompare/dec064.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/literal/textureSampleCompare/dec064.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/literal/textureSampleCompare/dec064.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/literal/textureSampleCompare/dec064.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/literal/textureSampleCompare/dec064.wgsl.expected.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureSampleCompareLevel/011a8f.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureSampleCompareLevel/011a8f.wgsl.expected.glsl delete mode 100644 test/tint/builtins/gen/literal/textureSampleCompareLevel/011a8f.wgsl.expected.hlsl delete mode 100644 test/tint/builtins/gen/literal/textureSampleCompareLevel/011a8f.wgsl.expected.msl delete mode 100644 test/tint/builtins/gen/literal/textureSampleCompareLevel/011a8f.wgsl.expected.spvasm delete mode 100644 test/tint/builtins/gen/literal/textureSampleCompareLevel/011a8f.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/literal/textureSampleCompareLevel/7f2b9a.wgsl create mode 100644 test/tint/builtins/gen/literal/textureSampleCompareLevel/7f2b9a.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/literal/textureSampleCompareLevel/7f2b9a.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/literal/textureSampleCompareLevel/7f2b9a.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/literal/textureSampleCompareLevel/7f2b9a.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/literal/textureSampleCompareLevel/7f2b9a.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/literal/textureSampleCompareLevel/b6e47c.wgsl create mode 100644 test/tint/builtins/gen/literal/textureSampleCompareLevel/b6e47c.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/literal/textureSampleCompareLevel/b6e47c.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/literal/textureSampleCompareLevel/b6e47c.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/literal/textureSampleCompareLevel/b6e47c.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/literal/textureSampleCompareLevel/b6e47c.wgsl.expected.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureSampleCompareLevel/f8121c.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureSampleCompareLevel/f8121c.wgsl.expected.glsl delete mode 100644 test/tint/builtins/gen/literal/textureSampleCompareLevel/f8121c.wgsl.expected.hlsl delete mode 100644 test/tint/builtins/gen/literal/textureSampleCompareLevel/f8121c.wgsl.expected.msl delete mode 100644 test/tint/builtins/gen/literal/textureSampleCompareLevel/f8121c.wgsl.expected.spvasm delete mode 100644 test/tint/builtins/gen/literal/textureSampleCompareLevel/f8121c.wgsl.expected.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureSampleGrad/468f88.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureSampleGrad/468f88.wgsl.expected.glsl delete mode 100644 test/tint/builtins/gen/literal/textureSampleGrad/468f88.wgsl.expected.hlsl delete mode 100644 test/tint/builtins/gen/literal/textureSampleGrad/468f88.wgsl.expected.msl delete mode 100644 test/tint/builtins/gen/literal/textureSampleGrad/468f88.wgsl.expected.spvasm delete mode 100644 test/tint/builtins/gen/literal/textureSampleGrad/468f88.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/literal/textureSampleGrad/5884dd.wgsl create mode 100644 test/tint/builtins/gen/literal/textureSampleGrad/5884dd.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/literal/textureSampleGrad/5884dd.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/literal/textureSampleGrad/5884dd.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/literal/textureSampleGrad/5884dd.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/literal/textureSampleGrad/5884dd.wgsl.expected.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureSampleGrad/872f00.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureSampleGrad/872f00.wgsl.expected.glsl delete mode 100644 test/tint/builtins/gen/literal/textureSampleGrad/872f00.wgsl.expected.hlsl delete mode 100644 test/tint/builtins/gen/literal/textureSampleGrad/872f00.wgsl.expected.msl delete mode 100644 test/tint/builtins/gen/literal/textureSampleGrad/872f00.wgsl.expected.spvasm delete mode 100644 test/tint/builtins/gen/literal/textureSampleGrad/872f00.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/literal/textureSampleGrad/d4e3c5.wgsl create mode 100644 test/tint/builtins/gen/literal/textureSampleGrad/d4e3c5.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/literal/textureSampleGrad/d4e3c5.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/literal/textureSampleGrad/d4e3c5.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/literal/textureSampleGrad/d4e3c5.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/literal/textureSampleGrad/d4e3c5.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/literal/textureSampleGrad/d65515.wgsl create mode 100644 test/tint/builtins/gen/literal/textureSampleGrad/d65515.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/literal/textureSampleGrad/d65515.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/literal/textureSampleGrad/d65515.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/literal/textureSampleGrad/d65515.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/literal/textureSampleGrad/d65515.wgsl.expected.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureSampleGrad/e9a2f7.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureSampleGrad/e9a2f7.wgsl.expected.glsl delete mode 100644 test/tint/builtins/gen/literal/textureSampleGrad/e9a2f7.wgsl.expected.hlsl delete mode 100644 test/tint/builtins/gen/literal/textureSampleGrad/e9a2f7.wgsl.expected.msl delete mode 100644 test/tint/builtins/gen/literal/textureSampleGrad/e9a2f7.wgsl.expected.spvasm delete mode 100644 test/tint/builtins/gen/literal/textureSampleGrad/e9a2f7.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/literal/textureSampleLevel/0b0a1b.wgsl create mode 100644 test/tint/builtins/gen/literal/textureSampleLevel/0b0a1b.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/literal/textureSampleLevel/0b0a1b.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/literal/textureSampleLevel/0b0a1b.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/literal/textureSampleLevel/0b0a1b.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/literal/textureSampleLevel/0b0a1b.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/literal/textureSampleLevel/36780e.wgsl create mode 100644 test/tint/builtins/gen/literal/textureSampleLevel/36780e.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/literal/textureSampleLevel/36780e.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/literal/textureSampleLevel/36780e.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/literal/textureSampleLevel/36780e.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/literal/textureSampleLevel/36780e.wgsl.expected.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureSampleLevel/47daa4.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureSampleLevel/47daa4.wgsl.expected.glsl delete mode 100644 test/tint/builtins/gen/literal/textureSampleLevel/47daa4.wgsl.expected.hlsl delete mode 100644 test/tint/builtins/gen/literal/textureSampleLevel/47daa4.wgsl.expected.msl delete mode 100644 test/tint/builtins/gen/literal/textureSampleLevel/47daa4.wgsl.expected.spvasm delete mode 100644 test/tint/builtins/gen/literal/textureSampleLevel/47daa4.wgsl.expected.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureSampleLevel/690d95.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureSampleLevel/690d95.wgsl.expected.glsl delete mode 100644 test/tint/builtins/gen/literal/textureSampleLevel/690d95.wgsl.expected.hlsl delete mode 100644 test/tint/builtins/gen/literal/textureSampleLevel/690d95.wgsl.expected.msl delete mode 100644 test/tint/builtins/gen/literal/textureSampleLevel/690d95.wgsl.expected.spvasm delete mode 100644 test/tint/builtins/gen/literal/textureSampleLevel/690d95.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/literal/textureSampleLevel/749baf.wgsl create mode 100644 test/tint/builtins/gen/literal/textureSampleLevel/749baf.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/literal/textureSampleLevel/749baf.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/literal/textureSampleLevel/749baf.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/literal/textureSampleLevel/749baf.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/literal/textureSampleLevel/749baf.wgsl.expected.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureSampleLevel/9bd37b.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureSampleLevel/9bd37b.wgsl.expected.glsl delete mode 100644 test/tint/builtins/gen/literal/textureSampleLevel/9bd37b.wgsl.expected.hlsl delete mode 100644 test/tint/builtins/gen/literal/textureSampleLevel/9bd37b.wgsl.expected.msl delete mode 100644 test/tint/builtins/gen/literal/textureSampleLevel/9bd37b.wgsl.expected.spvasm delete mode 100644 test/tint/builtins/gen/literal/textureSampleLevel/9bd37b.wgsl.expected.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureSampleLevel/a4af26.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureSampleLevel/a4af26.wgsl.expected.glsl delete mode 100644 test/tint/builtins/gen/literal/textureSampleLevel/a4af26.wgsl.expected.hlsl delete mode 100644 test/tint/builtins/gen/literal/textureSampleLevel/a4af26.wgsl.expected.msl delete mode 100644 test/tint/builtins/gen/literal/textureSampleLevel/a4af26.wgsl.expected.spvasm delete mode 100644 test/tint/builtins/gen/literal/textureSampleLevel/a4af26.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/literal/textureSampleLevel/b7c55c.wgsl create mode 100644 test/tint/builtins/gen/literal/textureSampleLevel/b7c55c.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/literal/textureSampleLevel/b7c55c.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/literal/textureSampleLevel/b7c55c.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/literal/textureSampleLevel/b7c55c.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/literal/textureSampleLevel/b7c55c.wgsl.expected.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureSampleLevel/ba93b3.wgsl delete mode 100644 test/tint/builtins/gen/literal/textureSampleLevel/ba93b3.wgsl.expected.glsl delete mode 100644 test/tint/builtins/gen/literal/textureSampleLevel/ba93b3.wgsl.expected.hlsl delete mode 100644 test/tint/builtins/gen/literal/textureSampleLevel/ba93b3.wgsl.expected.msl delete mode 100644 test/tint/builtins/gen/literal/textureSampleLevel/ba93b3.wgsl.expected.spvasm delete mode 100644 test/tint/builtins/gen/literal/textureSampleLevel/ba93b3.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/literal/textureSampleLevel/dcbecb.wgsl create mode 100644 test/tint/builtins/gen/literal/textureSampleLevel/dcbecb.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/literal/textureSampleLevel/dcbecb.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/literal/textureSampleLevel/dcbecb.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/literal/textureSampleLevel/dcbecb.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/literal/textureSampleLevel/dcbecb.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/abs/002533.wgsl create mode 100644 test/tint/builtins/gen/var/abs/002533.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/abs/002533.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/abs/002533.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/abs/002533.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/abs/002533.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/abs/005174.wgsl create mode 100644 test/tint/builtins/gen/var/abs/005174.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/abs/005174.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/abs/005174.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/abs/005174.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/abs/005174.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/abs/1ce782.wgsl create mode 100644 test/tint/builtins/gen/var/abs/1ce782.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/abs/1ce782.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/abs/1ce782.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/abs/1ce782.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/abs/1ce782.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/abs/1e9d53.wgsl create mode 100644 test/tint/builtins/gen/var/abs/1e9d53.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/abs/1e9d53.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/abs/1e9d53.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/abs/1e9d53.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/abs/1e9d53.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/abs/467cd1.wgsl create mode 100644 test/tint/builtins/gen/var/abs/467cd1.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/abs/467cd1.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/abs/467cd1.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/abs/467cd1.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/abs/467cd1.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/abs/4ad288.wgsl create mode 100644 test/tint/builtins/gen/var/abs/4ad288.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/abs/4ad288.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/abs/4ad288.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/abs/4ad288.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/abs/4ad288.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/abs/5ad50a.wgsl create mode 100644 test/tint/builtins/gen/var/abs/5ad50a.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/abs/5ad50a.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/abs/5ad50a.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/abs/5ad50a.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/abs/5ad50a.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/abs/7326de.wgsl create mode 100644 test/tint/builtins/gen/var/abs/7326de.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/abs/7326de.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/abs/7326de.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/abs/7326de.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/abs/7326de.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/abs/7f28e6.wgsl create mode 100644 test/tint/builtins/gen/var/abs/7f28e6.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/abs/7f28e6.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/abs/7f28e6.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/abs/7f28e6.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/abs/7f28e6.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/abs/7faa9e.wgsl create mode 100644 test/tint/builtins/gen/var/abs/7faa9e.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/abs/7faa9e.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/abs/7faa9e.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/abs/7faa9e.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/abs/7faa9e.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/abs/9c80a6.wgsl create mode 100644 test/tint/builtins/gen/var/abs/9c80a6.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/abs/9c80a6.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/abs/9c80a6.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/abs/9c80a6.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/abs/9c80a6.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/abs/b96037.wgsl create mode 100644 test/tint/builtins/gen/var/abs/b96037.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/abs/b96037.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/abs/b96037.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/abs/b96037.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/abs/b96037.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/acos/489247.wgsl create mode 100644 test/tint/builtins/gen/var/acos/489247.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/acos/489247.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/acos/489247.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/acos/489247.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/acos/489247.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/acos/8e2acf.wgsl create mode 100644 test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/acos/a610c4.wgsl create mode 100644 test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/acos/dfc915.wgsl create mode 100644 test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/all/353d6a.wgsl create mode 100644 test/tint/builtins/gen/var/all/353d6a.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/all/353d6a.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/all/353d6a.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/all/353d6a.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/all/353d6a.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/all/986c7b.wgsl create mode 100644 test/tint/builtins/gen/var/all/986c7b.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/all/986c7b.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/all/986c7b.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/all/986c7b.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/all/986c7b.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/all/bd2dba.wgsl create mode 100644 test/tint/builtins/gen/var/all/bd2dba.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/all/bd2dba.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/all/bd2dba.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/all/bd2dba.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/all/bd2dba.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/all/f46790.wgsl create mode 100644 test/tint/builtins/gen/var/all/f46790.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/all/f46790.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/all/f46790.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/all/f46790.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/all/f46790.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/any/083428.wgsl create mode 100644 test/tint/builtins/gen/var/any/083428.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/any/083428.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/any/083428.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/any/083428.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/any/083428.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/any/0e3e58.wgsl create mode 100644 test/tint/builtins/gen/var/any/0e3e58.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/any/0e3e58.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/any/0e3e58.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/any/0e3e58.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/any/0e3e58.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/any/2ab91a.wgsl create mode 100644 test/tint/builtins/gen/var/any/2ab91a.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/any/2ab91a.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/any/2ab91a.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/any/2ab91a.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/any/2ab91a.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/any/e755c1.wgsl create mode 100644 test/tint/builtins/gen/var/any/e755c1.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/any/e755c1.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/any/e755c1.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/any/e755c1.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/any/e755c1.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/arrayLength/1588cd.wgsl create mode 100644 test/tint/builtins/gen/var/arrayLength/1588cd.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/arrayLength/1588cd.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/arrayLength/1588cd.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/arrayLength/1588cd.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/arrayLength/1588cd.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/arrayLength/61b1c7.wgsl create mode 100644 test/tint/builtins/gen/var/arrayLength/61b1c7.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/arrayLength/61b1c7.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/arrayLength/61b1c7.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/arrayLength/61b1c7.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/arrayLength/61b1c7.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/arrayLength/a0f5ca.wgsl create mode 100644 test/tint/builtins/gen/var/arrayLength/a0f5ca.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/arrayLength/a0f5ca.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/arrayLength/a0f5ca.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/arrayLength/a0f5ca.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/arrayLength/a0f5ca.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/arrayLength/cdd123.wgsl create mode 100644 test/tint/builtins/gen/var/arrayLength/cdd123.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/arrayLength/cdd123.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/arrayLength/cdd123.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/arrayLength/cdd123.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/arrayLength/cdd123.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/arrayLength/cfca0a.wgsl create mode 100644 test/tint/builtins/gen/var/arrayLength/cfca0a.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/arrayLength/cfca0a.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/arrayLength/cfca0a.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/arrayLength/cfca0a.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/arrayLength/cfca0a.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/arrayLength/eb510f.wgsl create mode 100644 test/tint/builtins/gen/var/arrayLength/eb510f.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/arrayLength/eb510f.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/arrayLength/eb510f.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/arrayLength/eb510f.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/arrayLength/eb510f.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/asin/064953.wgsl create mode 100644 test/tint/builtins/gen/var/asin/064953.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/asin/064953.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/asin/064953.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/asin/064953.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/asin/064953.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/asin/7b6a44.wgsl create mode 100644 test/tint/builtins/gen/var/asin/7b6a44.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/asin/7b6a44.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/asin/7b6a44.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/asin/7b6a44.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/asin/7b6a44.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/asin/8cd9c9.wgsl create mode 100644 test/tint/builtins/gen/var/asin/8cd9c9.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/asin/8cd9c9.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/asin/8cd9c9.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/asin/8cd9c9.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/asin/8cd9c9.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/asin/c0c272.wgsl create mode 100644 test/tint/builtins/gen/var/asin/c0c272.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/asin/c0c272.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/asin/c0c272.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/asin/c0c272.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/asin/c0c272.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/atan/02979a.wgsl create mode 100644 test/tint/builtins/gen/var/atan/02979a.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/atan/02979a.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/atan/02979a.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/atan/02979a.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/atan/02979a.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/atan/331e6d.wgsl create mode 100644 test/tint/builtins/gen/var/atan/331e6d.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/atan/331e6d.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/atan/331e6d.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/atan/331e6d.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/atan/331e6d.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/atan/a8b696.wgsl create mode 100644 test/tint/builtins/gen/var/atan/a8b696.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/atan/a8b696.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/atan/a8b696.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/atan/a8b696.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/atan/a8b696.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/atan/ad96e4.wgsl create mode 100644 test/tint/builtins/gen/var/atan/ad96e4.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/atan/ad96e4.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/atan/ad96e4.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/atan/ad96e4.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/atan/ad96e4.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/atan2/57fb13.wgsl create mode 100644 test/tint/builtins/gen/var/atan2/57fb13.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/atan2/57fb13.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/atan2/57fb13.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/atan2/57fb13.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/atan2/57fb13.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/atan2/96057c.wgsl create mode 100644 test/tint/builtins/gen/var/atan2/96057c.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/atan2/96057c.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/atan2/96057c.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/atan2/96057c.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/atan2/96057c.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/atan2/a70d0d.wgsl create mode 100644 test/tint/builtins/gen/var/atan2/a70d0d.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/atan2/a70d0d.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/atan2/a70d0d.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/atan2/a70d0d.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/atan2/a70d0d.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/atan2/ae713e.wgsl create mode 100644 test/tint/builtins/gen/var/atan2/ae713e.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/atan2/ae713e.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/atan2/ae713e.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/atan2/ae713e.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/atan2/ae713e.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/atomicAdd/794055.wgsl create mode 100644 test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/atomicAdd/8a199a.wgsl create mode 100644 test/tint/builtins/gen/var/atomicAdd/8a199a.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/atomicAdd/8a199a.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/atomicAdd/8a199a.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/atomicAdd/8a199a.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/atomicAdd/8a199a.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/atomicAdd/d32fe4.wgsl create mode 100644 test/tint/builtins/gen/var/atomicAdd/d32fe4.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/atomicAdd/d32fe4.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/atomicAdd/d32fe4.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/atomicAdd/d32fe4.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/atomicAdd/d32fe4.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl create mode 100644 test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/atomicAnd/152966.wgsl create mode 100644 test/tint/builtins/gen/var/atomicAnd/152966.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/atomicAnd/152966.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/atomicAnd/152966.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/atomicAnd/152966.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/atomicAnd/152966.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl create mode 100644 test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/atomicAnd/45a819.wgsl create mode 100644 test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/atomicAnd/85a8d9.wgsl create mode 100644 test/tint/builtins/gen/var/atomicAnd/85a8d9.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/atomicAnd/85a8d9.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/atomicAnd/85a8d9.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/atomicAnd/85a8d9.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/atomicAnd/85a8d9.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/atomicCompareExchangeWeak/1bd40a.wgsl create mode 100644 test/tint/builtins/gen/var/atomicCompareExchangeWeak/1bd40a.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/atomicCompareExchangeWeak/1bd40a.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/atomicCompareExchangeWeak/1bd40a.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/atomicCompareExchangeWeak/1bd40a.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/atomicCompareExchangeWeak/1bd40a.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/atomicCompareExchangeWeak/63d8e6.wgsl create mode 100644 test/tint/builtins/gen/var/atomicCompareExchangeWeak/63d8e6.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/atomicCompareExchangeWeak/63d8e6.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/atomicCompareExchangeWeak/63d8e6.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/atomicCompareExchangeWeak/63d8e6.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/atomicCompareExchangeWeak/63d8e6.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl create mode 100644 test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl create mode 100644 test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl create mode 100644 test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/atomicExchange/d59712.wgsl create mode 100644 test/tint/builtins/gen/var/atomicExchange/d59712.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/atomicExchange/d59712.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/atomicExchange/d59712.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/atomicExchange/d59712.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/atomicExchange/d59712.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl create mode 100644 test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/atomicExchange/f2e22f.wgsl create mode 100644 test/tint/builtins/gen/var/atomicExchange/f2e22f.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/atomicExchange/f2e22f.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/atomicExchange/f2e22f.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/atomicExchange/f2e22f.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/atomicExchange/f2e22f.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/atomicLoad/0806ad.wgsl create mode 100644 test/tint/builtins/gen/var/atomicLoad/0806ad.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/atomicLoad/0806ad.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/atomicLoad/0806ad.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/atomicLoad/0806ad.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/atomicLoad/0806ad.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl create mode 100644 test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl create mode 100644 test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/atomicLoad/fe6cc3.wgsl create mode 100644 test/tint/builtins/gen/var/atomicLoad/fe6cc3.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/atomicLoad/fe6cc3.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/atomicLoad/fe6cc3.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/atomicLoad/fe6cc3.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/atomicLoad/fe6cc3.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/atomicMax/51b9be.wgsl create mode 100644 test/tint/builtins/gen/var/atomicMax/51b9be.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/atomicMax/51b9be.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/atomicMax/51b9be.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/atomicMax/51b9be.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/atomicMax/51b9be.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/atomicMax/92aa72.wgsl create mode 100644 test/tint/builtins/gen/var/atomicMax/92aa72.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/atomicMax/92aa72.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/atomicMax/92aa72.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/atomicMax/92aa72.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/atomicMax/92aa72.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl create mode 100644 test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/atomicMax/beccfc.wgsl create mode 100644 test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/atomicMin/278235.wgsl create mode 100644 test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/atomicMin/69d383.wgsl create mode 100644 test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/atomicMin/8e38dc.wgsl create mode 100644 test/tint/builtins/gen/var/atomicMin/8e38dc.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/atomicMin/8e38dc.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/atomicMin/8e38dc.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/atomicMin/8e38dc.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/atomicMin/8e38dc.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/atomicMin/c67a74.wgsl create mode 100644 test/tint/builtins/gen/var/atomicMin/c67a74.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/atomicMin/c67a74.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/atomicMin/c67a74.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/atomicMin/c67a74.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/atomicMin/c67a74.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl create mode 100644 test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/atomicOr/5e95d4.wgsl create mode 100644 test/tint/builtins/gen/var/atomicOr/5e95d4.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/atomicOr/5e95d4.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/atomicOr/5e95d4.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/atomicOr/5e95d4.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/atomicOr/5e95d4.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/atomicOr/8d96a0.wgsl create mode 100644 test/tint/builtins/gen/var/atomicOr/8d96a0.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/atomicOr/8d96a0.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/atomicOr/8d96a0.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/atomicOr/8d96a0.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/atomicOr/8d96a0.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/atomicOr/d09248.wgsl create mode 100644 test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/atomicStore/726882.wgsl create mode 100644 test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/atomicStore/8bea94.wgsl create mode 100644 test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/atomicStore/cdc29e.wgsl create mode 100644 test/tint/builtins/gen/var/atomicStore/cdc29e.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/atomicStore/cdc29e.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/atomicStore/cdc29e.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/atomicStore/cdc29e.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/atomicStore/cdc29e.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/atomicStore/d1e9a6.wgsl create mode 100644 test/tint/builtins/gen/var/atomicStore/d1e9a6.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/atomicStore/d1e9a6.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/atomicStore/d1e9a6.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/atomicStore/d1e9a6.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/atomicStore/d1e9a6.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/atomicSub/051100.wgsl create mode 100644 test/tint/builtins/gen/var/atomicSub/051100.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/atomicSub/051100.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/atomicSub/051100.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/atomicSub/051100.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/atomicSub/051100.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl create mode 100644 test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/atomicSub/15bfc9.wgsl create mode 100644 test/tint/builtins/gen/var/atomicSub/15bfc9.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/atomicSub/15bfc9.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/atomicSub/15bfc9.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/atomicSub/15bfc9.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/atomicSub/15bfc9.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/atomicSub/77883a.wgsl create mode 100644 test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/atomicXor/54510e.wgsl create mode 100644 test/tint/builtins/gen/var/atomicXor/54510e.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/atomicXor/54510e.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/atomicXor/54510e.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/atomicXor/54510e.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/atomicXor/54510e.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/atomicXor/75dc95.wgsl create mode 100644 test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/atomicXor/c1b78c.wgsl create mode 100644 test/tint/builtins/gen/var/atomicXor/c1b78c.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/atomicXor/c1b78c.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/atomicXor/c1b78c.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/atomicXor/c1b78c.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/atomicXor/c1b78c.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl create mode 100644 test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/ceil/34064b.wgsl create mode 100644 test/tint/builtins/gen/var/ceil/34064b.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/ceil/34064b.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/ceil/34064b.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/ceil/34064b.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/ceil/34064b.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/ceil/678655.wgsl create mode 100644 test/tint/builtins/gen/var/ceil/678655.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/ceil/678655.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/ceil/678655.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/ceil/678655.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/ceil/678655.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/ceil/96f597.wgsl create mode 100644 test/tint/builtins/gen/var/ceil/96f597.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/ceil/96f597.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/ceil/96f597.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/ceil/96f597.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/ceil/96f597.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/ceil/b74c16.wgsl create mode 100644 test/tint/builtins/gen/var/ceil/b74c16.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/ceil/b74c16.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/ceil/b74c16.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/ceil/b74c16.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/ceil/b74c16.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/clamp/0acf8f.wgsl create mode 100644 test/tint/builtins/gen/var/clamp/0acf8f.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/clamp/0acf8f.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/clamp/0acf8f.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/clamp/0acf8f.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/clamp/0acf8f.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/clamp/1a32e3.wgsl create mode 100644 test/tint/builtins/gen/var/clamp/1a32e3.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/clamp/1a32e3.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/clamp/1a32e3.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/clamp/1a32e3.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/clamp/1a32e3.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/clamp/2bd567.wgsl create mode 100644 test/tint/builtins/gen/var/clamp/2bd567.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/clamp/2bd567.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/clamp/2bd567.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/clamp/2bd567.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/clamp/2bd567.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/clamp/2bde41.wgsl create mode 100644 test/tint/builtins/gen/var/clamp/2bde41.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/clamp/2bde41.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/clamp/2bde41.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/clamp/2bde41.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/clamp/2bde41.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/clamp/548fc7.wgsl create mode 100644 test/tint/builtins/gen/var/clamp/548fc7.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/clamp/548fc7.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/clamp/548fc7.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/clamp/548fc7.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/clamp/548fc7.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/clamp/5f0819.wgsl create mode 100644 test/tint/builtins/gen/var/clamp/5f0819.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/clamp/5f0819.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/clamp/5f0819.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/clamp/5f0819.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/clamp/5f0819.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/clamp/6c1749.wgsl create mode 100644 test/tint/builtins/gen/var/clamp/6c1749.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/clamp/6c1749.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/clamp/6c1749.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/clamp/6c1749.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/clamp/6c1749.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/clamp/7706d7.wgsl create mode 100644 test/tint/builtins/gen/var/clamp/7706d7.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/clamp/7706d7.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/clamp/7706d7.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/clamp/7706d7.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/clamp/7706d7.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/clamp/867397.wgsl create mode 100644 test/tint/builtins/gen/var/clamp/867397.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/clamp/867397.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/clamp/867397.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/clamp/867397.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/clamp/867397.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/clamp/a2de25.wgsl create mode 100644 test/tint/builtins/gen/var/clamp/a2de25.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/clamp/a2de25.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/clamp/a2de25.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/clamp/a2de25.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/clamp/a2de25.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/clamp/b07c65.wgsl create mode 100644 test/tint/builtins/gen/var/clamp/b07c65.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/clamp/b07c65.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/clamp/b07c65.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/clamp/b07c65.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/clamp/b07c65.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/clamp/bd43ce.wgsl create mode 100644 test/tint/builtins/gen/var/clamp/bd43ce.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/clamp/bd43ce.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/clamp/bd43ce.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/clamp/bd43ce.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/clamp/bd43ce.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/cos/16dc15.wgsl create mode 100644 test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/cos/29d66d.wgsl create mode 100644 test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/cos/c3b486.wgsl create mode 100644 test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/cos/c5c28e.wgsl create mode 100644 test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/cosh/377652.wgsl create mode 100644 test/tint/builtins/gen/var/cosh/377652.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/cosh/377652.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/cosh/377652.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/cosh/377652.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/cosh/377652.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/cosh/c13756.wgsl create mode 100644 test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/cosh/da92dd.wgsl create mode 100644 test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/cosh/e0c1de.wgsl create mode 100644 test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/countLeadingZeros/208d46.wgsl create mode 100644 test/tint/builtins/gen/var/countLeadingZeros/208d46.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/countLeadingZeros/208d46.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/countLeadingZeros/208d46.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/countLeadingZeros/208d46.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/countLeadingZeros/208d46.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/countLeadingZeros/6d4656.wgsl create mode 100644 test/tint/builtins/gen/var/countLeadingZeros/6d4656.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/countLeadingZeros/6d4656.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/countLeadingZeros/6d4656.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/countLeadingZeros/6d4656.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/countLeadingZeros/6d4656.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/countLeadingZeros/70783f.wgsl create mode 100644 test/tint/builtins/gen/var/countLeadingZeros/70783f.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/countLeadingZeros/70783f.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/countLeadingZeros/70783f.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/countLeadingZeros/70783f.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/countLeadingZeros/70783f.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/countLeadingZeros/7c38a6.wgsl create mode 100644 test/tint/builtins/gen/var/countLeadingZeros/7c38a6.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/countLeadingZeros/7c38a6.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/countLeadingZeros/7c38a6.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/countLeadingZeros/7c38a6.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/countLeadingZeros/7c38a6.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/countLeadingZeros/858d40.wgsl create mode 100644 test/tint/builtins/gen/var/countLeadingZeros/858d40.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/countLeadingZeros/858d40.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/countLeadingZeros/858d40.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/countLeadingZeros/858d40.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/countLeadingZeros/858d40.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/countLeadingZeros/ab6345.wgsl create mode 100644 test/tint/builtins/gen/var/countLeadingZeros/ab6345.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/countLeadingZeros/ab6345.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/countLeadingZeros/ab6345.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/countLeadingZeros/ab6345.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/countLeadingZeros/ab6345.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/countLeadingZeros/eab32b.wgsl create mode 100644 test/tint/builtins/gen/var/countLeadingZeros/eab32b.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/countLeadingZeros/eab32b.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/countLeadingZeros/eab32b.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/countLeadingZeros/eab32b.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/countLeadingZeros/eab32b.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/countLeadingZeros/f70103.wgsl create mode 100644 test/tint/builtins/gen/var/countLeadingZeros/f70103.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/countLeadingZeros/f70103.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/countLeadingZeros/f70103.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/countLeadingZeros/f70103.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/countLeadingZeros/f70103.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/countOneBits/0d0e46.wgsl create mode 100644 test/tint/builtins/gen/var/countOneBits/0d0e46.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/countOneBits/0d0e46.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/countOneBits/0d0e46.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/countOneBits/0d0e46.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/countOneBits/0d0e46.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/countOneBits/0f7980.wgsl create mode 100644 test/tint/builtins/gen/var/countOneBits/0f7980.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/countOneBits/0f7980.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/countOneBits/0f7980.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/countOneBits/0f7980.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/countOneBits/0f7980.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/countOneBits/65d2ae.wgsl create mode 100644 test/tint/builtins/gen/var/countOneBits/65d2ae.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/countOneBits/65d2ae.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/countOneBits/65d2ae.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/countOneBits/65d2ae.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/countOneBits/65d2ae.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/countOneBits/690cfc.wgsl create mode 100644 test/tint/builtins/gen/var/countOneBits/690cfc.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/countOneBits/690cfc.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/countOneBits/690cfc.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/countOneBits/690cfc.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/countOneBits/690cfc.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/countOneBits/94fd81.wgsl create mode 100644 test/tint/builtins/gen/var/countOneBits/94fd81.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/countOneBits/94fd81.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/countOneBits/94fd81.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/countOneBits/94fd81.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/countOneBits/94fd81.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/countOneBits/ae44f9.wgsl create mode 100644 test/tint/builtins/gen/var/countOneBits/ae44f9.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/countOneBits/ae44f9.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/countOneBits/ae44f9.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/countOneBits/ae44f9.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/countOneBits/ae44f9.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/countOneBits/af90e2.wgsl create mode 100644 test/tint/builtins/gen/var/countOneBits/af90e2.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/countOneBits/af90e2.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/countOneBits/af90e2.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/countOneBits/af90e2.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/countOneBits/af90e2.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/countOneBits/fd88b2.wgsl create mode 100644 test/tint/builtins/gen/var/countOneBits/fd88b2.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/countOneBits/fd88b2.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/countOneBits/fd88b2.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/countOneBits/fd88b2.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/countOneBits/fd88b2.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/countTrailingZeros/1ad138.wgsl create mode 100644 test/tint/builtins/gen/var/countTrailingZeros/1ad138.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/countTrailingZeros/1ad138.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/countTrailingZeros/1ad138.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/countTrailingZeros/1ad138.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/countTrailingZeros/1ad138.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/countTrailingZeros/1dc84a.wgsl create mode 100644 test/tint/builtins/gen/var/countTrailingZeros/1dc84a.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/countTrailingZeros/1dc84a.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/countTrailingZeros/1dc84a.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/countTrailingZeros/1dc84a.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/countTrailingZeros/1dc84a.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/countTrailingZeros/21e394.wgsl create mode 100644 test/tint/builtins/gen/var/countTrailingZeros/21e394.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/countTrailingZeros/21e394.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/countTrailingZeros/21e394.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/countTrailingZeros/21e394.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/countTrailingZeros/21e394.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/countTrailingZeros/327c37.wgsl create mode 100644 test/tint/builtins/gen/var/countTrailingZeros/327c37.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/countTrailingZeros/327c37.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/countTrailingZeros/327c37.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/countTrailingZeros/327c37.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/countTrailingZeros/327c37.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/countTrailingZeros/42fed6.wgsl create mode 100644 test/tint/builtins/gen/var/countTrailingZeros/42fed6.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/countTrailingZeros/42fed6.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/countTrailingZeros/42fed6.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/countTrailingZeros/42fed6.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/countTrailingZeros/42fed6.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/countTrailingZeros/8ed26f.wgsl create mode 100644 test/tint/builtins/gen/var/countTrailingZeros/8ed26f.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/countTrailingZeros/8ed26f.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/countTrailingZeros/8ed26f.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/countTrailingZeros/8ed26f.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/countTrailingZeros/8ed26f.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/countTrailingZeros/acfacb.wgsl create mode 100644 test/tint/builtins/gen/var/countTrailingZeros/acfacb.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/countTrailingZeros/acfacb.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/countTrailingZeros/acfacb.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/countTrailingZeros/acfacb.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/countTrailingZeros/acfacb.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/countTrailingZeros/d2b4a0.wgsl create mode 100644 test/tint/builtins/gen/var/countTrailingZeros/d2b4a0.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/countTrailingZeros/d2b4a0.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/countTrailingZeros/d2b4a0.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/countTrailingZeros/d2b4a0.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/countTrailingZeros/d2b4a0.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/cross/041cb0.wgsl create mode 100644 test/tint/builtins/gen/var/cross/041cb0.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/cross/041cb0.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/cross/041cb0.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/cross/041cb0.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/cross/041cb0.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/degrees/0d170c.wgsl create mode 100644 test/tint/builtins/gen/var/degrees/0d170c.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/degrees/0d170c.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/degrees/0d170c.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/degrees/0d170c.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/degrees/0d170c.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/degrees/1ad5df.wgsl create mode 100644 test/tint/builtins/gen/var/degrees/1ad5df.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/degrees/1ad5df.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/degrees/1ad5df.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/degrees/1ad5df.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/degrees/1ad5df.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/degrees/2af623.wgsl create mode 100644 test/tint/builtins/gen/var/degrees/2af623.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/degrees/2af623.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/degrees/2af623.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/degrees/2af623.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/degrees/2af623.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/degrees/51f705.wgsl create mode 100644 test/tint/builtins/gen/var/degrees/51f705.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/degrees/51f705.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/degrees/51f705.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/degrees/51f705.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/degrees/51f705.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/determinant/2b62ba.wgsl create mode 100644 test/tint/builtins/gen/var/determinant/2b62ba.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/determinant/2b62ba.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/determinant/2b62ba.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/determinant/2b62ba.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/determinant/2b62ba.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/determinant/a0a87c.wgsl create mode 100644 test/tint/builtins/gen/var/determinant/a0a87c.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/determinant/a0a87c.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/determinant/a0a87c.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/determinant/a0a87c.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/determinant/a0a87c.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/determinant/e19305.wgsl create mode 100644 test/tint/builtins/gen/var/determinant/e19305.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/determinant/e19305.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/determinant/e19305.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/determinant/e19305.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/determinant/e19305.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/distance/0657d4.wgsl create mode 100644 test/tint/builtins/gen/var/distance/0657d4.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/distance/0657d4.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/distance/0657d4.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/distance/0657d4.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/distance/0657d4.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/distance/9646ea.wgsl create mode 100644 test/tint/builtins/gen/var/distance/9646ea.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/distance/9646ea.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/distance/9646ea.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/distance/9646ea.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/distance/9646ea.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/distance/aa4055.wgsl create mode 100644 test/tint/builtins/gen/var/distance/aa4055.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/distance/aa4055.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/distance/aa4055.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/distance/aa4055.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/distance/aa4055.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/distance/cfed73.wgsl create mode 100644 test/tint/builtins/gen/var/distance/cfed73.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/distance/cfed73.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/distance/cfed73.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/distance/cfed73.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/distance/cfed73.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/dot/0c577b.wgsl create mode 100644 test/tint/builtins/gen/var/dot/0c577b.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/dot/0c577b.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/dot/0c577b.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/dot/0c577b.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/dot/0c577b.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/dot/7548a0.wgsl create mode 100644 test/tint/builtins/gen/var/dot/7548a0.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/dot/7548a0.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/dot/7548a0.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/dot/7548a0.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/dot/7548a0.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/dot/883f0e.wgsl create mode 100644 test/tint/builtins/gen/var/dot/883f0e.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/dot/883f0e.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/dot/883f0e.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/dot/883f0e.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/dot/883f0e.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/dot/97c7ee.wgsl create mode 100644 test/tint/builtins/gen/var/dot/97c7ee.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/dot/97c7ee.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/dot/97c7ee.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/dot/97c7ee.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/dot/97c7ee.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/dot/ba4246.wgsl create mode 100644 test/tint/builtins/gen/var/dot/ba4246.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/dot/ba4246.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/dot/ba4246.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/dot/ba4246.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/dot/ba4246.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/dot/e994c7.wgsl create mode 100644 test/tint/builtins/gen/var/dot/e994c7.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/dot/e994c7.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/dot/e994c7.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/dot/e994c7.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/dot/e994c7.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/dot/ef6b1d.wgsl create mode 100644 test/tint/builtins/gen/var/dot/ef6b1d.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/dot/ef6b1d.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/dot/ef6b1d.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/dot/ef6b1d.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/dot/ef6b1d.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/dot/f1312c.wgsl create mode 100644 test/tint/builtins/gen/var/dot/f1312c.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/dot/f1312c.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/dot/f1312c.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/dot/f1312c.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/dot/f1312c.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/dot/fc5f7c.wgsl create mode 100644 test/tint/builtins/gen/var/dot/fc5f7c.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/dot/fc5f7c.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/dot/fc5f7c.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/dot/fc5f7c.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/dot/fc5f7c.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/dpdx/0763f7.wgsl create mode 100644 test/tint/builtins/gen/var/dpdx/0763f7.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/dpdx/0763f7.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/dpdx/0763f7.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/dpdx/0763f7.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/dpdx/0763f7.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/dpdx/99edb1.wgsl create mode 100644 test/tint/builtins/gen/var/dpdx/99edb1.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/dpdx/99edb1.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/dpdx/99edb1.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/dpdx/99edb1.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/dpdx/99edb1.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/dpdx/c487fa.wgsl create mode 100644 test/tint/builtins/gen/var/dpdx/c487fa.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/dpdx/c487fa.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/dpdx/c487fa.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/dpdx/c487fa.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/dpdx/c487fa.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/dpdx/e263de.wgsl create mode 100644 test/tint/builtins/gen/var/dpdx/e263de.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/dpdx/e263de.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/dpdx/e263de.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/dpdx/e263de.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/dpdx/e263de.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/dpdxCoarse/029152.wgsl create mode 100644 test/tint/builtins/gen/var/dpdxCoarse/029152.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/dpdxCoarse/029152.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/dpdxCoarse/029152.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/dpdxCoarse/029152.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/dpdxCoarse/029152.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/dpdxCoarse/9581cf.wgsl create mode 100644 test/tint/builtins/gen/var/dpdxCoarse/9581cf.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/dpdxCoarse/9581cf.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/dpdxCoarse/9581cf.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/dpdxCoarse/9581cf.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/dpdxCoarse/9581cf.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/dpdxCoarse/c28641.wgsl create mode 100644 test/tint/builtins/gen/var/dpdxCoarse/c28641.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/dpdxCoarse/c28641.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/dpdxCoarse/c28641.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/dpdxCoarse/c28641.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/dpdxCoarse/c28641.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/dpdxCoarse/f64d7b.wgsl create mode 100644 test/tint/builtins/gen/var/dpdxCoarse/f64d7b.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/dpdxCoarse/f64d7b.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/dpdxCoarse/f64d7b.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/dpdxCoarse/f64d7b.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/dpdxCoarse/f64d7b.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/dpdxFine/8c5069.wgsl create mode 100644 test/tint/builtins/gen/var/dpdxFine/8c5069.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/dpdxFine/8c5069.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/dpdxFine/8c5069.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/dpdxFine/8c5069.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/dpdxFine/8c5069.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/dpdxFine/9631de.wgsl create mode 100644 test/tint/builtins/gen/var/dpdxFine/9631de.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/dpdxFine/9631de.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/dpdxFine/9631de.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/dpdxFine/9631de.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/dpdxFine/9631de.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/dpdxFine/f401a2.wgsl create mode 100644 test/tint/builtins/gen/var/dpdxFine/f401a2.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/dpdxFine/f401a2.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/dpdxFine/f401a2.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/dpdxFine/f401a2.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/dpdxFine/f401a2.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/dpdxFine/f92fb6.wgsl create mode 100644 test/tint/builtins/gen/var/dpdxFine/f92fb6.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/dpdxFine/f92fb6.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/dpdxFine/f92fb6.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/dpdxFine/f92fb6.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/dpdxFine/f92fb6.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/dpdy/699a05.wgsl create mode 100644 test/tint/builtins/gen/var/dpdy/699a05.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/dpdy/699a05.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/dpdy/699a05.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/dpdy/699a05.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/dpdy/699a05.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/dpdy/7f8d84.wgsl create mode 100644 test/tint/builtins/gen/var/dpdy/7f8d84.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/dpdy/7f8d84.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/dpdy/7f8d84.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/dpdy/7f8d84.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/dpdy/7f8d84.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/dpdy/a8b56e.wgsl create mode 100644 test/tint/builtins/gen/var/dpdy/a8b56e.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/dpdy/a8b56e.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/dpdy/a8b56e.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/dpdy/a8b56e.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/dpdy/a8b56e.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/dpdy/feb40f.wgsl create mode 100644 test/tint/builtins/gen/var/dpdy/feb40f.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/dpdy/feb40f.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/dpdy/feb40f.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/dpdy/feb40f.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/dpdy/feb40f.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/dpdyCoarse/3e1ab4.wgsl create mode 100644 test/tint/builtins/gen/var/dpdyCoarse/3e1ab4.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/dpdyCoarse/3e1ab4.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/dpdyCoarse/3e1ab4.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/dpdyCoarse/3e1ab4.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/dpdyCoarse/3e1ab4.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/dpdyCoarse/445d24.wgsl create mode 100644 test/tint/builtins/gen/var/dpdyCoarse/445d24.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/dpdyCoarse/445d24.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/dpdyCoarse/445d24.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/dpdyCoarse/445d24.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/dpdyCoarse/445d24.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/dpdyCoarse/870a7e.wgsl create mode 100644 test/tint/builtins/gen/var/dpdyCoarse/870a7e.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/dpdyCoarse/870a7e.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/dpdyCoarse/870a7e.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/dpdyCoarse/870a7e.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/dpdyCoarse/870a7e.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/dpdyCoarse/ae1873.wgsl create mode 100644 test/tint/builtins/gen/var/dpdyCoarse/ae1873.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/dpdyCoarse/ae1873.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/dpdyCoarse/ae1873.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/dpdyCoarse/ae1873.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/dpdyCoarse/ae1873.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/dpdyFine/1fb7ab.wgsl create mode 100644 test/tint/builtins/gen/var/dpdyFine/1fb7ab.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/dpdyFine/1fb7ab.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/dpdyFine/1fb7ab.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/dpdyFine/1fb7ab.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/dpdyFine/1fb7ab.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/dpdyFine/6eb673.wgsl create mode 100644 test/tint/builtins/gen/var/dpdyFine/6eb673.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/dpdyFine/6eb673.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/dpdyFine/6eb673.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/dpdyFine/6eb673.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/dpdyFine/6eb673.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/dpdyFine/d0a648.wgsl create mode 100644 test/tint/builtins/gen/var/dpdyFine/d0a648.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/dpdyFine/d0a648.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/dpdyFine/d0a648.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/dpdyFine/d0a648.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/dpdyFine/d0a648.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/dpdyFine/df33aa.wgsl create mode 100644 test/tint/builtins/gen/var/dpdyFine/df33aa.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/dpdyFine/df33aa.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/dpdyFine/df33aa.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/dpdyFine/df33aa.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/dpdyFine/df33aa.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/exp/0f70eb.wgsl create mode 100644 test/tint/builtins/gen/var/exp/0f70eb.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/exp/0f70eb.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/exp/0f70eb.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/exp/0f70eb.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/exp/0f70eb.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/exp/1951e7.wgsl create mode 100644 test/tint/builtins/gen/var/exp/1951e7.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/exp/1951e7.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/exp/1951e7.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/exp/1951e7.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/exp/1951e7.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/exp/771fd2.wgsl create mode 100644 test/tint/builtins/gen/var/exp/771fd2.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/exp/771fd2.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/exp/771fd2.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/exp/771fd2.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/exp/771fd2.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/exp/d98450.wgsl create mode 100644 test/tint/builtins/gen/var/exp/d98450.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/exp/d98450.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/exp/d98450.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/exp/d98450.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/exp/d98450.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/exp2/1f8680.wgsl create mode 100644 test/tint/builtins/gen/var/exp2/1f8680.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/exp2/1f8680.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/exp2/1f8680.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/exp2/1f8680.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/exp2/1f8680.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/exp2/a9d0a7.wgsl create mode 100644 test/tint/builtins/gen/var/exp2/a9d0a7.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/exp2/a9d0a7.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/exp2/a9d0a7.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/exp2/a9d0a7.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/exp2/a9d0a7.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/exp2/d6777c.wgsl create mode 100644 test/tint/builtins/gen/var/exp2/d6777c.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/exp2/d6777c.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/exp2/d6777c.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/exp2/d6777c.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/exp2/d6777c.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/exp2/dea523.wgsl create mode 100644 test/tint/builtins/gen/var/exp2/dea523.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/exp2/dea523.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/exp2/dea523.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/exp2/dea523.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/exp2/dea523.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/extractBits/12b197.wgsl create mode 100644 test/tint/builtins/gen/var/extractBits/12b197.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/extractBits/12b197.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/extractBits/12b197.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/extractBits/12b197.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/extractBits/12b197.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/extractBits/249874.wgsl create mode 100644 test/tint/builtins/gen/var/extractBits/249874.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/extractBits/249874.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/extractBits/249874.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/extractBits/249874.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/extractBits/249874.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/extractBits/631377.wgsl create mode 100644 test/tint/builtins/gen/var/extractBits/631377.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/extractBits/631377.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/extractBits/631377.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/extractBits/631377.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/extractBits/631377.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/extractBits/a99a8d.wgsl create mode 100644 test/tint/builtins/gen/var/extractBits/a99a8d.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/extractBits/a99a8d.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/extractBits/a99a8d.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/extractBits/a99a8d.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/extractBits/a99a8d.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/extractBits/ce81f8.wgsl create mode 100644 test/tint/builtins/gen/var/extractBits/ce81f8.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/extractBits/ce81f8.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/extractBits/ce81f8.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/extractBits/ce81f8.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/extractBits/ce81f8.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/extractBits/e04f5d.wgsl create mode 100644 test/tint/builtins/gen/var/extractBits/e04f5d.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/extractBits/e04f5d.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/extractBits/e04f5d.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/extractBits/e04f5d.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/extractBits/e04f5d.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/extractBits/f28f69.wgsl create mode 100644 test/tint/builtins/gen/var/extractBits/f28f69.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/extractBits/f28f69.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/extractBits/f28f69.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/extractBits/f28f69.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/extractBits/f28f69.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/extractBits/fb850f.wgsl create mode 100644 test/tint/builtins/gen/var/extractBits/fb850f.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/extractBits/fb850f.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/extractBits/fb850f.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/extractBits/fb850f.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/extractBits/fb850f.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/faceForward/5afbd5.wgsl create mode 100644 test/tint/builtins/gen/var/faceForward/5afbd5.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/faceForward/5afbd5.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/faceForward/5afbd5.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/faceForward/5afbd5.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/faceForward/5afbd5.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/faceForward/b316e5.wgsl create mode 100644 test/tint/builtins/gen/var/faceForward/b316e5.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/faceForward/b316e5.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/faceForward/b316e5.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/faceForward/b316e5.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/faceForward/b316e5.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/faceForward/e6908b.wgsl create mode 100644 test/tint/builtins/gen/var/faceForward/e6908b.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/faceForward/e6908b.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/faceForward/e6908b.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/faceForward/e6908b.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/faceForward/e6908b.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/firstLeadingBit/000ff3.wgsl create mode 100644 test/tint/builtins/gen/var/firstLeadingBit/000ff3.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/firstLeadingBit/000ff3.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/firstLeadingBit/000ff3.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/firstLeadingBit/000ff3.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/firstLeadingBit/000ff3.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/firstLeadingBit/35053e.wgsl create mode 100644 test/tint/builtins/gen/var/firstLeadingBit/35053e.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/firstLeadingBit/35053e.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/firstLeadingBit/35053e.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/firstLeadingBit/35053e.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/firstLeadingBit/35053e.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/firstLeadingBit/3fd7d0.wgsl create mode 100644 test/tint/builtins/gen/var/firstLeadingBit/3fd7d0.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/firstLeadingBit/3fd7d0.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/firstLeadingBit/3fd7d0.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/firstLeadingBit/3fd7d0.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/firstLeadingBit/3fd7d0.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/firstLeadingBit/57a1a3.wgsl create mode 100644 test/tint/builtins/gen/var/firstLeadingBit/57a1a3.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/firstLeadingBit/57a1a3.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/firstLeadingBit/57a1a3.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/firstLeadingBit/57a1a3.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/firstLeadingBit/57a1a3.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/firstLeadingBit/6fe804.wgsl create mode 100644 test/tint/builtins/gen/var/firstLeadingBit/6fe804.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/firstLeadingBit/6fe804.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/firstLeadingBit/6fe804.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/firstLeadingBit/6fe804.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/firstLeadingBit/6fe804.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/firstLeadingBit/a622c2.wgsl create mode 100644 test/tint/builtins/gen/var/firstLeadingBit/a622c2.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/firstLeadingBit/a622c2.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/firstLeadingBit/a622c2.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/firstLeadingBit/a622c2.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/firstLeadingBit/a622c2.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/firstLeadingBit/c1f940.wgsl create mode 100644 test/tint/builtins/gen/var/firstLeadingBit/c1f940.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/firstLeadingBit/c1f940.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/firstLeadingBit/c1f940.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/firstLeadingBit/c1f940.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/firstLeadingBit/c1f940.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/firstLeadingBit/f0779d.wgsl create mode 100644 test/tint/builtins/gen/var/firstLeadingBit/f0779d.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/firstLeadingBit/f0779d.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/firstLeadingBit/f0779d.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/firstLeadingBit/f0779d.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/firstLeadingBit/f0779d.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/firstTrailingBit/110f2c.wgsl create mode 100644 test/tint/builtins/gen/var/firstTrailingBit/110f2c.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/firstTrailingBit/110f2c.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/firstTrailingBit/110f2c.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/firstTrailingBit/110f2c.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/firstTrailingBit/110f2c.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/firstTrailingBit/3a2acc.wgsl create mode 100644 test/tint/builtins/gen/var/firstTrailingBit/3a2acc.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/firstTrailingBit/3a2acc.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/firstTrailingBit/3a2acc.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/firstTrailingBit/3a2acc.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/firstTrailingBit/3a2acc.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/firstTrailingBit/45eb10.wgsl create mode 100644 test/tint/builtins/gen/var/firstTrailingBit/45eb10.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/firstTrailingBit/45eb10.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/firstTrailingBit/45eb10.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/firstTrailingBit/45eb10.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/firstTrailingBit/45eb10.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/firstTrailingBit/47d475.wgsl create mode 100644 test/tint/builtins/gen/var/firstTrailingBit/47d475.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/firstTrailingBit/47d475.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/firstTrailingBit/47d475.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/firstTrailingBit/47d475.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/firstTrailingBit/47d475.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/firstTrailingBit/50c072.wgsl create mode 100644 test/tint/builtins/gen/var/firstTrailingBit/50c072.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/firstTrailingBit/50c072.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/firstTrailingBit/50c072.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/firstTrailingBit/50c072.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/firstTrailingBit/50c072.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/firstTrailingBit/7496d6.wgsl create mode 100644 test/tint/builtins/gen/var/firstTrailingBit/7496d6.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/firstTrailingBit/7496d6.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/firstTrailingBit/7496d6.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/firstTrailingBit/7496d6.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/firstTrailingBit/7496d6.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/firstTrailingBit/86551b.wgsl create mode 100644 test/tint/builtins/gen/var/firstTrailingBit/86551b.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/firstTrailingBit/86551b.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/firstTrailingBit/86551b.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/firstTrailingBit/86551b.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/firstTrailingBit/86551b.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/firstTrailingBit/cb51ce.wgsl create mode 100644 test/tint/builtins/gen/var/firstTrailingBit/cb51ce.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/firstTrailingBit/cb51ce.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/firstTrailingBit/cb51ce.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/firstTrailingBit/cb51ce.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/firstTrailingBit/cb51ce.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/floor/3bccc4.wgsl create mode 100644 test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/floor/5fc9ac.wgsl create mode 100644 test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/floor/60d7ea.wgsl create mode 100644 test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/floor/66f154.wgsl create mode 100644 test/tint/builtins/gen/var/floor/66f154.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/floor/66f154.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/floor/66f154.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/floor/66f154.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/floor/66f154.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/fma/26a7a9.wgsl create mode 100644 test/tint/builtins/gen/var/fma/26a7a9.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/fma/26a7a9.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/fma/26a7a9.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/fma/26a7a9.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/fma/26a7a9.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/fma/6a3283.wgsl create mode 100644 test/tint/builtins/gen/var/fma/6a3283.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/fma/6a3283.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/fma/6a3283.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/fma/6a3283.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/fma/6a3283.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/fma/c10ba3.wgsl create mode 100644 test/tint/builtins/gen/var/fma/c10ba3.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/fma/c10ba3.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/fma/c10ba3.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/fma/c10ba3.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/fma/c10ba3.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/fma/e17c5c.wgsl create mode 100644 test/tint/builtins/gen/var/fma/e17c5c.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/fma/e17c5c.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/fma/e17c5c.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/fma/e17c5c.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/fma/e17c5c.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/fract/8bc1e9.wgsl create mode 100644 test/tint/builtins/gen/var/fract/8bc1e9.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/fract/8bc1e9.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/fract/8bc1e9.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/fract/8bc1e9.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/fract/8bc1e9.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/fract/943cb1.wgsl create mode 100644 test/tint/builtins/gen/var/fract/943cb1.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/fract/943cb1.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/fract/943cb1.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/fract/943cb1.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/fract/943cb1.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/fract/a49758.wgsl create mode 100644 test/tint/builtins/gen/var/fract/a49758.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/fract/a49758.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/fract/a49758.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/fract/a49758.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/fract/a49758.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/fract/fa5c71.wgsl create mode 100644 test/tint/builtins/gen/var/fract/fa5c71.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/fract/fa5c71.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/fract/fa5c71.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/fract/fa5c71.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/fract/fa5c71.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/frexp/368997.wgsl create mode 100644 test/tint/builtins/gen/var/frexp/368997.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/frexp/368997.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/frexp/368997.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/frexp/368997.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/frexp/368997.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/frexp/3c4f48.wgsl create mode 100644 test/tint/builtins/gen/var/frexp/3c4f48.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/frexp/3c4f48.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/frexp/3c4f48.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/frexp/3c4f48.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/frexp/3c4f48.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/frexp/4bdfc7.wgsl create mode 100644 test/tint/builtins/gen/var/frexp/4bdfc7.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/frexp/4bdfc7.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/frexp/4bdfc7.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/frexp/4bdfc7.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/frexp/4bdfc7.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/frexp/eabd40.wgsl create mode 100644 test/tint/builtins/gen/var/frexp/eabd40.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/frexp/eabd40.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/frexp/eabd40.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/frexp/eabd40.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/frexp/eabd40.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/fwidth/5d1b39.wgsl create mode 100644 test/tint/builtins/gen/var/fwidth/5d1b39.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/fwidth/5d1b39.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/fwidth/5d1b39.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/fwidth/5d1b39.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/fwidth/5d1b39.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/fwidth/b83ebb.wgsl create mode 100644 test/tint/builtins/gen/var/fwidth/b83ebb.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/fwidth/b83ebb.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/fwidth/b83ebb.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/fwidth/b83ebb.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/fwidth/b83ebb.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/fwidth/d2ab9a.wgsl create mode 100644 test/tint/builtins/gen/var/fwidth/d2ab9a.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/fwidth/d2ab9a.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/fwidth/d2ab9a.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/fwidth/d2ab9a.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/fwidth/d2ab9a.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/fwidth/df38ef.wgsl create mode 100644 test/tint/builtins/gen/var/fwidth/df38ef.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/fwidth/df38ef.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/fwidth/df38ef.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/fwidth/df38ef.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/fwidth/df38ef.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/fwidthCoarse/159c8a.wgsl create mode 100644 test/tint/builtins/gen/var/fwidthCoarse/159c8a.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/fwidthCoarse/159c8a.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/fwidthCoarse/159c8a.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/fwidthCoarse/159c8a.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/fwidthCoarse/159c8a.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/fwidthCoarse/1e59d9.wgsl create mode 100644 test/tint/builtins/gen/var/fwidthCoarse/1e59d9.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/fwidthCoarse/1e59d9.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/fwidthCoarse/1e59d9.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/fwidthCoarse/1e59d9.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/fwidthCoarse/1e59d9.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/fwidthCoarse/4e4fc4.wgsl create mode 100644 test/tint/builtins/gen/var/fwidthCoarse/4e4fc4.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/fwidthCoarse/4e4fc4.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/fwidthCoarse/4e4fc4.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/fwidthCoarse/4e4fc4.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/fwidthCoarse/4e4fc4.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/fwidthCoarse/e653f7.wgsl create mode 100644 test/tint/builtins/gen/var/fwidthCoarse/e653f7.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/fwidthCoarse/e653f7.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/fwidthCoarse/e653f7.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/fwidthCoarse/e653f7.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/fwidthCoarse/e653f7.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/fwidthFine/523fdc.wgsl create mode 100644 test/tint/builtins/gen/var/fwidthFine/523fdc.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/fwidthFine/523fdc.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/fwidthFine/523fdc.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/fwidthFine/523fdc.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/fwidthFine/523fdc.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/fwidthFine/68f4ef.wgsl create mode 100644 test/tint/builtins/gen/var/fwidthFine/68f4ef.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/fwidthFine/68f4ef.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/fwidthFine/68f4ef.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/fwidthFine/68f4ef.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/fwidthFine/68f4ef.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/fwidthFine/f1742d.wgsl create mode 100644 test/tint/builtins/gen/var/fwidthFine/f1742d.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/fwidthFine/f1742d.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/fwidthFine/f1742d.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/fwidthFine/f1742d.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/fwidthFine/f1742d.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/fwidthFine/ff6aa0.wgsl create mode 100644 test/tint/builtins/gen/var/fwidthFine/ff6aa0.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/fwidthFine/ff6aa0.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/fwidthFine/ff6aa0.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/fwidthFine/ff6aa0.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/fwidthFine/ff6aa0.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/insertBits/3c7ba5.wgsl create mode 100644 test/tint/builtins/gen/var/insertBits/3c7ba5.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/insertBits/3c7ba5.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/insertBits/3c7ba5.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/insertBits/3c7ba5.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/insertBits/3c7ba5.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/insertBits/428b0b.wgsl create mode 100644 test/tint/builtins/gen/var/insertBits/428b0b.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/insertBits/428b0b.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/insertBits/428b0b.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/insertBits/428b0b.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/insertBits/428b0b.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/insertBits/51ede1.wgsl create mode 100644 test/tint/builtins/gen/var/insertBits/51ede1.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/insertBits/51ede1.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/insertBits/51ede1.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/insertBits/51ede1.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/insertBits/51ede1.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/insertBits/65468b.wgsl create mode 100644 test/tint/builtins/gen/var/insertBits/65468b.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/insertBits/65468b.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/insertBits/65468b.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/insertBits/65468b.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/insertBits/65468b.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/insertBits/87826b.wgsl create mode 100644 test/tint/builtins/gen/var/insertBits/87826b.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/insertBits/87826b.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/insertBits/87826b.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/insertBits/87826b.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/insertBits/87826b.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/insertBits/d86978.wgsl create mode 100644 test/tint/builtins/gen/var/insertBits/d86978.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/insertBits/d86978.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/insertBits/d86978.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/insertBits/d86978.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/insertBits/d86978.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/insertBits/e3e3a2.wgsl create mode 100644 test/tint/builtins/gen/var/insertBits/e3e3a2.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/insertBits/e3e3a2.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/insertBits/e3e3a2.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/insertBits/e3e3a2.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/insertBits/e3e3a2.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/insertBits/fe6ba6.wgsl create mode 100644 test/tint/builtins/gen/var/insertBits/fe6ba6.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/insertBits/fe6ba6.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/insertBits/fe6ba6.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/insertBits/fe6ba6.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/insertBits/fe6ba6.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/inverseSqrt/84407e.wgsl create mode 100644 test/tint/builtins/gen/var/inverseSqrt/84407e.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/inverseSqrt/84407e.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/inverseSqrt/84407e.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/inverseSqrt/84407e.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/inverseSqrt/84407e.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/inverseSqrt/8f2bd2.wgsl create mode 100644 test/tint/builtins/gen/var/inverseSqrt/8f2bd2.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/inverseSqrt/8f2bd2.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/inverseSqrt/8f2bd2.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/inverseSqrt/8f2bd2.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/inverseSqrt/8f2bd2.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/inverseSqrt/b197b1.wgsl create mode 100644 test/tint/builtins/gen/var/inverseSqrt/b197b1.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/inverseSqrt/b197b1.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/inverseSqrt/b197b1.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/inverseSqrt/b197b1.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/inverseSqrt/b197b1.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/inverseSqrt/c22347.wgsl create mode 100644 test/tint/builtins/gen/var/inverseSqrt/c22347.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/inverseSqrt/c22347.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/inverseSqrt/c22347.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/inverseSqrt/c22347.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/inverseSqrt/c22347.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/ldexp/a31cdc.wgsl create mode 100644 test/tint/builtins/gen/var/ldexp/a31cdc.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/ldexp/a31cdc.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/ldexp/a31cdc.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/ldexp/a31cdc.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/ldexp/a31cdc.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/ldexp/abd718.wgsl create mode 100644 test/tint/builtins/gen/var/ldexp/abd718.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/ldexp/abd718.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/ldexp/abd718.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/ldexp/abd718.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/ldexp/abd718.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/ldexp/cc9cde.wgsl create mode 100644 test/tint/builtins/gen/var/ldexp/cc9cde.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/ldexp/cc9cde.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/ldexp/cc9cde.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/ldexp/cc9cde.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/ldexp/cc9cde.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/ldexp/db8b49.wgsl create mode 100644 test/tint/builtins/gen/var/ldexp/db8b49.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/ldexp/db8b49.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/ldexp/db8b49.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/ldexp/db8b49.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/ldexp/db8b49.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/length/056071.wgsl create mode 100644 test/tint/builtins/gen/var/length/056071.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/length/056071.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/length/056071.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/length/056071.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/length/056071.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/length/602a17.wgsl create mode 100644 test/tint/builtins/gen/var/length/602a17.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/length/602a17.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/length/602a17.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/length/602a17.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/length/602a17.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/length/afde8b.wgsl create mode 100644 test/tint/builtins/gen/var/length/afde8b.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/length/afde8b.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/length/afde8b.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/length/afde8b.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/length/afde8b.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/length/becebf.wgsl create mode 100644 test/tint/builtins/gen/var/length/becebf.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/length/becebf.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/length/becebf.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/length/becebf.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/length/becebf.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/log/3da25a.wgsl create mode 100644 test/tint/builtins/gen/var/log/3da25a.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/log/3da25a.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/log/3da25a.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/log/3da25a.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/log/3da25a.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/log/7114a6.wgsl create mode 100644 test/tint/builtins/gen/var/log/7114a6.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/log/7114a6.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/log/7114a6.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/log/7114a6.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/log/7114a6.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/log/b2ce28.wgsl create mode 100644 test/tint/builtins/gen/var/log/b2ce28.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/log/b2ce28.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/log/b2ce28.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/log/b2ce28.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/log/b2ce28.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/log/f4c570.wgsl create mode 100644 test/tint/builtins/gen/var/log/f4c570.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/log/f4c570.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/log/f4c570.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/log/f4c570.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/log/f4c570.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/log2/4036ed.wgsl create mode 100644 test/tint/builtins/gen/var/log2/4036ed.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/log2/4036ed.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/log2/4036ed.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/log2/4036ed.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/log2/4036ed.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/log2/902988.wgsl create mode 100644 test/tint/builtins/gen/var/log2/902988.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/log2/902988.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/log2/902988.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/log2/902988.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/log2/902988.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/log2/adb233.wgsl create mode 100644 test/tint/builtins/gen/var/log2/adb233.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/log2/adb233.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/log2/adb233.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/log2/adb233.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/log2/adb233.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/log2/aea659.wgsl create mode 100644 test/tint/builtins/gen/var/log2/aea659.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/log2/aea659.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/log2/aea659.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/log2/aea659.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/log2/aea659.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/max/0c0aae.wgsl create mode 100644 test/tint/builtins/gen/var/max/0c0aae.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/max/0c0aae.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/max/0c0aae.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/max/0c0aae.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/max/0c0aae.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/max/25eafe.wgsl create mode 100644 test/tint/builtins/gen/var/max/25eafe.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/max/25eafe.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/max/25eafe.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/max/25eafe.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/max/25eafe.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/max/320815.wgsl create mode 100644 test/tint/builtins/gen/var/max/320815.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/max/320815.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/max/320815.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/max/320815.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/max/320815.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/max/44a39d.wgsl create mode 100644 test/tint/builtins/gen/var/max/44a39d.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/max/44a39d.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/max/44a39d.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/max/44a39d.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/max/44a39d.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/max/453e04.wgsl create mode 100644 test/tint/builtins/gen/var/max/453e04.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/max/453e04.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/max/453e04.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/max/453e04.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/max/453e04.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/max/462050.wgsl create mode 100644 test/tint/builtins/gen/var/max/462050.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/max/462050.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/max/462050.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/max/462050.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/max/462050.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/max/4883ac.wgsl create mode 100644 test/tint/builtins/gen/var/max/4883ac.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/max/4883ac.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/max/4883ac.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/max/4883ac.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/max/4883ac.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/max/85e6bc.wgsl create mode 100644 test/tint/builtins/gen/var/max/85e6bc.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/max/85e6bc.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/max/85e6bc.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/max/85e6bc.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/max/85e6bc.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/max/a93419.wgsl create mode 100644 test/tint/builtins/gen/var/max/a93419.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/max/a93419.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/max/a93419.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/max/a93419.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/max/a93419.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/max/b1b73a.wgsl create mode 100644 test/tint/builtins/gen/var/max/b1b73a.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/max/b1b73a.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/max/b1b73a.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/max/b1b73a.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/max/b1b73a.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/max/ce7c30.wgsl create mode 100644 test/tint/builtins/gen/var/max/ce7c30.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/max/ce7c30.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/max/ce7c30.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/max/ce7c30.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/max/ce7c30.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/max/e8192f.wgsl create mode 100644 test/tint/builtins/gen/var/max/e8192f.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/max/e8192f.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/max/e8192f.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/max/e8192f.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/max/e8192f.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/min/03c7e3.wgsl create mode 100644 test/tint/builtins/gen/var/min/03c7e3.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/min/03c7e3.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/min/03c7e3.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/min/03c7e3.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/min/03c7e3.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/min/0dc614.wgsl create mode 100644 test/tint/builtins/gen/var/min/0dc614.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/min/0dc614.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/min/0dc614.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/min/0dc614.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/min/0dc614.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/min/3941e1.wgsl create mode 100644 test/tint/builtins/gen/var/min/3941e1.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/min/3941e1.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/min/3941e1.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/min/3941e1.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/min/3941e1.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/min/46c5d3.wgsl create mode 100644 test/tint/builtins/gen/var/min/46c5d3.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/min/46c5d3.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/min/46c5d3.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/min/46c5d3.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/min/46c5d3.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/min/82b28f.wgsl create mode 100644 test/tint/builtins/gen/var/min/82b28f.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/min/82b28f.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/min/82b28f.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/min/82b28f.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/min/82b28f.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/min/93cfc4.wgsl create mode 100644 test/tint/builtins/gen/var/min/93cfc4.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/min/93cfc4.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/min/93cfc4.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/min/93cfc4.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/min/93cfc4.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/min/a45171.wgsl create mode 100644 test/tint/builtins/gen/var/min/a45171.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/min/a45171.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/min/a45171.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/min/a45171.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/min/a45171.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/min/aa28ad.wgsl create mode 100644 test/tint/builtins/gen/var/min/aa28ad.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/min/aa28ad.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/min/aa28ad.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/min/aa28ad.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/min/aa28ad.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/min/af326d.wgsl create mode 100644 test/tint/builtins/gen/var/min/af326d.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/min/af326d.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/min/af326d.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/min/af326d.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/min/af326d.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/min/c70bb7.wgsl create mode 100644 test/tint/builtins/gen/var/min/c70bb7.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/min/c70bb7.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/min/c70bb7.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/min/c70bb7.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/min/c70bb7.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/min/c73147.wgsl create mode 100644 test/tint/builtins/gen/var/min/c73147.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/min/c73147.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/min/c73147.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/min/c73147.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/min/c73147.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/min/c76fa6.wgsl create mode 100644 test/tint/builtins/gen/var/min/c76fa6.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/min/c76fa6.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/min/c76fa6.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/min/c76fa6.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/min/c76fa6.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/mix/0c8c33.wgsl create mode 100644 test/tint/builtins/gen/var/mix/0c8c33.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/mix/0c8c33.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/mix/0c8c33.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/mix/0c8c33.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/mix/0c8c33.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/mix/1faeb1.wgsl create mode 100644 test/tint/builtins/gen/var/mix/1faeb1.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/mix/1faeb1.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/mix/1faeb1.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/mix/1faeb1.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/mix/1faeb1.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/mix/2fadab.wgsl create mode 100644 test/tint/builtins/gen/var/mix/2fadab.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/mix/2fadab.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/mix/2fadab.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/mix/2fadab.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/mix/2fadab.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/mix/315264.wgsl create mode 100644 test/tint/builtins/gen/var/mix/315264.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/mix/315264.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/mix/315264.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/mix/315264.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/mix/315264.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/mix/4f0b5e.wgsl create mode 100644 test/tint/builtins/gen/var/mix/4f0b5e.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/mix/4f0b5e.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/mix/4f0b5e.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/mix/4f0b5e.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/mix/4f0b5e.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/mix/6f8adc.wgsl create mode 100644 test/tint/builtins/gen/var/mix/6f8adc.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/mix/6f8adc.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/mix/6f8adc.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/mix/6f8adc.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/mix/6f8adc.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/mix/c37ede.wgsl create mode 100644 test/tint/builtins/gen/var/mix/c37ede.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/mix/c37ede.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/mix/c37ede.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/mix/c37ede.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/mix/c37ede.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/modf/180fed.wgsl create mode 100644 test/tint/builtins/gen/var/modf/180fed.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/modf/180fed.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/modf/180fed.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/modf/180fed.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/modf/180fed.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/modf/9b75f7.wgsl create mode 100644 test/tint/builtins/gen/var/modf/9b75f7.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/modf/9b75f7.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/modf/9b75f7.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/modf/9b75f7.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/modf/9b75f7.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/modf/ec2dbc.wgsl create mode 100644 test/tint/builtins/gen/var/modf/ec2dbc.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/modf/ec2dbc.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/modf/ec2dbc.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/modf/ec2dbc.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/modf/ec2dbc.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/modf/f5f20d.wgsl create mode 100644 test/tint/builtins/gen/var/modf/f5f20d.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/modf/f5f20d.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/modf/f5f20d.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/modf/f5f20d.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/modf/f5f20d.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/normalize/64d8c0.wgsl create mode 100644 test/tint/builtins/gen/var/normalize/64d8c0.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/normalize/64d8c0.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/normalize/64d8c0.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/normalize/64d8c0.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/normalize/64d8c0.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/normalize/9a0aab.wgsl create mode 100644 test/tint/builtins/gen/var/normalize/9a0aab.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/normalize/9a0aab.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/normalize/9a0aab.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/normalize/9a0aab.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/normalize/9a0aab.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/normalize/fc2ef1.wgsl create mode 100644 test/tint/builtins/gen/var/normalize/fc2ef1.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/normalize/fc2ef1.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/normalize/fc2ef1.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/normalize/fc2ef1.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/normalize/fc2ef1.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/pack2x16float/0e97b3.wgsl create mode 100644 test/tint/builtins/gen/var/pack2x16float/0e97b3.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/pack2x16float/0e97b3.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/pack2x16float/0e97b3.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/pack2x16float/0e97b3.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/pack2x16float/0e97b3.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/pack2x16snorm/6c169b.wgsl create mode 100644 test/tint/builtins/gen/var/pack2x16snorm/6c169b.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/pack2x16snorm/6c169b.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/pack2x16snorm/6c169b.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/pack2x16snorm/6c169b.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/pack2x16snorm/6c169b.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/pack2x16unorm/0f08e4.wgsl create mode 100644 test/tint/builtins/gen/var/pack2x16unorm/0f08e4.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/pack2x16unorm/0f08e4.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/pack2x16unorm/0f08e4.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/pack2x16unorm/0f08e4.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/pack2x16unorm/0f08e4.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/pack4x8snorm/4d22e7.wgsl create mode 100644 test/tint/builtins/gen/var/pack4x8snorm/4d22e7.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/pack4x8snorm/4d22e7.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/pack4x8snorm/4d22e7.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/pack4x8snorm/4d22e7.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/pack4x8snorm/4d22e7.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/pack4x8unorm/95c456.wgsl create mode 100644 test/tint/builtins/gen/var/pack4x8unorm/95c456.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/pack4x8unorm/95c456.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/pack4x8unorm/95c456.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/pack4x8unorm/95c456.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/pack4x8unorm/95c456.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/pow/04a908.wgsl create mode 100644 test/tint/builtins/gen/var/pow/04a908.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/pow/04a908.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/pow/04a908.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/pow/04a908.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/pow/04a908.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/pow/46e029.wgsl create mode 100644 test/tint/builtins/gen/var/pow/46e029.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/pow/46e029.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/pow/46e029.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/pow/46e029.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/pow/46e029.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/pow/4a46c9.wgsl create mode 100644 test/tint/builtins/gen/var/pow/4a46c9.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/pow/4a46c9.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/pow/4a46c9.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/pow/4a46c9.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/pow/4a46c9.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/pow/e60ea5.wgsl create mode 100644 test/tint/builtins/gen/var/pow/e60ea5.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/pow/e60ea5.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/pow/e60ea5.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/pow/e60ea5.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/pow/e60ea5.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/radians/09b7fc.wgsl create mode 100644 test/tint/builtins/gen/var/radians/09b7fc.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/radians/09b7fc.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/radians/09b7fc.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/radians/09b7fc.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/radians/09b7fc.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/radians/61687a.wgsl create mode 100644 test/tint/builtins/gen/var/radians/61687a.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/radians/61687a.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/radians/61687a.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/radians/61687a.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/radians/61687a.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/radians/6b0ff2.wgsl create mode 100644 test/tint/builtins/gen/var/radians/6b0ff2.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/radians/6b0ff2.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/radians/6b0ff2.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/radians/6b0ff2.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/radians/6b0ff2.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/radians/f96258.wgsl create mode 100644 test/tint/builtins/gen/var/radians/f96258.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/radians/f96258.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/radians/f96258.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/radians/f96258.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/radians/f96258.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/reflect/05357e.wgsl create mode 100644 test/tint/builtins/gen/var/reflect/05357e.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/reflect/05357e.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/reflect/05357e.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/reflect/05357e.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/reflect/05357e.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/reflect/b61e10.wgsl create mode 100644 test/tint/builtins/gen/var/reflect/b61e10.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/reflect/b61e10.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/reflect/b61e10.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/reflect/b61e10.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/reflect/b61e10.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/reflect/f47fdb.wgsl create mode 100644 test/tint/builtins/gen/var/reflect/f47fdb.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/reflect/f47fdb.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/reflect/f47fdb.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/reflect/f47fdb.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/reflect/f47fdb.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/refract/7e02e6.wgsl create mode 100644 test/tint/builtins/gen/var/refract/7e02e6.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/refract/7e02e6.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/refract/7e02e6.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/refract/7e02e6.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/refract/7e02e6.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/refract/cbc1d2.wgsl create mode 100644 test/tint/builtins/gen/var/refract/cbc1d2.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/refract/cbc1d2.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/refract/cbc1d2.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/refract/cbc1d2.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/refract/cbc1d2.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/refract/cd905f.wgsl create mode 100644 test/tint/builtins/gen/var/refract/cd905f.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/refract/cd905f.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/refract/cd905f.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/refract/cd905f.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/refract/cd905f.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/reverseBits/222177.wgsl create mode 100644 test/tint/builtins/gen/var/reverseBits/222177.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/reverseBits/222177.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/reverseBits/222177.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/reverseBits/222177.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/reverseBits/222177.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/reverseBits/35fea9.wgsl create mode 100644 test/tint/builtins/gen/var/reverseBits/35fea9.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/reverseBits/35fea9.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/reverseBits/35fea9.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/reverseBits/35fea9.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/reverseBits/35fea9.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/reverseBits/4dbd6f.wgsl create mode 100644 test/tint/builtins/gen/var/reverseBits/4dbd6f.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/reverseBits/4dbd6f.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/reverseBits/4dbd6f.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/reverseBits/4dbd6f.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/reverseBits/4dbd6f.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/reverseBits/7c4269.wgsl create mode 100644 test/tint/builtins/gen/var/reverseBits/7c4269.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/reverseBits/7c4269.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/reverseBits/7c4269.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/reverseBits/7c4269.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/reverseBits/7c4269.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/reverseBits/a6ccd4.wgsl create mode 100644 test/tint/builtins/gen/var/reverseBits/a6ccd4.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/reverseBits/a6ccd4.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/reverseBits/a6ccd4.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/reverseBits/a6ccd4.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/reverseBits/a6ccd4.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/reverseBits/c21bc1.wgsl create mode 100644 test/tint/builtins/gen/var/reverseBits/c21bc1.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/reverseBits/c21bc1.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/reverseBits/c21bc1.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/reverseBits/c21bc1.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/reverseBits/c21bc1.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/reverseBits/e1f4c1.wgsl create mode 100644 test/tint/builtins/gen/var/reverseBits/e1f4c1.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/reverseBits/e1f4c1.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/reverseBits/e1f4c1.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/reverseBits/e1f4c1.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/reverseBits/e1f4c1.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/reverseBits/e31adf.wgsl create mode 100644 test/tint/builtins/gen/var/reverseBits/e31adf.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/reverseBits/e31adf.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/reverseBits/e31adf.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/reverseBits/e31adf.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/reverseBits/e31adf.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/round/106c0b.wgsl create mode 100644 test/tint/builtins/gen/var/round/106c0b.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/round/106c0b.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/round/106c0b.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/round/106c0b.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/round/106c0b.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/round/1c7897.wgsl create mode 100644 test/tint/builtins/gen/var/round/1c7897.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/round/1c7897.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/round/1c7897.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/round/1c7897.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/round/1c7897.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/round/52c84d.wgsl create mode 100644 test/tint/builtins/gen/var/round/52c84d.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/round/52c84d.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/round/52c84d.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/round/52c84d.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/round/52c84d.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/round/9edc38.wgsl create mode 100644 test/tint/builtins/gen/var/round/9edc38.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/round/9edc38.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/round/9edc38.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/round/9edc38.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/round/9edc38.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/select/00b848.wgsl create mode 100644 test/tint/builtins/gen/var/select/00b848.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/select/00b848.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/select/00b848.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/select/00b848.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/select/00b848.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/select/01e2cd.wgsl create mode 100644 test/tint/builtins/gen/var/select/01e2cd.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/select/01e2cd.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/select/01e2cd.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/select/01e2cd.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/select/01e2cd.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/select/087ea4.wgsl create mode 100644 test/tint/builtins/gen/var/select/087ea4.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/select/087ea4.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/select/087ea4.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/select/087ea4.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/select/087ea4.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/select/1e960b.wgsl create mode 100644 test/tint/builtins/gen/var/select/1e960b.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/select/1e960b.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/select/1e960b.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/select/1e960b.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/select/1e960b.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/select/266aff.wgsl create mode 100644 test/tint/builtins/gen/var/select/266aff.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/select/266aff.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/select/266aff.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/select/266aff.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/select/266aff.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/select/28a27e.wgsl create mode 100644 test/tint/builtins/gen/var/select/28a27e.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/select/28a27e.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/select/28a27e.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/select/28a27e.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/select/28a27e.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/select/3c25ce.wgsl create mode 100644 test/tint/builtins/gen/var/select/3c25ce.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/select/3c25ce.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/select/3c25ce.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/select/3c25ce.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/select/3c25ce.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/select/416e14.wgsl create mode 100644 test/tint/builtins/gen/var/select/416e14.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/select/416e14.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/select/416e14.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/select/416e14.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/select/416e14.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/select/51b047.wgsl create mode 100644 test/tint/builtins/gen/var/select/51b047.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/select/51b047.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/select/51b047.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/select/51b047.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/select/51b047.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/select/713567.wgsl create mode 100644 test/tint/builtins/gen/var/select/713567.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/select/713567.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/select/713567.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/select/713567.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/select/713567.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/select/78be5f.wgsl create mode 100644 test/tint/builtins/gen/var/select/78be5f.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/select/78be5f.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/select/78be5f.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/select/78be5f.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/select/78be5f.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/select/80a9a9.wgsl create mode 100644 test/tint/builtins/gen/var/select/80a9a9.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/select/80a9a9.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/select/80a9a9.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/select/80a9a9.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/select/80a9a9.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/select/8fa62c.wgsl create mode 100644 test/tint/builtins/gen/var/select/8fa62c.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/select/8fa62c.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/select/8fa62c.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/select/8fa62c.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/select/8fa62c.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/select/99f883.wgsl create mode 100644 test/tint/builtins/gen/var/select/99f883.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/select/99f883.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/select/99f883.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/select/99f883.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/select/99f883.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/select/a2860e.wgsl create mode 100644 test/tint/builtins/gen/var/select/a2860e.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/select/a2860e.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/select/a2860e.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/select/a2860e.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/select/a2860e.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/select/ab069f.wgsl create mode 100644 test/tint/builtins/gen/var/select/ab069f.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/select/ab069f.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/select/ab069f.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/select/ab069f.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/select/ab069f.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/select/b04721.wgsl create mode 100644 test/tint/builtins/gen/var/select/b04721.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/select/b04721.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/select/b04721.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/select/b04721.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/select/b04721.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/select/bb447f.wgsl create mode 100644 test/tint/builtins/gen/var/select/bb447f.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/select/bb447f.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/select/bb447f.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/select/bb447f.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/select/bb447f.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/select/bb8aae.wgsl create mode 100644 test/tint/builtins/gen/var/select/bb8aae.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/select/bb8aae.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/select/bb8aae.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/select/bb8aae.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/select/bb8aae.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/select/bf3d29.wgsl create mode 100644 test/tint/builtins/gen/var/select/bf3d29.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/select/bf3d29.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/select/bf3d29.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/select/bf3d29.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/select/bf3d29.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/select/c31f9e.wgsl create mode 100644 test/tint/builtins/gen/var/select/c31f9e.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/select/c31f9e.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/select/c31f9e.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/select/c31f9e.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/select/c31f9e.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/select/c41bd1.wgsl create mode 100644 test/tint/builtins/gen/var/select/c41bd1.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/select/c41bd1.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/select/c41bd1.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/select/c41bd1.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/select/c41bd1.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/select/c4a4ef.wgsl create mode 100644 test/tint/builtins/gen/var/select/c4a4ef.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/select/c4a4ef.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/select/c4a4ef.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/select/c4a4ef.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/select/c4a4ef.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/select/cb9301.wgsl create mode 100644 test/tint/builtins/gen/var/select/cb9301.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/select/cb9301.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/select/cb9301.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/select/cb9301.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/select/cb9301.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/select/e3e028.wgsl create mode 100644 test/tint/builtins/gen/var/select/e3e028.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/select/e3e028.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/select/e3e028.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/select/e3e028.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/select/e3e028.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/select/ebfea2.wgsl create mode 100644 test/tint/builtins/gen/var/select/ebfea2.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/select/ebfea2.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/select/ebfea2.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/select/ebfea2.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/select/ebfea2.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/select/ed8a15.wgsl create mode 100644 test/tint/builtins/gen/var/select/ed8a15.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/select/ed8a15.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/select/ed8a15.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/select/ed8a15.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/select/ed8a15.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/select/fb7e53.wgsl create mode 100644 test/tint/builtins/gen/var/select/fb7e53.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/select/fb7e53.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/select/fb7e53.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/select/fb7e53.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/select/fb7e53.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/sign/159665.wgsl create mode 100644 test/tint/builtins/gen/var/sign/159665.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/sign/159665.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/sign/159665.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/sign/159665.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/sign/159665.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/sign/b8f634.wgsl create mode 100644 test/tint/builtins/gen/var/sign/b8f634.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/sign/b8f634.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/sign/b8f634.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/sign/b8f634.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/sign/b8f634.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/sign/d065d8.wgsl create mode 100644 test/tint/builtins/gen/var/sign/d065d8.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/sign/d065d8.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/sign/d065d8.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/sign/d065d8.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/sign/d065d8.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/sign/dd790e.wgsl create mode 100644 test/tint/builtins/gen/var/sign/dd790e.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/sign/dd790e.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/sign/dd790e.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/sign/dd790e.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/sign/dd790e.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/sin/01f241.wgsl create mode 100644 test/tint/builtins/gen/var/sin/01f241.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/sin/01f241.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/sin/01f241.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/sin/01f241.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/sin/01f241.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/sin/4e3979.wgsl create mode 100644 test/tint/builtins/gen/var/sin/4e3979.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/sin/4e3979.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/sin/4e3979.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/sin/4e3979.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/sin/4e3979.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/sin/b78c91.wgsl create mode 100644 test/tint/builtins/gen/var/sin/b78c91.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/sin/b78c91.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/sin/b78c91.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/sin/b78c91.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/sin/b78c91.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/sin/fc8bc4.wgsl create mode 100644 test/tint/builtins/gen/var/sin/fc8bc4.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/sin/fc8bc4.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/sin/fc8bc4.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/sin/fc8bc4.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/sin/fc8bc4.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/sinh/445e33.wgsl create mode 100644 test/tint/builtins/gen/var/sinh/445e33.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/sinh/445e33.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/sinh/445e33.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/sinh/445e33.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/sinh/445e33.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/sinh/7bb598.wgsl create mode 100644 test/tint/builtins/gen/var/sinh/7bb598.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/sinh/7bb598.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/sinh/7bb598.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/sinh/7bb598.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/sinh/7bb598.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/sinh/b9860e.wgsl create mode 100644 test/tint/builtins/gen/var/sinh/b9860e.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/sinh/b9860e.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/sinh/b9860e.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/sinh/b9860e.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/sinh/b9860e.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/sinh/c9a5eb.wgsl create mode 100644 test/tint/builtins/gen/var/sinh/c9a5eb.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/sinh/c9a5eb.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/sinh/c9a5eb.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/sinh/c9a5eb.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/sinh/c9a5eb.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/smoothstep/392c19.wgsl create mode 100644 test/tint/builtins/gen/var/smoothstep/392c19.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/smoothstep/392c19.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/smoothstep/392c19.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/smoothstep/392c19.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/smoothstep/392c19.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/smoothstep/40864c.wgsl create mode 100644 test/tint/builtins/gen/var/smoothstep/40864c.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/smoothstep/40864c.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/smoothstep/40864c.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/smoothstep/40864c.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/smoothstep/40864c.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/smoothstep/6c4975.wgsl create mode 100644 test/tint/builtins/gen/var/smoothstep/6c4975.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/smoothstep/6c4975.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/smoothstep/6c4975.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/smoothstep/6c4975.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/smoothstep/6c4975.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/smoothstep/aad1db.wgsl create mode 100644 test/tint/builtins/gen/var/smoothstep/aad1db.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/smoothstep/aad1db.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/smoothstep/aad1db.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/smoothstep/aad1db.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/smoothstep/aad1db.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/sqrt/20c74e.wgsl create mode 100644 test/tint/builtins/gen/var/sqrt/20c74e.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/sqrt/20c74e.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/sqrt/20c74e.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/sqrt/20c74e.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/sqrt/20c74e.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/sqrt/8c7024.wgsl create mode 100644 test/tint/builtins/gen/var/sqrt/8c7024.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/sqrt/8c7024.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/sqrt/8c7024.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/sqrt/8c7024.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/sqrt/8c7024.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/sqrt/aa0d7a.wgsl create mode 100644 test/tint/builtins/gen/var/sqrt/aa0d7a.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/sqrt/aa0d7a.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/sqrt/aa0d7a.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/sqrt/aa0d7a.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/sqrt/aa0d7a.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/sqrt/f8c59a.wgsl create mode 100644 test/tint/builtins/gen/var/sqrt/f8c59a.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/sqrt/f8c59a.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/sqrt/f8c59a.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/sqrt/f8c59a.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/sqrt/f8c59a.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/step/0b073b.wgsl create mode 100644 test/tint/builtins/gen/var/step/0b073b.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/step/0b073b.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/step/0b073b.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/step/0b073b.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/step/0b073b.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/step/19accd.wgsl create mode 100644 test/tint/builtins/gen/var/step/19accd.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/step/19accd.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/step/19accd.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/step/19accd.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/step/19accd.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/step/334303.wgsl create mode 100644 test/tint/builtins/gen/var/step/334303.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/step/334303.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/step/334303.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/step/334303.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/step/334303.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/step/e2b337.wgsl create mode 100644 test/tint/builtins/gen/var/step/e2b337.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/step/e2b337.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/step/e2b337.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/step/e2b337.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/step/e2b337.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/storageBarrier/d87211.wgsl create mode 100644 test/tint/builtins/gen/var/storageBarrier/d87211.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/storageBarrier/d87211.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/storageBarrier/d87211.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/storageBarrier/d87211.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/storageBarrier/d87211.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/tan/244e2a.wgsl create mode 100644 test/tint/builtins/gen/var/tan/244e2a.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/tan/244e2a.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/tan/244e2a.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/tan/244e2a.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/tan/244e2a.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/tan/2f030e.wgsl create mode 100644 test/tint/builtins/gen/var/tan/2f030e.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/tan/2f030e.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/tan/2f030e.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/tan/2f030e.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/tan/2f030e.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/tan/7ea104.wgsl create mode 100644 test/tint/builtins/gen/var/tan/7ea104.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/tan/7ea104.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/tan/7ea104.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/tan/7ea104.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/tan/7ea104.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/tan/8ce3e9.wgsl create mode 100644 test/tint/builtins/gen/var/tan/8ce3e9.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/tan/8ce3e9.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/tan/8ce3e9.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/tan/8ce3e9.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/tan/8ce3e9.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/tanh/5663c5.wgsl create mode 100644 test/tint/builtins/gen/var/tanh/5663c5.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/tanh/5663c5.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/tanh/5663c5.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/tanh/5663c5.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/tanh/5663c5.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/tanh/5724b3.wgsl create mode 100644 test/tint/builtins/gen/var/tanh/5724b3.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/tanh/5724b3.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/tanh/5724b3.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/tanh/5724b3.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/tanh/5724b3.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/tanh/9f9fb9.wgsl create mode 100644 test/tint/builtins/gen/var/tanh/9f9fb9.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/tanh/9f9fb9.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/tanh/9f9fb9.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/tanh/9f9fb9.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/tanh/9f9fb9.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/tanh/c15fdb.wgsl create mode 100644 test/tint/builtins/gen/var/tanh/c15fdb.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/tanh/c15fdb.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/tanh/c15fdb.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/tanh/c15fdb.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/tanh/c15fdb.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/002b2a.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/002b2a.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/002b2a.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/002b2a.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/002b2a.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/002b2a.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/012b82.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/012b82.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/012b82.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/012b82.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/012b82.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/012b82.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/08753d.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/08753d.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/08753d.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/08753d.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/08753d.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/08753d.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/0c4772.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/0c4772.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/0c4772.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/0c4772.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/0c4772.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/0c4772.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/0cce40.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/0cce40.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/0cce40.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/0cce40.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/0cce40.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/0cce40.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/0cf2ff.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/0cf2ff.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/0cf2ff.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/0cf2ff.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/0cf2ff.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/0cf2ff.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/0d8b7e.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/0d8b7e.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/0d8b7e.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/0d8b7e.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/0d8b7e.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/0d8b7e.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/0e32ee.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/0e32ee.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/0e32ee.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/0e32ee.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/0e32ee.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/0e32ee.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/0f3c50.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/0f3c50.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/0f3c50.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/0f3c50.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/0f3c50.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/0f3c50.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/1191a5.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/1191a5.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/1191a5.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/1191a5.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/1191a5.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/1191a5.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/12c9bb.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/12c9bb.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/12c9bb.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/12c9bb.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/12c9bb.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/12c9bb.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/147998.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/147998.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/147998.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/147998.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/147998.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/147998.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/16036c.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/16036c.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/16036c.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/16036c.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/16036c.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/16036c.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/1b71f0.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/1b71f0.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/1b71f0.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/1b71f0.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/1b71f0.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/1b71f0.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/1d6c26.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/1d6c26.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/1d6c26.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/1d6c26.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/1d6c26.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/1d6c26.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/1e9e39.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/1e9e39.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/1e9e39.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/1e9e39.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/1e9e39.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/1e9e39.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/1f20c5.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/1f20c5.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/1f20c5.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/1f20c5.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/1f20c5.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/1f20c5.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/214dd4.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/214dd4.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/214dd4.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/214dd4.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/214dd4.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/214dd4.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/221f22.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/221f22.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/221f22.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/221f22.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/221f22.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/221f22.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/267788.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/267788.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/267788.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/267788.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/267788.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/267788.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/26bdfa.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/26bdfa.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/26bdfa.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/26bdfa.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/26bdfa.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/26bdfa.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/26ef6c.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/26ef6c.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/26ef6c.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/26ef6c.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/26ef6c.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/26ef6c.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/2ad087.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/2ad087.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/2ad087.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/2ad087.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/2ad087.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/2ad087.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/2efa05.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/2efa05.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/2efa05.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/2efa05.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/2efa05.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/2efa05.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/2f289f.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/2f289f.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/2f289f.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/2f289f.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/2f289f.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/2f289f.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/2fe1cc.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/2fe1cc.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/2fe1cc.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/2fe1cc.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/2fe1cc.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/2fe1cc.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/318ecc.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/318ecc.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/318ecc.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/318ecc.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/318ecc.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/318ecc.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/340d06.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/340d06.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/340d06.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/340d06.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/340d06.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/340d06.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/398e30.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/398e30.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/398e30.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/398e30.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/398e30.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/398e30.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/3a94ea.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/3a94ea.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/3a94ea.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/3a94ea.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/3a94ea.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/3a94ea.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/3aca08.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/3aca08.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/3aca08.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/3aca08.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/3aca08.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/3aca08.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/3c5ad8.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/3c5ad8.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/3c5ad8.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/3c5ad8.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/3c5ad8.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/3c5ad8.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/4152a6.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/4152a6.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/4152a6.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/4152a6.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/4152a6.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/4152a6.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/423f99.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/423f99.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/423f99.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/423f99.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/423f99.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/423f99.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/4267ee.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/4267ee.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/4267ee.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/4267ee.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/4267ee.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/4267ee.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/42d4e6.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/42d4e6.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/42d4e6.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/42d4e6.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/42d4e6.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/42d4e6.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/48cb89.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/48cb89.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/48cb89.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/48cb89.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/48cb89.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/48cb89.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/49d274.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/49d274.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/49d274.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/49d274.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/49d274.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/49d274.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/4df9a8.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/4df9a8.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/4df9a8.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/4df9a8.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/4df9a8.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/4df9a8.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/50a9ee.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/50a9ee.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/50a9ee.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/50a9ee.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/50a9ee.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/50a9ee.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/52045c.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/52045c.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/52045c.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/52045c.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/52045c.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/52045c.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/55b23e.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/55b23e.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/55b23e.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/55b23e.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/55b23e.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/55b23e.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/579629.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/579629.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/579629.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/579629.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/579629.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/579629.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/57da0b.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/57da0b.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/57da0b.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/57da0b.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/57da0b.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/57da0b.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/57e28f.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/57e28f.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/57e28f.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/57e28f.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/57e28f.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/57e28f.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/58a515.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/58a515.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/58a515.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/58a515.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/58a515.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/58a515.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/5985f3.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/5985f3.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/5985f3.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/5985f3.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/5985f3.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/5985f3.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/5caa5e.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/5caa5e.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/5caa5e.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/5caa5e.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/5caa5e.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/5caa5e.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/5e295d.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/5e295d.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/5e295d.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/5e295d.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/5e295d.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/5e295d.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/60bf54.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/60bf54.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/60bf54.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/60bf54.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/60bf54.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/60bf54.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/63f3cf.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/63f3cf.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/63f3cf.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/63f3cf.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/63f3cf.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/63f3cf.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/68105c.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/68105c.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/68105c.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/68105c.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/68105c.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/68105c.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/686ef2.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/686ef2.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/686ef2.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/686ef2.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/686ef2.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/686ef2.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/6adac6.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/6adac6.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/6adac6.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/6adac6.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/6adac6.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/6adac6.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/6ec1b4.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/6ec1b4.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/6ec1b4.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/6ec1b4.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/6ec1b4.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/6ec1b4.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/6f0d79.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/6f0d79.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/6f0d79.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/6f0d79.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/6f0d79.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/6f0d79.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/702c53.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/702c53.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/702c53.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/702c53.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/702c53.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/702c53.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/72e5d6.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/72e5d6.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/72e5d6.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/72e5d6.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/72e5d6.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/72e5d6.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/79df87.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/79df87.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/79df87.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/79df87.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/79df87.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/79df87.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/7bf826.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/7bf826.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/7bf826.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/7bf826.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/7bf826.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/7bf826.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/7f5c2e.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/7f5c2e.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/7f5c2e.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/7f5c2e.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/7f5c2e.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/7f5c2e.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/8028f3.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/8028f3.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/8028f3.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/8028f3.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/8028f3.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/8028f3.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/811679.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/811679.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/811679.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/811679.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/811679.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/811679.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/820596.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/820596.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/820596.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/820596.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/820596.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/820596.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/83ee5a.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/83ee5a.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/83ee5a.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/83ee5a.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/83ee5a.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/83ee5a.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/85d556.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/85d556.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/85d556.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/85d556.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/85d556.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/85d556.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/88ad17.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/88ad17.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/88ad17.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/88ad17.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/88ad17.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/88ad17.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/8aa4c4.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/8aa4c4.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/8aa4c4.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/8aa4c4.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/8aa4c4.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/8aa4c4.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/8deb5e.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/8deb5e.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/8deb5e.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/8deb5e.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/8deb5e.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/8deb5e.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/8f20bf.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/8f20bf.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/8f20bf.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/8f20bf.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/8f20bf.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/8f20bf.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/8fca0f.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/8fca0f.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/8fca0f.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/8fca0f.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/8fca0f.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/8fca0f.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/90340b.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/90340b.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/90340b.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/90340b.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/90340b.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/90340b.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/9042ab.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/9042ab.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/9042ab.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/9042ab.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/9042ab.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/9042ab.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/9393b0.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/9393b0.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/9393b0.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/9393b0.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/9393b0.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/9393b0.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/939fdb.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/939fdb.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/939fdb.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/939fdb.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/939fdb.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/939fdb.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/962dcd.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/962dcd.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/962dcd.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/962dcd.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/962dcd.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/962dcd.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/9abfe5.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/9abfe5.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/9abfe5.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/9abfe5.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/9abfe5.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/9abfe5.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/9c9c57.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/9c9c57.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/9c9c57.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/9c9c57.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/9c9c57.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/9c9c57.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/9da9e2.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/9da9e2.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/9da9e2.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/9da9e2.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/9da9e2.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/9da9e2.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/9eb8d8.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/9eb8d8.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/9eb8d8.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/9eb8d8.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/9eb8d8.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/9eb8d8.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/9f8e46.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/9f8e46.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/9f8e46.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/9f8e46.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/9f8e46.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/9f8e46.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/a01845.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/a01845.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/a01845.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/a01845.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/a01845.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/a01845.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/a7d565.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/a7d565.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/a7d565.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/a7d565.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/a7d565.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/a7d565.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/a863f2.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/a863f2.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/a863f2.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/a863f2.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/a863f2.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/a863f2.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/a9c9c1.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/a9c9c1.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/a9c9c1.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/a9c9c1.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/a9c9c1.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/a9c9c1.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/b0e16d.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/b0e16d.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/b0e16d.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/b0e16d.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/b0e16d.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/b0e16d.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/b3c954.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/b3c954.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/b3c954.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/b3c954.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/b3c954.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/b3c954.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/b3e407.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/b3e407.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/b3e407.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/b3e407.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/b3e407.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/b3e407.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/b91240.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/b91240.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/b91240.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/b91240.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/b91240.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/b91240.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/ba1481.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/ba1481.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/ba1481.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/ba1481.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/ba1481.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/ba1481.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/bb3dde.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/bb3dde.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/bb3dde.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/bb3dde.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/bb3dde.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/bb3dde.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/c30e75.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/c30e75.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/c30e75.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/c30e75.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/c30e75.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/c30e75.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/c7943d.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/c7943d.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/c7943d.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/c7943d.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/c7943d.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/c7943d.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/cc968c.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/cc968c.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/cc968c.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/cc968c.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/cc968c.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/cc968c.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/cccc8f.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/cccc8f.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/cccc8f.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/cccc8f.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/cccc8f.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/cccc8f.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/cd76a7.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/cd76a7.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/cd76a7.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/cd76a7.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/cd76a7.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/cd76a7.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/cdf473.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/cdf473.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/cdf473.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/cdf473.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/cdf473.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/cdf473.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/cec841.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/cec841.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/cec841.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/cec841.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/cec841.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/cec841.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/cf7e43.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/cf7e43.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/cf7e43.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/cf7e43.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/cf7e43.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/cf7e43.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/d125bc.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/d125bc.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/d125bc.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/d125bc.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/d125bc.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/d125bc.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/d83c45.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/d83c45.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/d83c45.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/d83c45.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/d83c45.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/d83c45.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/daf7c0.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/daf7c0.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/daf7c0.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/daf7c0.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/daf7c0.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/daf7c0.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/dc2dd0.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/dc2dd0.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/dc2dd0.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/dc2dd0.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/dc2dd0.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/dc2dd0.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/e927be.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/e927be.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/e927be.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/e927be.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/e927be.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/e927be.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/e9e96c.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/e9e96c.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/e9e96c.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/e9e96c.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/e9e96c.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/e9e96c.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/ef5b89.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/ef5b89.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/ef5b89.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/ef5b89.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/ef5b89.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/ef5b89.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/efc8a4.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/efc8a4.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/efc8a4.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/efc8a4.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/efc8a4.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/efc8a4.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/f60bdb.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/f60bdb.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/f60bdb.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/f60bdb.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/f60bdb.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/f60bdb.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/f7145b.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/f7145b.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/f7145b.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/f7145b.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/f7145b.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/f7145b.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/f931c7.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/f931c7.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/f931c7.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/f931c7.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/f931c7.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/f931c7.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/fa9859.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/fa9859.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/fa9859.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/fa9859.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/fa9859.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/fa9859.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/fb5670.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/fb5670.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/fb5670.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/fb5670.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/fb5670.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/fb5670.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/fcac78.wgsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/fcac78.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/fcac78.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureDimensions/fcac78.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureDimensions/fcac78.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureDimensions/fcac78.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureGather/10c554.wgsl create mode 100644 test/tint/builtins/gen/var/textureGather/10c554.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureGather/10c554.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureGather/10c554.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureGather/10c554.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureGather/10c554.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureGather/1f7f6b.wgsl create mode 100644 test/tint/builtins/gen/var/textureGather/1f7f6b.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureGather/1f7f6b.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureGather/1f7f6b.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureGather/1f7f6b.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureGather/1f7f6b.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureGather/22e930.wgsl create mode 100644 test/tint/builtins/gen/var/textureGather/22e930.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureGather/22e930.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureGather/22e930.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureGather/22e930.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureGather/22e930.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureGather/2cc066.wgsl create mode 100644 test/tint/builtins/gen/var/textureGather/2cc066.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureGather/2cc066.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureGather/2cc066.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureGather/2cc066.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureGather/2cc066.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureGather/2e0ed5.wgsl create mode 100644 test/tint/builtins/gen/var/textureGather/2e0ed5.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureGather/2e0ed5.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureGather/2e0ed5.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureGather/2e0ed5.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureGather/2e0ed5.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureGather/32c4e8.wgsl create mode 100644 test/tint/builtins/gen/var/textureGather/32c4e8.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureGather/32c4e8.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureGather/32c4e8.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureGather/32c4e8.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureGather/32c4e8.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureGather/3b32cc.wgsl create mode 100644 test/tint/builtins/gen/var/textureGather/3b32cc.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureGather/3b32cc.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureGather/3b32cc.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureGather/3b32cc.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureGather/3b32cc.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureGather/43025d.wgsl create mode 100644 test/tint/builtins/gen/var/textureGather/43025d.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureGather/43025d.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureGather/43025d.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureGather/43025d.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureGather/43025d.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureGather/49b07f.wgsl create mode 100644 test/tint/builtins/gen/var/textureGather/49b07f.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureGather/49b07f.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureGather/49b07f.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureGather/49b07f.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureGather/49b07f.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureGather/4b8103.wgsl create mode 100644 test/tint/builtins/gen/var/textureGather/4b8103.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureGather/4b8103.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureGather/4b8103.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureGather/4b8103.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureGather/4b8103.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureGather/5266da.wgsl create mode 100644 test/tint/builtins/gen/var/textureGather/5266da.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureGather/5266da.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureGather/5266da.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureGather/5266da.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureGather/5266da.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureGather/5ba85f.wgsl create mode 100644 test/tint/builtins/gen/var/textureGather/5ba85f.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureGather/5ba85f.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureGather/5ba85f.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureGather/5ba85f.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureGather/5ba85f.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureGather/5bd491.wgsl create mode 100644 test/tint/builtins/gen/var/textureGather/5bd491.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureGather/5bd491.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureGather/5bd491.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureGather/5bd491.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureGather/5bd491.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureGather/751f8a.wgsl create mode 100644 test/tint/builtins/gen/var/textureGather/751f8a.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureGather/751f8a.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureGather/751f8a.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureGather/751f8a.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureGather/751f8a.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureGather/7c3828.wgsl create mode 100644 test/tint/builtins/gen/var/textureGather/7c3828.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureGather/7c3828.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureGather/7c3828.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureGather/7c3828.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureGather/7c3828.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureGather/8b754c.wgsl create mode 100644 test/tint/builtins/gen/var/textureGather/8b754c.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureGather/8b754c.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureGather/8b754c.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureGather/8b754c.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureGather/8b754c.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureGather/9a6358.wgsl create mode 100644 test/tint/builtins/gen/var/textureGather/9a6358.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureGather/9a6358.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureGather/9a6358.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureGather/9a6358.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureGather/9a6358.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureGather/af55b3.wgsl create mode 100644 test/tint/builtins/gen/var/textureGather/af55b3.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureGather/af55b3.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureGather/af55b3.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureGather/af55b3.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureGather/af55b3.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureGather/bb3ac5.wgsl create mode 100644 test/tint/builtins/gen/var/textureGather/bb3ac5.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureGather/bb3ac5.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureGather/bb3ac5.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureGather/bb3ac5.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureGather/bb3ac5.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureGather/c0640c.wgsl create mode 100644 test/tint/builtins/gen/var/textureGather/c0640c.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureGather/c0640c.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureGather/c0640c.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureGather/c0640c.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureGather/c0640c.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureGather/d1f187.wgsl create mode 100644 test/tint/builtins/gen/var/textureGather/d1f187.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureGather/d1f187.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureGather/d1f187.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureGather/d1f187.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureGather/d1f187.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureGather/d90605.wgsl create mode 100644 test/tint/builtins/gen/var/textureGather/d90605.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureGather/d90605.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureGather/d90605.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureGather/d90605.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureGather/d90605.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureGather/e9d390.wgsl create mode 100644 test/tint/builtins/gen/var/textureGather/e9d390.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureGather/e9d390.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureGather/e9d390.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureGather/e9d390.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureGather/e9d390.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureGather/f2c6e3.wgsl create mode 100644 test/tint/builtins/gen/var/textureGather/f2c6e3.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureGather/f2c6e3.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureGather/f2c6e3.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureGather/f2c6e3.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureGather/f2c6e3.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureGatherCompare/182fd4.wgsl create mode 100644 test/tint/builtins/gen/var/textureGatherCompare/182fd4.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureGatherCompare/182fd4.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureGatherCompare/182fd4.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureGatherCompare/182fd4.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureGatherCompare/182fd4.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureGatherCompare/313add.wgsl create mode 100644 test/tint/builtins/gen/var/textureGatherCompare/313add.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureGatherCompare/313add.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureGatherCompare/313add.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureGatherCompare/313add.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureGatherCompare/313add.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureGatherCompare/60d2d1.wgsl create mode 100644 test/tint/builtins/gen/var/textureGatherCompare/60d2d1.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureGatherCompare/60d2d1.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureGatherCompare/60d2d1.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureGatherCompare/60d2d1.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureGatherCompare/60d2d1.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureGatherCompare/6d9352.wgsl create mode 100644 test/tint/builtins/gen/var/textureGatherCompare/6d9352.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureGatherCompare/6d9352.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureGatherCompare/6d9352.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureGatherCompare/6d9352.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureGatherCompare/6d9352.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureGatherCompare/783e65.wgsl create mode 100644 test/tint/builtins/gen/var/textureGatherCompare/783e65.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureGatherCompare/783e65.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureGatherCompare/783e65.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureGatherCompare/783e65.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureGatherCompare/783e65.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureGatherCompare/f585cc.wgsl create mode 100644 test/tint/builtins/gen/var/textureGatherCompare/f585cc.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureGatherCompare/f585cc.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureGatherCompare/f585cc.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureGatherCompare/f585cc.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureGatherCompare/f585cc.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureLoad/19cf87.wgsl create mode 100644 test/tint/builtins/gen/var/textureLoad/19cf87.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureLoad/19cf87.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureLoad/19cf87.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureLoad/19cf87.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureLoad/19cf87.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureLoad/1b8588.wgsl create mode 100644 test/tint/builtins/gen/var/textureLoad/1b8588.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureLoad/1b8588.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureLoad/1b8588.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureLoad/1b8588.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureLoad/1b8588.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureLoad/1f2016.wgsl create mode 100644 test/tint/builtins/gen/var/textureLoad/1f2016.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureLoad/1f2016.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureLoad/1f2016.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureLoad/1f2016.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureLoad/1f2016.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureLoad/484344.wgsl create mode 100644 test/tint/builtins/gen/var/textureLoad/484344.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureLoad/484344.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureLoad/484344.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureLoad/484344.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureLoad/484344.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureLoad/4fd803.wgsl create mode 100644 test/tint/builtins/gen/var/textureLoad/4fd803.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureLoad/4fd803.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureLoad/4fd803.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureLoad/4fd803.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureLoad/4fd803.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureLoad/5a2f9d.wgsl create mode 100644 test/tint/builtins/gen/var/textureLoad/5a2f9d.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureLoad/5a2f9d.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureLoad/5a2f9d.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureLoad/5a2f9d.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureLoad/5a2f9d.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureLoad/6154d4.wgsl create mode 100644 test/tint/builtins/gen/var/textureLoad/6154d4.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureLoad/6154d4.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureLoad/6154d4.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureLoad/6154d4.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureLoad/6154d4.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureLoad/6273b1.wgsl create mode 100644 test/tint/builtins/gen/var/textureLoad/6273b1.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureLoad/6273b1.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureLoad/6273b1.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureLoad/6273b1.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureLoad/6273b1.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureLoad/79e697.wgsl create mode 100644 test/tint/builtins/gen/var/textureLoad/79e697.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureLoad/79e697.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureLoad/79e697.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureLoad/79e697.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureLoad/79e697.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureLoad/7c90e5.wgsl create mode 100644 test/tint/builtins/gen/var/textureLoad/7c90e5.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureLoad/7c90e5.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureLoad/7c90e5.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureLoad/7c90e5.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureLoad/7c90e5.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureLoad/81c381.wgsl create mode 100644 test/tint/builtins/gen/var/textureLoad/81c381.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureLoad/81c381.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureLoad/81c381.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureLoad/81c381.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureLoad/81c381.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureLoad/87be85.wgsl create mode 100644 test/tint/builtins/gen/var/textureLoad/87be85.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureLoad/87be85.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureLoad/87be85.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureLoad/87be85.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureLoad/87be85.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureLoad/8acf41.wgsl create mode 100644 test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureLoad/9b2667.wgsl create mode 100644 test/tint/builtins/gen/var/textureLoad/9b2667.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureLoad/9b2667.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureLoad/9b2667.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureLoad/9b2667.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureLoad/9b2667.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureLoad/a583c9.wgsl create mode 100644 test/tint/builtins/gen/var/textureLoad/a583c9.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureLoad/a583c9.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureLoad/a583c9.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureLoad/a583c9.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureLoad/a583c9.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureLoad/a9a9f5.wgsl create mode 100644 test/tint/builtins/gen/var/textureLoad/a9a9f5.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureLoad/a9a9f5.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureLoad/a9a9f5.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureLoad/a9a9f5.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureLoad/a9a9f5.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureLoad/c2a480.wgsl create mode 100644 test/tint/builtins/gen/var/textureLoad/c2a480.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureLoad/c2a480.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureLoad/c2a480.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureLoad/c2a480.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureLoad/c2a480.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureLoad/c378ee.wgsl create mode 100644 test/tint/builtins/gen/var/textureLoad/c378ee.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureLoad/c378ee.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureLoad/c378ee.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureLoad/c378ee.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureLoad/c378ee.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureLoad/e3d2cc.wgsl create mode 100644 test/tint/builtins/gen/var/textureLoad/e3d2cc.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureLoad/e3d2cc.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureLoad/e3d2cc.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureLoad/e3d2cc.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureLoad/e3d2cc.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/024820.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/024820.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/024820.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/024820.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/024820.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureNumLayers/024820.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/053df7.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/053df7.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/053df7.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/053df7.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/053df7.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureNumLayers/053df7.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/058cc3.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/058cc3.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/058cc3.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/058cc3.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/058cc3.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureNumLayers/058cc3.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/09d05d.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/09d05d.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/09d05d.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/09d05d.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/09d05d.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureNumLayers/09d05d.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/13b4ce.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/13b4ce.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/13b4ce.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/13b4ce.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/13b4ce.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureNumLayers/13b4ce.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/22e53b.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/22e53b.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/22e53b.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/22e53b.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/22e53b.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureNumLayers/22e53b.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/562013.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/562013.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/562013.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/562013.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/562013.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureNumLayers/562013.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/5d59cd.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/5d59cd.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/5d59cd.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/5d59cd.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/5d59cd.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureNumLayers/5d59cd.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/68a65b.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/68a65b.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/68a65b.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/68a65b.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/68a65b.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureNumLayers/68a65b.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/778bd1.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/778bd1.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/778bd1.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/778bd1.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/778bd1.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureNumLayers/778bd1.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/7f1937.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/7f1937.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/7f1937.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/7f1937.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/7f1937.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureNumLayers/7f1937.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/85f980.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/85f980.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/85f980.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/85f980.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/85f980.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureNumLayers/85f980.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/87953e.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/87953e.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/87953e.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/87953e.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/87953e.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureNumLayers/87953e.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/893e7c.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/893e7c.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/893e7c.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/893e7c.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/893e7c.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureNumLayers/893e7c.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/9700fb.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/9700fb.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/9700fb.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/9700fb.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/9700fb.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureNumLayers/9700fb.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/a216d2.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/a216d2.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/a216d2.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/a216d2.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/a216d2.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureNumLayers/a216d2.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/cd5dc8.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/cd5dc8.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/cd5dc8.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/cd5dc8.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/cd5dc8.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureNumLayers/cd5dc8.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/d5b228.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/d5b228.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/d5b228.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/d5b228.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/d5b228.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureNumLayers/d5b228.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/e31be1.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/e31be1.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/e31be1.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/e31be1.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/e31be1.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureNumLayers/e31be1.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/e653c0.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/e653c0.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/e653c0.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/e653c0.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/e653c0.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureNumLayers/e653c0.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/ee942f.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/ee942f.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/ee942f.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/ee942f.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/ee942f.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureNumLayers/ee942f.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/f33005.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/f33005.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/f33005.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/f33005.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/f33005.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureNumLayers/f33005.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/fcec98.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/fcec98.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/fcec98.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/fcec98.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/fcec98.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureNumLayers/fcec98.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/ff5e89.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/ff5e89.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/ff5e89.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/ff5e89.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureNumLayers/ff5e89.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureNumLayers/ff5e89.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/076cb5.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/076cb5.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/076cb5.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/076cb5.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/076cb5.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureNumLevels/076cb5.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/080d95.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/080d95.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/080d95.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/080d95.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/080d95.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureNumLevels/080d95.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/09ddd0.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/09ddd0.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/09ddd0.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/09ddd0.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/09ddd0.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureNumLevels/09ddd0.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/105988.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/105988.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/105988.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/105988.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/105988.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureNumLevels/105988.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/1e6f3b.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/1e6f3b.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/1e6f3b.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/1e6f3b.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/1e6f3b.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureNumLevels/1e6f3b.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/23f750.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/23f750.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/23f750.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/23f750.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/23f750.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureNumLevels/23f750.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/2c3575.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/2c3575.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/2c3575.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/2c3575.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/2c3575.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureNumLevels/2c3575.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/32a0ae.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/32a0ae.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/32a0ae.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/32a0ae.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/32a0ae.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureNumLevels/32a0ae.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/5101cf.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/5101cf.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/5101cf.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/5101cf.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/5101cf.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureNumLevels/5101cf.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/51b5bb.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/51b5bb.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/51b5bb.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/51b5bb.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/51b5bb.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureNumLevels/51b5bb.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/897aaf.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/897aaf.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/897aaf.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/897aaf.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/897aaf.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureNumLevels/897aaf.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/9da7a5.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/9da7a5.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/9da7a5.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/9da7a5.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/9da7a5.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureNumLevels/9da7a5.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/a91c03.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/a91c03.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/a91c03.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/a91c03.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/a91c03.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureNumLevels/a91c03.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/aee7c8.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/aee7c8.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/aee7c8.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/aee7c8.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/aee7c8.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureNumLevels/aee7c8.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/b1b12b.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/b1b12b.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/b1b12b.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/b1b12b.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/b1b12b.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureNumLevels/b1b12b.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/b4f5ea.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/b4f5ea.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/b4f5ea.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/b4f5ea.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/b4f5ea.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureNumLevels/b4f5ea.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/d004a9.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/d004a9.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/d004a9.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/d004a9.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/d004a9.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureNumLevels/d004a9.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/dca09e.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/dca09e.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/dca09e.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/dca09e.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/dca09e.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureNumLevels/dca09e.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/e67231.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/e67231.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/e67231.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/e67231.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/e67231.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureNumLevels/e67231.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/ed078b.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/ed078b.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/ed078b.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/ed078b.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/ed078b.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureNumLevels/ed078b.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/f46ec6.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/f46ec6.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/f46ec6.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/f46ec6.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/f46ec6.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureNumLevels/f46ec6.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/f5828d.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/f5828d.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/f5828d.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/f5828d.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureNumLevels/f5828d.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureNumLevels/f5828d.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumSamples/2c6f14.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumSamples/2c6f14.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureNumSamples/2c6f14.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureNumSamples/2c6f14.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureNumSamples/2c6f14.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureNumSamples/2c6f14.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumSamples/42f8bb.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumSamples/42f8bb.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureNumSamples/42f8bb.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureNumSamples/42f8bb.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureNumSamples/42f8bb.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureNumSamples/42f8bb.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumSamples/449d23.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumSamples/449d23.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureNumSamples/449d23.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureNumSamples/449d23.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureNumSamples/449d23.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureNumSamples/449d23.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumSamples/a3c8a0.wgsl create mode 100644 test/tint/builtins/gen/var/textureNumSamples/a3c8a0.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureNumSamples/a3c8a0.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureNumSamples/a3c8a0.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureNumSamples/a3c8a0.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureNumSamples/a3c8a0.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureSample/0dff6c.wgsl create mode 100644 test/tint/builtins/gen/var/textureSample/0dff6c.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureSample/0dff6c.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureSample/0dff6c.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureSample/0dff6c.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureSample/0dff6c.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureSample/17e988.wgsl create mode 100644 test/tint/builtins/gen/var/textureSample/17e988.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureSample/17e988.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureSample/17e988.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureSample/17e988.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureSample/17e988.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureSample/2149ec.wgsl create mode 100644 test/tint/builtins/gen/var/textureSample/2149ec.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureSample/2149ec.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureSample/2149ec.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureSample/2149ec.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureSample/2149ec.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureSample/38bbb9.wgsl create mode 100644 test/tint/builtins/gen/var/textureSample/38bbb9.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureSample/38bbb9.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureSample/38bbb9.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureSample/38bbb9.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureSample/38bbb9.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureSample/3b50bd.wgsl create mode 100644 test/tint/builtins/gen/var/textureSample/3b50bd.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureSample/3b50bd.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureSample/3b50bd.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureSample/3b50bd.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureSample/3b50bd.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureSample/4dd1bf.wgsl create mode 100644 test/tint/builtins/gen/var/textureSample/4dd1bf.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureSample/4dd1bf.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureSample/4dd1bf.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureSample/4dd1bf.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureSample/4dd1bf.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureSample/51b514.wgsl create mode 100644 test/tint/builtins/gen/var/textureSample/51b514.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureSample/51b514.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureSample/51b514.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureSample/51b514.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureSample/51b514.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureSample/60bf45.wgsl create mode 100644 test/tint/builtins/gen/var/textureSample/60bf45.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureSample/60bf45.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureSample/60bf45.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureSample/60bf45.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureSample/60bf45.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureSample/6717ca.wgsl create mode 100644 test/tint/builtins/gen/var/textureSample/6717ca.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureSample/6717ca.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureSample/6717ca.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureSample/6717ca.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureSample/6717ca.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureSample/6e64fb.wgsl create mode 100644 test/tint/builtins/gen/var/textureSample/6e64fb.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureSample/6e64fb.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureSample/6e64fb.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureSample/6e64fb.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureSample/6e64fb.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureSample/7e9ffd.wgsl create mode 100644 test/tint/builtins/gen/var/textureSample/7e9ffd.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureSample/7e9ffd.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureSample/7e9ffd.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureSample/7e9ffd.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureSample/7e9ffd.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureSample/85c4ba.wgsl create mode 100644 test/tint/builtins/gen/var/textureSample/85c4ba.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureSample/85c4ba.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureSample/85c4ba.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureSample/85c4ba.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureSample/85c4ba.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureSample/c2f4e8.wgsl create mode 100644 test/tint/builtins/gen/var/textureSample/c2f4e8.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureSample/c2f4e8.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureSample/c2f4e8.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureSample/c2f4e8.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureSample/c2f4e8.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureSample/e53267.wgsl create mode 100644 test/tint/builtins/gen/var/textureSample/e53267.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureSample/e53267.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureSample/e53267.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureSample/e53267.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureSample/e53267.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureSample/ea7030.wgsl create mode 100644 test/tint/builtins/gen/var/textureSample/ea7030.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureSample/ea7030.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureSample/ea7030.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureSample/ea7030.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureSample/ea7030.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleBias/594824.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleCompareLevel/1116ed.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleCompareLevel/1116ed.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureSampleCompareLevel/1116ed.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureSampleCompareLevel/1116ed.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureSampleCompareLevel/1116ed.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureSampleCompareLevel/1116ed.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleCompareLevel/1568e3.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleCompareLevel/1568e3.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureSampleCompareLevel/1568e3.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureSampleCompareLevel/1568e3.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureSampleCompareLevel/1568e3.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureSampleCompareLevel/1568e3.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleCompareLevel/2ad2b1.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleCompareLevel/2ad2b1.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureSampleCompareLevel/2ad2b1.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureSampleCompareLevel/2ad2b1.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureSampleCompareLevel/2ad2b1.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureSampleCompareLevel/2ad2b1.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleCompareLevel/4cf3a2.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleCompareLevel/4cf3a2.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureSampleCompareLevel/4cf3a2.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureSampleCompareLevel/4cf3a2.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureSampleCompareLevel/4cf3a2.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureSampleCompareLevel/4cf3a2.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleCompareLevel/7f2b9a.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleCompareLevel/7f2b9a.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureSampleCompareLevel/7f2b9a.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureSampleCompareLevel/7f2b9a.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureSampleCompareLevel/7f2b9a.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureSampleCompareLevel/7f2b9a.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleCompareLevel/b6e47c.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleCompareLevel/b6e47c.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureSampleCompareLevel/b6e47c.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureSampleCompareLevel/b6e47c.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureSampleCompareLevel/b6e47c.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureSampleCompareLevel/b6e47c.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleGrad/21402b.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleGrad/21402b.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureSampleGrad/21402b.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureSampleGrad/21402b.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureSampleGrad/21402b.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureSampleGrad/21402b.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleGrad/2ecd8f.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleGrad/2ecd8f.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureSampleGrad/2ecd8f.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureSampleGrad/2ecd8f.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureSampleGrad/2ecd8f.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureSampleGrad/2ecd8f.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleGrad/521263.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleGrad/521263.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureSampleGrad/521263.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureSampleGrad/521263.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureSampleGrad/521263.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureSampleGrad/521263.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleGrad/5312f4.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleGrad/5312f4.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureSampleGrad/5312f4.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureSampleGrad/5312f4.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureSampleGrad/5312f4.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureSampleGrad/5312f4.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleGrad/5884dd.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleGrad/5884dd.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureSampleGrad/5884dd.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureSampleGrad/5884dd.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureSampleGrad/5884dd.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureSampleGrad/5884dd.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleGrad/d4e3c5.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleGrad/d4e3c5.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureSampleGrad/d4e3c5.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureSampleGrad/d4e3c5.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureSampleGrad/d4e3c5.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureSampleGrad/d4e3c5.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleGrad/d65515.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleGrad/d65515.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureSampleGrad/d65515.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureSampleGrad/d65515.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureSampleGrad/d65515.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureSampleGrad/d65515.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleGrad/e383db.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleGrad/e383db.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureSampleGrad/e383db.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureSampleGrad/e383db.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureSampleGrad/e383db.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureSampleGrad/e383db.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/02be59.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/02be59.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/02be59.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/02be59.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/02be59.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/02be59.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/0b0a1b.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/0b0a1b.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/0b0a1b.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/0b0a1b.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/0b0a1b.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/0b0a1b.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/0bdd9a.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/0bdd9a.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/0bdd9a.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/0bdd9a.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/0bdd9a.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/0bdd9a.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/1b0291.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/1b0291.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/1b0291.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/1b0291.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/1b0291.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/1b0291.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/1bf73e.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/1bf73e.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/1bf73e.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/1bf73e.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/1bf73e.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/1bf73e.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/302be4.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/302be4.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/302be4.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/302be4.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/302be4.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/302be4.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/36780e.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/36780e.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/36780e.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/36780e.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/36780e.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/36780e.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/749baf.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/749baf.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/749baf.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/749baf.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/749baf.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/749baf.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/979816.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/979816.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/979816.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/979816.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/979816.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/979816.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/abfcc0.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/abfcc0.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/abfcc0.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/abfcc0.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/abfcc0.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/abfcc0.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/ae5e39.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/ae5e39.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/ae5e39.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/ae5e39.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/ae5e39.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/ae5e39.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/b7c55c.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/b7c55c.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/b7c55c.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/b7c55c.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/b7c55c.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/b7c55c.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/c32df7.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/c32df7.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/c32df7.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/c32df7.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/c32df7.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/c32df7.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/c6aca6.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/c6aca6.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/c6aca6.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/c6aca6.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/c6aca6.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/c6aca6.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/dcbecb.wgsl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/dcbecb.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/dcbecb.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/dcbecb.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/dcbecb.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureSampleLevel/dcbecb.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/05ce15.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/05ce15.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureStore/05ce15.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureStore/05ce15.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureStore/05ce15.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureStore/05ce15.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/064c7f.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/064c7f.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureStore/064c7f.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureStore/064c7f.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureStore/064c7f.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureStore/064c7f.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/068641.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/068641.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureStore/068641.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureStore/068641.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureStore/068641.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureStore/068641.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/0af6b5.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/0af6b5.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureStore/0af6b5.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureStore/0af6b5.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureStore/0af6b5.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureStore/0af6b5.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/0c3dff.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/0c3dff.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureStore/0c3dff.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureStore/0c3dff.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureStore/0c3dff.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureStore/0c3dff.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/102722.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/102722.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureStore/102722.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureStore/102722.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureStore/102722.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureStore/102722.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/1bbd08.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/1bbd08.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureStore/1bbd08.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureStore/1bbd08.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureStore/1bbd08.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureStore/1bbd08.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/1c02e7.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/1c02e7.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureStore/1c02e7.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureStore/1c02e7.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureStore/1c02e7.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureStore/1c02e7.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/22d955.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/22d955.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureStore/22d955.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureStore/22d955.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureStore/22d955.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureStore/22d955.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/26bf70.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/26bf70.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureStore/26bf70.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureStore/26bf70.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureStore/26bf70.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureStore/26bf70.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/2796b4.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/2796b4.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureStore/2796b4.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureStore/2796b4.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureStore/2796b4.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureStore/2796b4.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/2ac6c7.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/2ac6c7.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureStore/2ac6c7.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureStore/2ac6c7.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureStore/2ac6c7.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureStore/2ac6c7.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/2eb2a4.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/2eb2a4.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureStore/2eb2a4.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureStore/2eb2a4.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureStore/2eb2a4.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureStore/2eb2a4.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/2ed2a3.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/2ed2a3.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureStore/2ed2a3.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureStore/2ed2a3.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureStore/2ed2a3.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureStore/2ed2a3.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/31745b.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/31745b.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureStore/31745b.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureStore/31745b.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureStore/31745b.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureStore/31745b.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/32f368.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/32f368.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureStore/32f368.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureStore/32f368.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureStore/32f368.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureStore/32f368.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/331aee.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/331aee.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureStore/331aee.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureStore/331aee.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureStore/331aee.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureStore/331aee.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/38e8d7.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/38e8d7.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureStore/38e8d7.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureStore/38e8d7.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureStore/38e8d7.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureStore/38e8d7.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/3a52ac.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/3a52ac.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureStore/3a52ac.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureStore/3a52ac.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureStore/3a52ac.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureStore/3a52ac.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/3bb7a1.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/3bb7a1.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureStore/3bb7a1.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureStore/3bb7a1.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureStore/3bb7a1.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureStore/3bb7a1.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/3bec15.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/3bec15.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureStore/3bec15.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureStore/3bec15.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureStore/3bec15.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureStore/3bec15.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/441ba8.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/441ba8.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureStore/441ba8.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureStore/441ba8.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureStore/441ba8.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureStore/441ba8.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/4fc057.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/4fc057.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureStore/4fc057.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureStore/4fc057.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureStore/4fc057.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureStore/4fc057.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/5a2f8f.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/5a2f8f.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureStore/5a2f8f.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureStore/5a2f8f.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureStore/5a2f8f.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureStore/5a2f8f.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/60975f.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/60975f.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureStore/60975f.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureStore/60975f.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureStore/60975f.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureStore/60975f.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/682fd6.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/682fd6.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureStore/682fd6.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureStore/682fd6.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureStore/682fd6.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureStore/682fd6.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/6b75c3.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/6b75c3.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureStore/6b75c3.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureStore/6b75c3.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureStore/6b75c3.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureStore/6b75c3.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/6b80d2.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/6b80d2.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureStore/6b80d2.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureStore/6b80d2.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureStore/6b80d2.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureStore/6b80d2.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/6cff2e.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/6cff2e.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureStore/6cff2e.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureStore/6cff2e.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureStore/6cff2e.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureStore/6cff2e.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/6da692.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/6da692.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureStore/6da692.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureStore/6da692.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureStore/6da692.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureStore/6da692.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/731349.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/731349.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureStore/731349.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureStore/731349.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureStore/731349.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureStore/731349.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/752da6.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/752da6.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureStore/752da6.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureStore/752da6.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureStore/752da6.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureStore/752da6.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/77c0ae.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/77c0ae.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureStore/77c0ae.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureStore/77c0ae.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureStore/77c0ae.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureStore/77c0ae.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/7cec8d.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/7cec8d.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureStore/7cec8d.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureStore/7cec8d.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureStore/7cec8d.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureStore/7cec8d.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/7f7fae.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/7f7fae.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureStore/7f7fae.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureStore/7f7fae.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureStore/7f7fae.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureStore/7f7fae.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/804942.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/804942.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureStore/804942.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureStore/804942.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureStore/804942.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureStore/804942.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/805dae.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/805dae.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureStore/805dae.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureStore/805dae.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureStore/805dae.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureStore/805dae.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/83bcc1.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/83bcc1.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureStore/83bcc1.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureStore/83bcc1.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureStore/83bcc1.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureStore/83bcc1.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/872747.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/872747.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureStore/872747.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureStore/872747.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureStore/872747.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureStore/872747.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/8e0479.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/8e0479.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureStore/8e0479.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureStore/8e0479.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureStore/8e0479.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureStore/8e0479.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/8f71a1.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/8f71a1.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureStore/8f71a1.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureStore/8f71a1.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureStore/8f71a1.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureStore/8f71a1.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/969534.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/969534.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureStore/969534.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureStore/969534.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureStore/969534.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureStore/969534.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/9a3ecc.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/9a3ecc.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureStore/9a3ecc.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureStore/9a3ecc.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureStore/9a3ecc.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureStore/9a3ecc.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/9d9cd5.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/9d9cd5.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureStore/9d9cd5.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureStore/9d9cd5.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureStore/9d9cd5.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureStore/9d9cd5.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/9e3ec5.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/9e3ec5.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureStore/9e3ec5.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureStore/9e3ec5.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureStore/9e3ec5.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureStore/9e3ec5.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/ac67aa.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/ac67aa.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureStore/ac67aa.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureStore/ac67aa.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureStore/ac67aa.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureStore/ac67aa.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/b706b1.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/b706b1.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureStore/b706b1.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureStore/b706b1.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureStore/b706b1.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureStore/b706b1.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/bbcb7f.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/bbcb7f.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureStore/bbcb7f.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureStore/bbcb7f.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureStore/bbcb7f.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureStore/bbcb7f.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/be6e30.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/be6e30.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureStore/be6e30.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureStore/be6e30.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureStore/be6e30.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureStore/be6e30.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/bf775c.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/bf775c.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureStore/bf775c.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureStore/bf775c.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureStore/bf775c.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureStore/bf775c.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/c5af1e.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/c5af1e.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureStore/c5af1e.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureStore/c5af1e.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureStore/c5af1e.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureStore/c5af1e.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/c863be.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/c863be.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureStore/c863be.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureStore/c863be.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureStore/c863be.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureStore/c863be.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/d73b5c.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/d73b5c.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureStore/d73b5c.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureStore/d73b5c.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureStore/d73b5c.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureStore/d73b5c.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/dd7d81.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/dd7d81.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureStore/dd7d81.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureStore/dd7d81.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureStore/dd7d81.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureStore/dd7d81.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/dde364.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/dde364.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureStore/dde364.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureStore/dde364.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureStore/dde364.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureStore/dde364.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/e885e8.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/e885e8.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureStore/e885e8.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureStore/e885e8.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureStore/e885e8.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureStore/e885e8.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/eb702f.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/eb702f.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureStore/eb702f.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureStore/eb702f.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureStore/eb702f.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureStore/eb702f.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/eb78b9.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/eb78b9.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureStore/eb78b9.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureStore/eb78b9.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureStore/eb78b9.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureStore/eb78b9.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/ee6acc.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/ee6acc.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureStore/ee6acc.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureStore/ee6acc.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureStore/ee6acc.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureStore/ee6acc.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/ef9f2f.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/ef9f2f.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureStore/ef9f2f.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureStore/ef9f2f.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureStore/ef9f2f.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureStore/ef9f2f.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/f8dead.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/f8dead.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureStore/f8dead.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureStore/f8dead.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureStore/f8dead.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureStore/f8dead.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/f9be83.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/f9be83.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureStore/f9be83.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureStore/f9be83.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureStore/f9be83.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureStore/f9be83.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/fb9a8f.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/fb9a8f.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureStore/fb9a8f.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureStore/fb9a8f.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureStore/fb9a8f.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureStore/fb9a8f.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/fbf53f.wgsl create mode 100644 test/tint/builtins/gen/var/textureStore/fbf53f.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/textureStore/fbf53f.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/textureStore/fbf53f.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/textureStore/fbf53f.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/textureStore/fbf53f.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/transpose/2585cd.wgsl create mode 100644 test/tint/builtins/gen/var/transpose/2585cd.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/transpose/2585cd.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/transpose/2585cd.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/transpose/2585cd.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/transpose/2585cd.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/transpose/31d679.wgsl create mode 100644 test/tint/builtins/gen/var/transpose/31d679.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/transpose/31d679.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/transpose/31d679.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/transpose/31d679.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/transpose/31d679.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/transpose/31e37e.wgsl create mode 100644 test/tint/builtins/gen/var/transpose/31e37e.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/transpose/31e37e.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/transpose/31e37e.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/transpose/31e37e.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/transpose/31e37e.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/transpose/4ce359.wgsl create mode 100644 test/tint/builtins/gen/var/transpose/4ce359.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/transpose/4ce359.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/transpose/4ce359.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/transpose/4ce359.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/transpose/4ce359.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/transpose/4dc9a1.wgsl create mode 100644 test/tint/builtins/gen/var/transpose/4dc9a1.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/transpose/4dc9a1.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/transpose/4dc9a1.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/transpose/4dc9a1.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/transpose/4dc9a1.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/transpose/854336.wgsl create mode 100644 test/tint/builtins/gen/var/transpose/854336.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/transpose/854336.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/transpose/854336.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/transpose/854336.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/transpose/854336.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/transpose/c1b600.wgsl create mode 100644 test/tint/builtins/gen/var/transpose/c1b600.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/transpose/c1b600.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/transpose/c1b600.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/transpose/c1b600.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/transpose/c1b600.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/transpose/d8f8ba.wgsl create mode 100644 test/tint/builtins/gen/var/transpose/d8f8ba.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/transpose/d8f8ba.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/transpose/d8f8ba.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/transpose/d8f8ba.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/transpose/d8f8ba.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/transpose/ed4bdc.wgsl create mode 100644 test/tint/builtins/gen/var/transpose/ed4bdc.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/transpose/ed4bdc.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/transpose/ed4bdc.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/transpose/ed4bdc.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/transpose/ed4bdc.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/trunc/562d05.wgsl create mode 100644 test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/trunc/e183aa.wgsl create mode 100644 test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/trunc/eb83df.wgsl create mode 100644 test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/trunc/f370d3.wgsl create mode 100644 test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/unpack2x16float/32a5cf.wgsl create mode 100644 test/tint/builtins/gen/var/unpack2x16float/32a5cf.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/unpack2x16float/32a5cf.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/unpack2x16float/32a5cf.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/unpack2x16float/32a5cf.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/unpack2x16float/32a5cf.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/unpack2x16snorm/b4aea6.wgsl create mode 100644 test/tint/builtins/gen/var/unpack2x16snorm/b4aea6.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/unpack2x16snorm/b4aea6.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/unpack2x16snorm/b4aea6.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/unpack2x16snorm/b4aea6.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/unpack2x16snorm/b4aea6.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/unpack2x16unorm/7699c0.wgsl create mode 100644 test/tint/builtins/gen/var/unpack2x16unorm/7699c0.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/unpack2x16unorm/7699c0.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/unpack2x16unorm/7699c0.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/unpack2x16unorm/7699c0.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/unpack2x16unorm/7699c0.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/unpack4x8snorm/523fb3.wgsl create mode 100644 test/tint/builtins/gen/var/unpack4x8snorm/523fb3.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/unpack4x8snorm/523fb3.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/unpack4x8snorm/523fb3.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/unpack4x8snorm/523fb3.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/unpack4x8snorm/523fb3.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/unpack4x8unorm/750c74.wgsl create mode 100644 test/tint/builtins/gen/var/unpack4x8unorm/750c74.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/unpack4x8unorm/750c74.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/unpack4x8unorm/750c74.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/unpack4x8unorm/750c74.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/unpack4x8unorm/750c74.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/workgroupBarrier/a17f7f.wgsl create mode 100644 test/tint/builtins/gen/var/workgroupBarrier/a17f7f.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/workgroupBarrier/a17f7f.wgsl.expected.hlsl create mode 100644 test/tint/builtins/gen/var/workgroupBarrier/a17f7f.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/workgroupBarrier/a17f7f.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/workgroupBarrier/a17f7f.wgsl.expected.wgsl diff --git a/src/tint/intrinsics.def b/src/tint/intrinsics.def index 0c7cfb4c91..5ac57739a2 100644 --- a/src/tint/intrinsics.def +++ b/src/tint/intrinsics.def @@ -496,22 +496,22 @@ fn textureDimensions(texture: texture_storage_2d fn textureDimensions(texture: texture_storage_2d_array) -> vec2 fn textureDimensions(texture: texture_storage_3d) -> vec3 fn textureDimensions(texture: texture_external) -> vec2 -fn textureGather(component: i32, texture: texture_2d, sampler: sampler, coords: vec2) -> vec4 -fn textureGather(component: i32, texture: texture_2d, sampler: sampler, coords: vec2, offset: vec2) -> vec4 -fn textureGather(component: i32, texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32) -> vec4 -fn textureGather(component: i32, texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, offset: vec2) -> vec4 -fn textureGather(component: i32, texture: texture_cube, sampler: sampler, coords: vec3) -> vec4 -fn textureGather(component: i32, texture: texture_cube_array, sampler: sampler, coords: vec3, array_index: i32) -> vec4 +fn textureGather(@const component: i32, texture: texture_2d, sampler: sampler, coords: vec2) -> vec4 +fn textureGather(@const component: i32, texture: texture_2d, sampler: sampler, coords: vec2, @const offset: vec2) -> vec4 +fn textureGather(@const component: i32, texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32) -> vec4 +fn textureGather(@const component: i32, texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, @const offset: vec2) -> vec4 +fn textureGather(@const component: i32, texture: texture_cube, sampler: sampler, coords: vec3) -> vec4 +fn textureGather(@const component: i32, texture: texture_cube_array, sampler: sampler, coords: vec3, array_index: i32) -> vec4 fn textureGather(texture: texture_depth_2d, sampler: sampler, coords: vec2) -> vec4 -fn textureGather(texture: texture_depth_2d, sampler: sampler, coords: vec2, offset: vec2) -> vec4 +fn textureGather(texture: texture_depth_2d, sampler: sampler, coords: vec2, @const offset: vec2) -> vec4 fn textureGather(texture: texture_depth_2d_array, sampler: sampler, coords: vec2, array_index: i32) -> vec4 -fn textureGather(texture: texture_depth_2d_array, sampler: sampler, coords: vec2, array_index: i32, offset: vec2) -> vec4 +fn textureGather(texture: texture_depth_2d_array, sampler: sampler, coords: vec2, array_index: i32, @const offset: vec2) -> vec4 fn textureGather(texture: texture_depth_cube, sampler: sampler, coords: vec3) -> vec4 fn textureGather(texture: texture_depth_cube_array, sampler: sampler, coords: vec3, array_index: i32) -> vec4 fn textureGatherCompare(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2, depth_ref: f32) -> vec4 -fn textureGatherCompare(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2, depth_ref: f32, offset: vec2) -> vec4 +fn textureGatherCompare(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2, depth_ref: f32, @const offset: vec2) -> vec4 fn textureGatherCompare(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2, array_index: i32, depth_ref: f32) -> vec4 -fn textureGatherCompare(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2, array_index: i32, depth_ref: f32, offset: vec2) -> vec4 +fn textureGatherCompare(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2, array_index: i32, depth_ref: f32, @const offset: vec2) -> vec4 fn textureGatherCompare(texture: texture_depth_cube, sampler: sampler_comparison, coords: vec3, depth_ref: f32) -> vec4 fn textureGatherCompare(texture: texture_depth_cube_array, sampler: sampler_comparison, coords: vec3, array_index: i32, depth_ref: f32) -> vec4 fn textureNumLayers(texture: texture_2d_array) -> i32 @@ -533,59 +533,59 @@ fn textureNumSamples(texture: texture_multisampled_2d) -> i32 fn textureNumSamples(texture: texture_depth_multisampled_2d) -> i32 @stage("fragment") fn textureSample(texture: texture_1d, sampler: sampler, coords: f32) -> vec4 @stage("fragment") fn textureSample(texture: texture_2d, sampler: sampler, coords: vec2) -> vec4 -@stage("fragment") fn textureSample(texture: texture_2d, sampler: sampler, coords: vec2, offset: vec2) -> vec4 +@stage("fragment") fn textureSample(texture: texture_2d, sampler: sampler, coords: vec2, @const offset: vec2) -> vec4 @stage("fragment") fn textureSample(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32) -> vec4 -@stage("fragment") fn textureSample(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, offset: vec2) -> vec4 +@stage("fragment") fn textureSample(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, @const offset: vec2) -> vec4 @stage("fragment") fn textureSample(texture: texture_3d, sampler: sampler, coords: vec3) -> vec4 -@stage("fragment") fn textureSample(texture: texture_3d, sampler: sampler, coords: vec3, offset: vec3) -> vec4 +@stage("fragment") fn textureSample(texture: texture_3d, sampler: sampler, coords: vec3, @const offset: vec3) -> vec4 @stage("fragment") fn textureSample(texture: texture_cube, sampler: sampler, coords: vec3) -> vec4 @stage("fragment") fn textureSample(texture: texture_cube_array, sampler: sampler, coords: vec3, array_index: i32) -> vec4 @stage("fragment") fn textureSample(texture: texture_depth_2d, sampler: sampler, coords: vec2) -> f32 -@stage("fragment") fn textureSample(texture: texture_depth_2d, sampler: sampler, coords: vec2, offset: vec2) -> f32 +@stage("fragment") fn textureSample(texture: texture_depth_2d, sampler: sampler, coords: vec2, @const offset: vec2) -> f32 @stage("fragment") fn textureSample(texture: texture_depth_2d_array, sampler: sampler, coords: vec2, array_index: i32) -> f32 -@stage("fragment") fn textureSample(texture: texture_depth_2d_array, sampler: sampler, coords: vec2, array_index: i32, offset: vec2) -> f32 +@stage("fragment") fn textureSample(texture: texture_depth_2d_array, sampler: sampler, coords: vec2, array_index: i32, @const offset: vec2) -> f32 @stage("fragment") fn textureSample(texture: texture_depth_cube, sampler: sampler, coords: vec3) -> f32 @stage("fragment") fn textureSample(texture: texture_depth_cube_array, sampler: sampler, coords: vec3, array_index: i32) -> f32 @stage("fragment") fn textureSampleBias(texture: texture_2d, sampler: sampler, coords: vec2, bias: f32) -> vec4 -@stage("fragment") fn textureSampleBias(texture: texture_2d, sampler: sampler, coords: vec2, bias: f32, offset: vec2) -> vec4 +@stage("fragment") fn textureSampleBias(texture: texture_2d, sampler: sampler, coords: vec2, bias: f32, @const offset: vec2) -> vec4 @stage("fragment") fn textureSampleBias(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, bias: f32) -> vec4 -@stage("fragment") fn textureSampleBias(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, bias: f32, offset: vec2) -> vec4 +@stage("fragment") fn textureSampleBias(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, bias: f32, @const offset: vec2) -> vec4 @stage("fragment") fn textureSampleBias(texture: texture_3d, sampler: sampler, coords: vec3, bias: f32) -> vec4 -@stage("fragment") fn textureSampleBias(texture: texture_3d, sampler: sampler, coords: vec3, bias: f32, offset: vec3) -> vec4 +@stage("fragment") fn textureSampleBias(texture: texture_3d, sampler: sampler, coords: vec3, bias: f32, @const offset: vec3) -> vec4 @stage("fragment") fn textureSampleBias(texture: texture_cube, sampler: sampler, coords: vec3, bias: f32) -> vec4 @stage("fragment") fn textureSampleBias(texture: texture_cube_array, sampler: sampler, coords: vec3, array_index: i32, bias: f32) -> vec4 @stage("fragment") fn textureSampleCompare(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2, depth_ref: f32) -> f32 -@stage("fragment") fn textureSampleCompare(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2, depth_ref: f32, offset: vec2) -> f32 +@stage("fragment") fn textureSampleCompare(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2, depth_ref: f32, @const offset: vec2) -> f32 @stage("fragment") fn textureSampleCompare(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2, array_index: i32, depth_ref: f32) -> f32 -@stage("fragment") fn textureSampleCompare(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2, array_index: i32, depth_ref: f32, offset: vec2) -> f32 +@stage("fragment") fn textureSampleCompare(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2, array_index: i32, depth_ref: f32, @const offset: vec2) -> f32 @stage("fragment") fn textureSampleCompare(texture: texture_depth_cube, sampler: sampler_comparison, coords: vec3, depth_ref: f32) -> f32 @stage("fragment") fn textureSampleCompare(texture: texture_depth_cube_array, sampler: sampler_comparison, coords: vec3, array_index: i32, depth_ref: f32) -> f32 fn textureSampleCompareLevel(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2, depth_ref: f32) -> f32 -fn textureSampleCompareLevel(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2, depth_ref: f32, offset: vec2) -> f32 +fn textureSampleCompareLevel(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2, depth_ref: f32, @const offset: vec2) -> f32 fn textureSampleCompareLevel(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2, array_index: i32, depth_ref: f32) -> f32 -fn textureSampleCompareLevel(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2, array_index: i32, depth_ref: f32, offset: vec2) -> f32 +fn textureSampleCompareLevel(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2, array_index: i32, depth_ref: f32, @const offset: vec2) -> f32 fn textureSampleCompareLevel(texture: texture_depth_cube, sampler: sampler_comparison, coords: vec3, depth_ref: f32) -> f32 fn textureSampleCompareLevel(texture: texture_depth_cube_array, sampler: sampler_comparison, coords: vec3, array_index: i32, depth_ref: f32) -> f32 fn textureSampleGrad(texture: texture_2d, sampler: sampler, coords: vec2, ddx: vec2, ddy: vec2) -> vec4 -fn textureSampleGrad(texture: texture_2d, sampler: sampler, coords: vec2, ddx: vec2, ddy: vec2, offset: vec2) -> vec4 +fn textureSampleGrad(texture: texture_2d, sampler: sampler, coords: vec2, ddx: vec2, ddy: vec2, @const offset: vec2) -> vec4 fn textureSampleGrad(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, ddx: vec2, ddy: vec2) -> vec4 -fn textureSampleGrad(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, ddx: vec2, ddy: vec2, offset: vec2) -> vec4 +fn textureSampleGrad(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, ddx: vec2, ddy: vec2, @const offset: vec2) -> vec4 fn textureSampleGrad(texture: texture_3d, sampler: sampler, coords: vec3, ddx: vec3, ddy: vec3) -> vec4 -fn textureSampleGrad(texture: texture_3d, sampler: sampler, coords: vec3, ddx: vec3, ddy: vec3, offset: vec3) -> vec4 +fn textureSampleGrad(texture: texture_3d, sampler: sampler, coords: vec3, ddx: vec3, ddy: vec3, @const offset: vec3) -> vec4 fn textureSampleGrad(texture: texture_cube, sampler: sampler, coords: vec3, ddx: vec3, ddy: vec3) -> vec4 fn textureSampleGrad(texture: texture_cube_array, sampler: sampler, coords: vec3, array_index: i32, ddx: vec3, ddy: vec3) -> vec4 fn textureSampleLevel(texture: texture_2d, sampler: sampler, coords: vec2, level: f32) -> vec4 -fn textureSampleLevel(texture: texture_2d, sampler: sampler, coords: vec2, level: f32, offset: vec2) -> vec4 +fn textureSampleLevel(texture: texture_2d, sampler: sampler, coords: vec2, level: f32, @const offset: vec2) -> vec4 fn textureSampleLevel(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, level: f32) -> vec4 -fn textureSampleLevel(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, level: f32, offset: vec2) -> vec4 +fn textureSampleLevel(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, level: f32, @const offset: vec2) -> vec4 fn textureSampleLevel(texture: texture_3d, sampler: sampler, coords: vec3, level: f32) -> vec4 -fn textureSampleLevel(texture: texture_3d, sampler: sampler, coords: vec3, level: f32, offset: vec3) -> vec4 +fn textureSampleLevel(texture: texture_3d, sampler: sampler, coords: vec3, level: f32, @const offset: vec3) -> vec4 fn textureSampleLevel(texture: texture_cube, sampler: sampler, coords: vec3, level: f32) -> vec4 fn textureSampleLevel(texture: texture_cube_array, sampler: sampler, coords: vec3, array_index: i32, level: f32) -> vec4 fn textureSampleLevel(texture: texture_depth_2d, sampler: sampler, coords: vec2, level: i32) -> f32 -fn textureSampleLevel(texture: texture_depth_2d, sampler: sampler, coords: vec2, level: i32, offset: vec2) -> f32 +fn textureSampleLevel(texture: texture_depth_2d, sampler: sampler, coords: vec2, level: i32, @const offset: vec2) -> f32 fn textureSampleLevel(texture: texture_depth_2d_array, sampler: sampler, coords: vec2, array_index: i32, level: i32) -> f32 -fn textureSampleLevel(texture: texture_depth_2d_array, sampler: sampler, coords: vec2, array_index: i32, level: i32, offset: vec2) -> f32 +fn textureSampleLevel(texture: texture_depth_2d_array, sampler: sampler, coords: vec2, array_index: i32, level: i32, @const offset: vec2) -> f32 fn textureSampleLevel(texture: texture_depth_cube, sampler: sampler, coords: vec3, level: i32) -> f32 fn textureSampleLevel(texture: texture_depth_cube_array,sampler: sampler, coords: vec3, array_index: i32, level: i32) -> f32 fn textureSampleLevel(texture: texture_external, sampler: sampler, coords: vec2) -> vec4 diff --git a/src/tint/resolver/intrinsic_table.inl b/src/tint/resolver/intrinsic_table.inl index fab7783252..521e5e14f7 100644 --- a/src/tint/resolver/intrinsic_table.inl +++ b/src/tint/resolver/intrinsic_table.inl @@ -13601,16 +13601,16 @@ constexpr IntrinsicInfo kBuiltins[] = { }, { /* [83] */ - /* fn textureGather(component: i32, texture: texture_2d, sampler: sampler, coords: vec2) -> vec4 */ - /* fn textureGather(component: i32, texture: texture_2d, sampler: sampler, coords: vec2, offset: vec2) -> vec4 */ - /* fn textureGather(component: i32, texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32) -> vec4 */ - /* fn textureGather(component: i32, texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, offset: vec2) -> vec4 */ - /* fn textureGather(component: i32, texture: texture_cube, sampler: sampler, coords: vec3) -> vec4 */ - /* fn textureGather(component: i32, texture: texture_cube_array, sampler: sampler, coords: vec3, array_index: i32) -> vec4 */ + /* fn textureGather(@const component: i32, texture: texture_2d, sampler: sampler, coords: vec2) -> vec4 */ + /* fn textureGather(@const component: i32, texture: texture_2d, sampler: sampler, coords: vec2, @const offset: vec2) -> vec4 */ + /* fn textureGather(@const component: i32, texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32) -> vec4 */ + /* fn textureGather(@const component: i32, texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, @const offset: vec2) -> vec4 */ + /* fn textureGather(@const component: i32, texture: texture_cube, sampler: sampler, coords: vec3) -> vec4 */ + /* fn textureGather(@const component: i32, texture: texture_cube_array, sampler: sampler, coords: vec3, array_index: i32) -> vec4 */ /* fn textureGather(texture: texture_depth_2d, sampler: sampler, coords: vec2) -> vec4 */ - /* fn textureGather(texture: texture_depth_2d, sampler: sampler, coords: vec2, offset: vec2) -> vec4 */ + /* fn textureGather(texture: texture_depth_2d, sampler: sampler, coords: vec2, @const offset: vec2) -> vec4 */ /* fn textureGather(texture: texture_depth_2d_array, sampler: sampler, coords: vec2, array_index: i32) -> vec4 */ - /* fn textureGather(texture: texture_depth_2d_array, sampler: sampler, coords: vec2, array_index: i32, offset: vec2) -> vec4 */ + /* fn textureGather(texture: texture_depth_2d_array, sampler: sampler, coords: vec2, array_index: i32, @const offset: vec2) -> vec4 */ /* fn textureGather(texture: texture_depth_cube, sampler: sampler, coords: vec3) -> vec4 */ /* fn textureGather(texture: texture_depth_cube_array, sampler: sampler, coords: vec3, array_index: i32) -> vec4 */ /* num overloads */ 12, @@ -13619,9 +13619,9 @@ constexpr IntrinsicInfo kBuiltins[] = { { /* [84] */ /* fn textureGatherCompare(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2, depth_ref: f32) -> vec4 */ - /* fn textureGatherCompare(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2, depth_ref: f32, offset: vec2) -> vec4 */ + /* fn textureGatherCompare(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2, depth_ref: f32, @const offset: vec2) -> vec4 */ /* fn textureGatherCompare(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2, array_index: i32, depth_ref: f32) -> vec4 */ - /* fn textureGatherCompare(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2, array_index: i32, depth_ref: f32, offset: vec2) -> vec4 */ + /* fn textureGatherCompare(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2, array_index: i32, depth_ref: f32, @const offset: vec2) -> vec4 */ /* fn textureGatherCompare(texture: texture_depth_cube, sampler: sampler_comparison, coords: vec3, depth_ref: f32) -> vec4 */ /* fn textureGatherCompare(texture: texture_depth_cube_array, sampler: sampler_comparison, coords: vec3, array_index: i32, depth_ref: f32) -> vec4 */ /* num overloads */ 6, @@ -13663,17 +13663,17 @@ constexpr IntrinsicInfo kBuiltins[] = { /* [88] */ /* fn textureSample(texture: texture_1d, sampler: sampler, coords: f32) -> vec4 */ /* fn textureSample(texture: texture_2d, sampler: sampler, coords: vec2) -> vec4 */ - /* fn textureSample(texture: texture_2d, sampler: sampler, coords: vec2, offset: vec2) -> vec4 */ + /* fn textureSample(texture: texture_2d, sampler: sampler, coords: vec2, @const offset: vec2) -> vec4 */ /* fn textureSample(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32) -> vec4 */ - /* fn textureSample(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, offset: vec2) -> vec4 */ + /* fn textureSample(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, @const offset: vec2) -> vec4 */ /* fn textureSample(texture: texture_3d, sampler: sampler, coords: vec3) -> vec4 */ - /* fn textureSample(texture: texture_3d, sampler: sampler, coords: vec3, offset: vec3) -> vec4 */ + /* fn textureSample(texture: texture_3d, sampler: sampler, coords: vec3, @const offset: vec3) -> vec4 */ /* fn textureSample(texture: texture_cube, sampler: sampler, coords: vec3) -> vec4 */ /* fn textureSample(texture: texture_cube_array, sampler: sampler, coords: vec3, array_index: i32) -> vec4 */ /* fn textureSample(texture: texture_depth_2d, sampler: sampler, coords: vec2) -> f32 */ - /* fn textureSample(texture: texture_depth_2d, sampler: sampler, coords: vec2, offset: vec2) -> f32 */ + /* fn textureSample(texture: texture_depth_2d, sampler: sampler, coords: vec2, @const offset: vec2) -> f32 */ /* fn textureSample(texture: texture_depth_2d_array, sampler: sampler, coords: vec2, array_index: i32) -> f32 */ - /* fn textureSample(texture: texture_depth_2d_array, sampler: sampler, coords: vec2, array_index: i32, offset: vec2) -> f32 */ + /* fn textureSample(texture: texture_depth_2d_array, sampler: sampler, coords: vec2, array_index: i32, @const offset: vec2) -> f32 */ /* fn textureSample(texture: texture_depth_cube, sampler: sampler, coords: vec3) -> f32 */ /* fn textureSample(texture: texture_depth_cube_array, sampler: sampler, coords: vec3, array_index: i32) -> f32 */ /* num overloads */ 15, @@ -13682,11 +13682,11 @@ constexpr IntrinsicInfo kBuiltins[] = { { /* [89] */ /* fn textureSampleBias(texture: texture_2d, sampler: sampler, coords: vec2, bias: f32) -> vec4 */ - /* fn textureSampleBias(texture: texture_2d, sampler: sampler, coords: vec2, bias: f32, offset: vec2) -> vec4 */ + /* fn textureSampleBias(texture: texture_2d, sampler: sampler, coords: vec2, bias: f32, @const offset: vec2) -> vec4 */ /* fn textureSampleBias(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, bias: f32) -> vec4 */ - /* fn textureSampleBias(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, bias: f32, offset: vec2) -> vec4 */ + /* fn textureSampleBias(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, bias: f32, @const offset: vec2) -> vec4 */ /* fn textureSampleBias(texture: texture_3d, sampler: sampler, coords: vec3, bias: f32) -> vec4 */ - /* fn textureSampleBias(texture: texture_3d, sampler: sampler, coords: vec3, bias: f32, offset: vec3) -> vec4 */ + /* fn textureSampleBias(texture: texture_3d, sampler: sampler, coords: vec3, bias: f32, @const offset: vec3) -> vec4 */ /* fn textureSampleBias(texture: texture_cube, sampler: sampler, coords: vec3, bias: f32) -> vec4 */ /* fn textureSampleBias(texture: texture_cube_array, sampler: sampler, coords: vec3, array_index: i32, bias: f32) -> vec4 */ /* num overloads */ 8, @@ -13695,9 +13695,9 @@ constexpr IntrinsicInfo kBuiltins[] = { { /* [90] */ /* fn textureSampleCompare(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2, depth_ref: f32) -> f32 */ - /* fn textureSampleCompare(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2, depth_ref: f32, offset: vec2) -> f32 */ + /* fn textureSampleCompare(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2, depth_ref: f32, @const offset: vec2) -> f32 */ /* fn textureSampleCompare(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2, array_index: i32, depth_ref: f32) -> f32 */ - /* fn textureSampleCompare(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2, array_index: i32, depth_ref: f32, offset: vec2) -> f32 */ + /* fn textureSampleCompare(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2, array_index: i32, depth_ref: f32, @const offset: vec2) -> f32 */ /* fn textureSampleCompare(texture: texture_depth_cube, sampler: sampler_comparison, coords: vec3, depth_ref: f32) -> f32 */ /* fn textureSampleCompare(texture: texture_depth_cube_array, sampler: sampler_comparison, coords: vec3, array_index: i32, depth_ref: f32) -> f32 */ /* num overloads */ 6, @@ -13706,9 +13706,9 @@ constexpr IntrinsicInfo kBuiltins[] = { { /* [91] */ /* fn textureSampleCompareLevel(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2, depth_ref: f32) -> f32 */ - /* fn textureSampleCompareLevel(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2, depth_ref: f32, offset: vec2) -> f32 */ + /* fn textureSampleCompareLevel(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2, depth_ref: f32, @const offset: vec2) -> f32 */ /* fn textureSampleCompareLevel(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2, array_index: i32, depth_ref: f32) -> f32 */ - /* fn textureSampleCompareLevel(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2, array_index: i32, depth_ref: f32, offset: vec2) -> f32 */ + /* fn textureSampleCompareLevel(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2, array_index: i32, depth_ref: f32, @const offset: vec2) -> f32 */ /* fn textureSampleCompareLevel(texture: texture_depth_cube, sampler: sampler_comparison, coords: vec3, depth_ref: f32) -> f32 */ /* fn textureSampleCompareLevel(texture: texture_depth_cube_array, sampler: sampler_comparison, coords: vec3, array_index: i32, depth_ref: f32) -> f32 */ /* num overloads */ 6, @@ -13717,11 +13717,11 @@ constexpr IntrinsicInfo kBuiltins[] = { { /* [92] */ /* fn textureSampleGrad(texture: texture_2d, sampler: sampler, coords: vec2, ddx: vec2, ddy: vec2) -> vec4 */ - /* fn textureSampleGrad(texture: texture_2d, sampler: sampler, coords: vec2, ddx: vec2, ddy: vec2, offset: vec2) -> vec4 */ + /* fn textureSampleGrad(texture: texture_2d, sampler: sampler, coords: vec2, ddx: vec2, ddy: vec2, @const offset: vec2) -> vec4 */ /* fn textureSampleGrad(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, ddx: vec2, ddy: vec2) -> vec4 */ - /* fn textureSampleGrad(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, ddx: vec2, ddy: vec2, offset: vec2) -> vec4 */ + /* fn textureSampleGrad(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, ddx: vec2, ddy: vec2, @const offset: vec2) -> vec4 */ /* fn textureSampleGrad(texture: texture_3d, sampler: sampler, coords: vec3, ddx: vec3, ddy: vec3) -> vec4 */ - /* fn textureSampleGrad(texture: texture_3d, sampler: sampler, coords: vec3, ddx: vec3, ddy: vec3, offset: vec3) -> vec4 */ + /* fn textureSampleGrad(texture: texture_3d, sampler: sampler, coords: vec3, ddx: vec3, ddy: vec3, @const offset: vec3) -> vec4 */ /* fn textureSampleGrad(texture: texture_cube, sampler: sampler, coords: vec3, ddx: vec3, ddy: vec3) -> vec4 */ /* fn textureSampleGrad(texture: texture_cube_array, sampler: sampler, coords: vec3, array_index: i32, ddx: vec3, ddy: vec3) -> vec4 */ /* num overloads */ 8, @@ -13730,17 +13730,17 @@ constexpr IntrinsicInfo kBuiltins[] = { { /* [93] */ /* fn textureSampleLevel(texture: texture_2d, sampler: sampler, coords: vec2, level: f32) -> vec4 */ - /* fn textureSampleLevel(texture: texture_2d, sampler: sampler, coords: vec2, level: f32, offset: vec2) -> vec4 */ + /* fn textureSampleLevel(texture: texture_2d, sampler: sampler, coords: vec2, level: f32, @const offset: vec2) -> vec4 */ /* fn textureSampleLevel(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, level: f32) -> vec4 */ - /* fn textureSampleLevel(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, level: f32, offset: vec2) -> vec4 */ + /* fn textureSampleLevel(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, level: f32, @const offset: vec2) -> vec4 */ /* fn textureSampleLevel(texture: texture_3d, sampler: sampler, coords: vec3, level: f32) -> vec4 */ - /* fn textureSampleLevel(texture: texture_3d, sampler: sampler, coords: vec3, level: f32, offset: vec3) -> vec4 */ + /* fn textureSampleLevel(texture: texture_3d, sampler: sampler, coords: vec3, level: f32, @const offset: vec3) -> vec4 */ /* fn textureSampleLevel(texture: texture_cube, sampler: sampler, coords: vec3, level: f32) -> vec4 */ /* fn textureSampleLevel(texture: texture_cube_array, sampler: sampler, coords: vec3, array_index: i32, level: f32) -> vec4 */ /* fn textureSampleLevel(texture: texture_depth_2d, sampler: sampler, coords: vec2, level: i32) -> f32 */ - /* fn textureSampleLevel(texture: texture_depth_2d, sampler: sampler, coords: vec2, level: i32, offset: vec2) -> f32 */ + /* fn textureSampleLevel(texture: texture_depth_2d, sampler: sampler, coords: vec2, level: i32, @const offset: vec2) -> f32 */ /* fn textureSampleLevel(texture: texture_depth_2d_array, sampler: sampler, coords: vec2, array_index: i32, level: i32) -> f32 */ - /* fn textureSampleLevel(texture: texture_depth_2d_array, sampler: sampler, coords: vec2, array_index: i32, level: i32, offset: vec2) -> f32 */ + /* fn textureSampleLevel(texture: texture_depth_2d_array, sampler: sampler, coords: vec2, array_index: i32, level: i32, @const offset: vec2) -> f32 */ /* fn textureSampleLevel(texture: texture_depth_cube, sampler: sampler, coords: vec3, level: i32) -> f32 */ /* fn textureSampleLevel(texture: texture_depth_cube_array, sampler: sampler, coords: vec3, array_index: i32, level: i32) -> f32 */ /* fn textureSampleLevel(texture: texture_external, sampler: sampler, coords: vec2) -> vec4 */ diff --git a/test/tint/builtins/gen/gen.wgsl.tmpl b/test/tint/builtins/gen/gen.wgsl.tmpl index d4360f443d..0e43231e71 100644 --- a/test/tint/builtins/gen/gen.wgsl.tmpl +++ b/test/tint/builtins/gen/gen.wgsl.tmpl @@ -1,7 +1,7 @@ {{- /* -------------------------------------------------------------------------------- Template file for use with tools/builtin-gen to generate the wgsl files in the -./literal/... subdirectories +./literal/... and ./var/... subdirectories See: * tools/cmd/intrinsic-gen/gen for structures used by this template @@ -19,24 +19,30 @@ See: {{- /* Generate a ./literal//.wgsl file using the Permutation macro defined below */ -}} {{- $file := printf "./literal/%v/%v.wgsl" .Intrinsic.Name .Hash -}} -{{- $content := Eval "Permutation" . -}} +{{- $content := Eval "Permutation" "Overload" . "Mode" "literal" -}} +{{- WriteFile $file $content -}} +{{- /* Generate a ./var//.wgsl file using + the Permutation macro defined below */ -}} +{{- $file := printf "./var/%v/%v.wgsl" .Intrinsic.Name .Hash -}} +{{- $content := Eval "Permutation" "Overload" . "Mode" "var" -}} {{- WriteFile $file $content -}} {{- end }} {{- end }} {{- end }} {{- end }} - {{- /* ------------------------------------------------------------------ */ -}} {{- define "Permutation" -}} {{- /* Emits the body of the intrinsic permuation .wgsl file */ -}} {{- /* ------------------------------------------------------------------ */ -}} -{{- $builtin := .Intrinsic.Name -}} -{{- $permutation := printf "%v_%v" $builtin .Hash -}} +{{- $overload := .Overload -}} +{{- $mode := .Mode -}} +{{- $builtin := $overload.Intrinsic.Name -}} +{{- $permutation := printf "%v_%v" $builtin $overload.Hash -}} {{- $args := Map -}} {{- /* Generate RW storage buffer parameters */ -}} -{{- $sb_rw_fields := Eval "EmitBufferFields" "overload" . +{{- $sb_rw_fields := Eval "EmitBufferFields" "overload" $overload "var_name" "sb_rw" "storage" "storage" "access" "read_write" @@ -49,7 +55,7 @@ struct SB_RW { {{ end -}} {{- /* Generate RO storage buffer parameters */ -}} -{{- $sb_ro_fields := Eval "EmitBufferFields" "overload" . +{{- $sb_ro_fields := Eval "EmitBufferFields" "overload" $overload "var_name" "sb_ro" "storage" "storage" "access" "read" @@ -62,7 +68,7 @@ struct SB_RO { {{ end -}} {{- /* Generate uniform buffer parameters */ -}} -{{- $ub_fields := Eval "EmitBufferFields" "overload" . +{{- $ub_fields := Eval "EmitBufferFields" "overload" $overload "var_name" "ub" "storage" "uniform" "access" "read" @@ -75,7 +81,7 @@ struct UB { {{ end -}} {{- /* Generate module-scoped handle variables */ -}} -{{- range $i, $p := .Parameters }} +{{- range $i, $p := $overload.Parameters }} {{- $class := Eval "StorageClass" $p.Type -}} {{- if eq "ptr" $p.Type.Target.Name -}} {{- $el_type := Eval "Type" (index $p.Type.TemplateArguments 1)}} @@ -109,12 +115,15 @@ struct UB { // {{$.Overload}} fn {{$permutation}}() { {{/* Build the parameters either as 'var' or inline values */ -}} -{{- range $i, $p := .Parameters -}} +{{- range $i, $p := $overload.Parameters -}} {{- $class := Eval "StorageClass" $p.Type -}} {{- if eq "function" $class -}} {{- if eq "ptr" $p.Type.Target.Name -}} {{- /*indent*/}} var arg_{{$i}}: {{template "Type" index $p.Type.TemplateArguments 1}}; {{ $args.Put $i (printf "&arg_%v" $i) -}} +{{- else if and (not $p.IsConst) (eq "var" $mode) -}} +{{- /*indent*/}} var arg_{{$i}} = {{Eval "ArgumentValue" $p}}; +{{ $args.Put $i (printf "arg_%v" $i) -}} {{- else -}} {{- $args.Put $i (Eval "ArgumentValue" $p) -}} {{- end -}} @@ -123,18 +132,18 @@ fn {{$permutation}}() { {{- /* Make the call to the intrinsic */ -}} {{- /*indent*/}} {{/*indent*/ -}} -{{- if .ReturnType -}} - var res{{if IsDeclarable .ReturnType}}: {{template "Type" .ReturnType}}{{end}} = {{/* preserve space after = */ -}} +{{- if $overload.ReturnType -}} + var res{{if IsDeclarable $overload.ReturnType}}: {{template "Type" $overload.ReturnType}}{{end}} = {{/* preserve space after = */ -}} {{- end -}} {{$builtin}}( -{{- range $i, $p := .Parameters -}} +{{- range $i, $p := $overload.Parameters -}} {{- if $i -}}, {{end}}{{$args.Get $i -}} {{- end -}} ); } {{/*new line*/ -}} -{{- if .CanBeUsedInStage.Vertex }} +{{- if $overload.CanBeUsedInStage.Vertex }} @stage(vertex) fn vertex_main() -> @builtin(position) vec4 { {{$permutation}}(); @@ -142,14 +151,14 @@ fn vertex_main() -> @builtin(position) vec4 { } {{ end -}} -{{- if .CanBeUsedInStage.Fragment }} +{{- if $overload.CanBeUsedInStage.Fragment }} @stage(fragment) fn fragment_main() { {{$permutation}}(); } {{ end -}} -{{- if .CanBeUsedInStage.Compute }} +{{- if $overload.CanBeUsedInStage.Compute }} @stage(compute) @workgroup_size(1) fn compute_main() { {{$permutation}}(); diff --git a/test/tint/builtins/gen/literal/textureGather/01305f.wgsl b/test/tint/builtins/gen/literal/textureGather/01305f.wgsl deleted file mode 100644 index 7ac678bf76..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/01305f.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/gen/gen.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(1) var arg_1: texture_2d_array; -@group(1) @binding(2) var arg_2: sampler; - -// fn textureGather(component: i32, texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32) -> vec4 -fn textureGather_01305f() { - var res: vec4 = textureGather(1, arg_1, arg_2, vec2(), 1); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_01305f(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_01305f(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_01305f(); -} diff --git a/test/tint/builtins/gen/literal/textureGather/01305f.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/01305f.wgsl.expected.glsl deleted file mode 100644 index 3d87bbc3e3..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/01305f.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp usampler2DArray arg_1_arg_2; - -void textureGather_01305f() { - uvec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), 1); -} - -vec4 vertex_main() { - textureGather_01305f(); - return vec4(0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp usampler2DArray arg_1_arg_2; - -void textureGather_01305f() { - uvec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), 1); -} - -void fragment_main() { - textureGather_01305f(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp usampler2DArray arg_1_arg_2; - -void textureGather_01305f() { - uvec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), 1); -} - -void compute_main() { - textureGather_01305f(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureGather/01305f.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureGather/01305f.wgsl.expected.hlsl deleted file mode 100644 index 8ecab024a4..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/01305f.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -Texture2DArray arg_1 : register(t1, space1); -SamplerState arg_2 : register(s2, space1); - -void textureGather_01305f() { - uint4 res = arg_1.GatherGreen(arg_2, float3(0.0f, 0.0f, float(1))); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureGather_01305f(); - return (0.0f).xxxx; -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureGather_01305f(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureGather_01305f(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureGather/01305f.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/01305f.wgsl.expected.msl deleted file mode 100644 index 1db6ec98e2..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/01305f.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureGather_01305f(texture2d_array tint_symbol_1, sampler tint_symbol_2) { - uint4 res = tint_symbol_1.gather(tint_symbol_2, float2(0.0f), 1, int2(0), component::y); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_3, sampler tint_symbol_4) { - textureGather_01305f(tint_symbol_3, tint_symbol_4); - return float4(0.0f); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureGather_01305f(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureGather_01305f(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/literal/textureGather/01305f.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/01305f.wgsl.expected.spvasm deleted file mode 100644 index b8ac4eb07d..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/01305f.wgsl.expected.spvasm +++ /dev/null @@ -1,89 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 49 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_1 "arg_1" - OpName %arg_2 "arg_2" - OpName %textureGather_01305f "textureGather_01305f" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - OpDecorate %arg_2 DescriptorSet 1 - OpDecorate %arg_2 Binding 2 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %uint = OpTypeInt 32 0 - %11 = OpTypeImage %uint 2D 0 1 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %15 = OpTypeSampler -%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 - %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant - %void = OpTypeVoid - %16 = OpTypeFunction %void - %v4uint = OpTypeVector %uint 4 - %24 = OpTypeSampledImage %11 - %v3float = OpTypeVector %float 3 - %float_0 = OpConstant %float 0 - %int = OpTypeInt 32 1 - %int_1 = OpConstant %int 1 -%_ptr_Function_v4uint = OpTypePointer Function %v4uint - %34 = OpConstantNull %v4uint - %35 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureGather_01305f = OpFunction %void None %16 - %19 = OpLabel - %res = OpVariable %_ptr_Function_v4uint Function %34 - %22 = OpLoad %15 %arg_2 - %23 = OpLoad %11 %arg_1 - %25 = OpSampledImage %24 %23 %22 - %28 = OpConvertSToF %float %int_1 - %31 = OpCompositeConstruct %v3float %float_0 %float_0 %28 - %20 = OpImageGather %v4uint %25 %31 %int_1 - OpStore %res %20 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %35 - %37 = OpLabel - %38 = OpFunctionCall %void %textureGather_01305f - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %16 - %40 = OpLabel - %41 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %41 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %16 - %44 = OpLabel - %45 = OpFunctionCall %void %textureGather_01305f - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %16 - %47 = OpLabel - %48 = OpFunctionCall %void %textureGather_01305f - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureGather/01305f.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/01305f.wgsl.expected.wgsl deleted file mode 100644 index b683348097..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/01305f.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(1) var arg_1 : texture_2d_array; - -@group(1) @binding(2) var arg_2 : sampler; - -fn textureGather_01305f() { - var res : vec4 = textureGather(1, arg_1, arg_2, vec2(), 1); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_01305f(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_01305f(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_01305f(); -} diff --git a/test/tint/builtins/gen/literal/textureGather/06030a.wgsl b/test/tint/builtins/gen/literal/textureGather/06030a.wgsl deleted file mode 100644 index aad328cb00..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/06030a.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/gen/gen.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(1) var arg_1: texture_2d_array; -@group(1) @binding(2) var arg_2: sampler; - -// fn textureGather(component: i32, texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, offset: vec2) -> vec4 -fn textureGather_06030a() { - var res: vec4 = textureGather(1, arg_1, arg_2, vec2(), 1, vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_06030a(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_06030a(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_06030a(); -} diff --git a/test/tint/builtins/gen/literal/textureGather/06030a.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/06030a.wgsl.expected.glsl deleted file mode 100644 index 8bfee8f0b5..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/06030a.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp sampler2DArray arg_1_arg_2; - -void textureGather_06030a() { - vec4 res = textureGatherOffset(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), ivec2(0), 1); -} - -vec4 vertex_main() { - textureGather_06030a(); - return vec4(0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp sampler2DArray arg_1_arg_2; - -void textureGather_06030a() { - vec4 res = textureGatherOffset(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), ivec2(0), 1); -} - -void fragment_main() { - textureGather_06030a(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp sampler2DArray arg_1_arg_2; - -void textureGather_06030a() { - vec4 res = textureGatherOffset(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), ivec2(0), 1); -} - -void compute_main() { - textureGather_06030a(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureGather/06030a.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureGather/06030a.wgsl.expected.hlsl deleted file mode 100644 index b54c374880..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/06030a.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -Texture2DArray arg_1 : register(t1, space1); -SamplerState arg_2 : register(s2, space1); - -void textureGather_06030a() { - float4 res = arg_1.GatherGreen(arg_2, float3(0.0f, 0.0f, float(1)), (0).xx); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureGather_06030a(); - return (0.0f).xxxx; -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureGather_06030a(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureGather_06030a(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureGather/06030a.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/06030a.wgsl.expected.msl deleted file mode 100644 index e7bf7b84b0..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/06030a.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureGather_06030a(texture2d_array tint_symbol_1, sampler tint_symbol_2) { - float4 res = tint_symbol_1.gather(tint_symbol_2, float2(0.0f), 1, int2(0), component::y); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_3, sampler tint_symbol_4) { - textureGather_06030a(tint_symbol_3, tint_symbol_4); - return float4(0.0f); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureGather_06030a(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureGather_06030a(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/literal/textureGather/06030a.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/06030a.wgsl.expected.spvasm deleted file mode 100644 index a46bcd0705..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/06030a.wgsl.expected.spvasm +++ /dev/null @@ -1,88 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 48 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_1 "arg_1" - OpName %arg_2 "arg_2" - OpName %textureGather_06030a "textureGather_06030a" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - OpDecorate %arg_2 DescriptorSet 1 - OpDecorate %arg_2 Binding 2 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %11 = OpTypeImage %float 2D 0 1 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %14 = OpTypeSampler -%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 - %arg_2 = OpVariable %_ptr_UniformConstant_14 UniformConstant - %void = OpTypeVoid - %15 = OpTypeFunction %void - %22 = OpTypeSampledImage %11 - %v3float = OpTypeVector %float 3 - %float_0 = OpConstant %float 0 - %int = OpTypeInt 32 1 - %int_1 = OpConstant %int 1 - %v2int = OpTypeVector %int 2 - %31 = OpConstantNull %v2int -%_ptr_Function_v4float = OpTypePointer Function %v4float - %34 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureGather_06030a = OpFunction %void None %15 - %18 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %20 = OpLoad %14 %arg_2 - %21 = OpLoad %11 %arg_1 - %23 = OpSampledImage %22 %21 %20 - %26 = OpConvertSToF %float %int_1 - %29 = OpCompositeConstruct %v3float %float_0 %float_0 %26 - %19 = OpImageGather %v4float %23 %29 %int_1 ConstOffset %31 - OpStore %res %19 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %34 - %36 = OpLabel - %37 = OpFunctionCall %void %textureGather_06030a - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %15 - %39 = OpLabel - %40 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %40 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %15 - %43 = OpLabel - %44 = OpFunctionCall %void %textureGather_06030a - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %15 - %46 = OpLabel - %47 = OpFunctionCall %void %textureGather_06030a - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureGather/06030a.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/06030a.wgsl.expected.wgsl deleted file mode 100644 index 6709ed63bc..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/06030a.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(1) var arg_1 : texture_2d_array; - -@group(1) @binding(2) var arg_2 : sampler; - -fn textureGather_06030a() { - var res : vec4 = textureGather(1, arg_1, arg_2, vec2(), 1, vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_06030a(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_06030a(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_06030a(); -} diff --git a/test/tint/builtins/gen/literal/textureGather/15d79c.wgsl b/test/tint/builtins/gen/literal/textureGather/15d79c.wgsl deleted file mode 100644 index 75f8157128..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/15d79c.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/gen/gen.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(1) var arg_1: texture_2d; -@group(1) @binding(2) var arg_2: sampler; - -// fn textureGather(component: i32, texture: texture_2d, sampler: sampler, coords: vec2, offset: vec2) -> vec4 -fn textureGather_15d79c() { - var res: vec4 = textureGather(1, arg_1, arg_2, vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_15d79c(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_15d79c(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_15d79c(); -} diff --git a/test/tint/builtins/gen/literal/textureGather/15d79c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/15d79c.wgsl.expected.glsl deleted file mode 100644 index 046ad40370..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/15d79c.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp sampler2D arg_1_arg_2; - -void textureGather_15d79c() { - vec4 res = textureGatherOffset(arg_1_arg_2, vec2(0.0f), ivec2(0), 1); -} - -vec4 vertex_main() { - textureGather_15d79c(); - return vec4(0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp sampler2D arg_1_arg_2; - -void textureGather_15d79c() { - vec4 res = textureGatherOffset(arg_1_arg_2, vec2(0.0f), ivec2(0), 1); -} - -void fragment_main() { - textureGather_15d79c(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp sampler2D arg_1_arg_2; - -void textureGather_15d79c() { - vec4 res = textureGatherOffset(arg_1_arg_2, vec2(0.0f), ivec2(0), 1); -} - -void compute_main() { - textureGather_15d79c(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureGather/15d79c.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureGather/15d79c.wgsl.expected.hlsl deleted file mode 100644 index 2e7873d7a2..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/15d79c.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -Texture2D arg_1 : register(t1, space1); -SamplerState arg_2 : register(s2, space1); - -void textureGather_15d79c() { - float4 res = arg_1.GatherGreen(arg_2, (0.0f).xx, (0).xx); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureGather_15d79c(); - return (0.0f).xxxx; -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureGather_15d79c(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureGather_15d79c(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureGather/15d79c.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/15d79c.wgsl.expected.msl deleted file mode 100644 index 4e43bfaa17..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/15d79c.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureGather_15d79c(texture2d tint_symbol_1, sampler tint_symbol_2) { - float4 res = tint_symbol_1.gather(tint_symbol_2, float2(0.0f), int2(0), component::y); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d tint_symbol_3, sampler tint_symbol_4) { - textureGather_15d79c(tint_symbol_3, tint_symbol_4); - return float4(0.0f); -} - -vertex tint_symbol vertex_main(texture2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureGather_15d79c(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(texture2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureGather_15d79c(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/literal/textureGather/15d79c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/15d79c.wgsl.expected.spvasm deleted file mode 100644 index 376685950a..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/15d79c.wgsl.expected.spvasm +++ /dev/null @@ -1,86 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 46 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_1 "arg_1" - OpName %arg_2 "arg_2" - OpName %textureGather_15d79c "textureGather_15d79c" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - OpDecorate %arg_2 DescriptorSet 1 - OpDecorate %arg_2 Binding 2 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %11 = OpTypeImage %float 2D 0 0 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %14 = OpTypeSampler -%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 - %arg_2 = OpVariable %_ptr_UniformConstant_14 UniformConstant - %void = OpTypeVoid - %15 = OpTypeFunction %void - %22 = OpTypeSampledImage %11 - %v2float = OpTypeVector %float 2 - %25 = OpConstantNull %v2float - %int = OpTypeInt 32 1 - %int_1 = OpConstant %int 1 - %v2int = OpTypeVector %int 2 - %29 = OpConstantNull %v2int -%_ptr_Function_v4float = OpTypePointer Function %v4float - %32 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureGather_15d79c = OpFunction %void None %15 - %18 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %20 = OpLoad %14 %arg_2 - %21 = OpLoad %11 %arg_1 - %23 = OpSampledImage %22 %21 %20 - %19 = OpImageGather %v4float %23 %25 %int_1 ConstOffset %29 - OpStore %res %19 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %32 - %34 = OpLabel - %35 = OpFunctionCall %void %textureGather_15d79c - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %15 - %37 = OpLabel - %38 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %38 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %15 - %41 = OpLabel - %42 = OpFunctionCall %void %textureGather_15d79c - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %15 - %44 = OpLabel - %45 = OpFunctionCall %void %textureGather_15d79c - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureGather/15d79c.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/15d79c.wgsl.expected.wgsl deleted file mode 100644 index 14d9203b1a..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/15d79c.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(1) var arg_1 : texture_2d; - -@group(1) @binding(2) var arg_2 : sampler; - -fn textureGather_15d79c() { - var res : vec4 = textureGather(1, arg_1, arg_2, vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_15d79c(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_15d79c(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_15d79c(); -} diff --git a/test/tint/builtins/gen/literal/textureGather/1f7f6b.wgsl b/test/tint/builtins/gen/literal/textureGather/1f7f6b.wgsl new file mode 100644 index 0000000000..fe626347de --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/1f7f6b.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureGather(texture: texture_depth_2d, sampler: sampler, coords: vec2, @const offset: vec2) -> vec4 +fn textureGather_1f7f6b() { + var res: vec4 = textureGather(arg_0, arg_1, vec2(), vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_1f7f6b(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_1f7f6b(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_1f7f6b(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/1f7f6b.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/1f7f6b.wgsl.expected.glsl new file mode 100644 index 0000000000..e76e72816a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/1f7f6b.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureGather_1f7f6b() { + vec4 res = textureGatherOffset(arg_0_arg_1, vec2(0.0f), 0.0, ivec2(0)); +} + +vec4 vertex_main() { + textureGather_1f7f6b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureGather_1f7f6b() { + vec4 res = textureGatherOffset(arg_0_arg_1, vec2(0.0f), 0.0, ivec2(0)); +} + +void fragment_main() { + textureGather_1f7f6b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureGather_1f7f6b() { + vec4 res = textureGatherOffset(arg_0_arg_1, vec2(0.0f), 0.0, ivec2(0)); +} + +void compute_main() { + textureGather_1f7f6b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/1f7f6b.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureGather/1f7f6b.wgsl.expected.hlsl new file mode 100644 index 0000000000..287fd65c39 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/1f7f6b.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureGather_1f7f6b() { + float4 res = arg_0.Gather(arg_1, (0.0f).xx, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_1f7f6b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_1f7f6b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_1f7f6b(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/1f7f6b.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/1f7f6b.wgsl.expected.msl new file mode 100644 index 0000000000..a861581165 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/1f7f6b.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureGather_1f7f6b(depth2d tint_symbol_1, sampler tint_symbol_2) { + float4 res = tint_symbol_1.gather(tint_symbol_2, float2(0.0f), int2(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d tint_symbol_3, sampler tint_symbol_4) { + textureGather_1f7f6b(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_1f7f6b(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depth2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_1f7f6b(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureGather/1f7f6b.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/1f7f6b.wgsl.expected.spvasm new file mode 100644 index 0000000000..e4a034cce6 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/1f7f6b.wgsl.expected.spvasm @@ -0,0 +1,86 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 46 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureGather_1f7f6b "textureGather_1f7f6b" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %22 = OpTypeSampledImage %11 + %v2float = OpTypeVector %float 2 + %25 = OpConstantNull %v2float + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %v2int = OpTypeVector %int 2 + %29 = OpConstantNull %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %32 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_1f7f6b = OpFunction %void None %15 + %18 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %20 = OpLoad %14 %arg_1 + %21 = OpLoad %11 %arg_0 + %23 = OpSampledImage %22 %21 %20 + %19 = OpImageGather %v4float %23 %25 %int_0 ConstOffset %29 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %32 + %34 = OpLabel + %35 = OpFunctionCall %void %textureGather_1f7f6b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %37 = OpLabel + %38 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %38 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %41 = OpLabel + %42 = OpFunctionCall %void %textureGather_1f7f6b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %44 = OpLabel + %45 = OpFunctionCall %void %textureGather_1f7f6b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureGather/1f7f6b.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/1f7f6b.wgsl.expected.wgsl new file mode 100644 index 0000000000..23089f4094 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/1f7f6b.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureGather_1f7f6b() { + var res : vec4 = textureGather(arg_0, arg_1, vec2(), vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_1f7f6b(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_1f7f6b(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_1f7f6b(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/22e930.wgsl b/test/tint/builtins/gen/literal/textureGather/22e930.wgsl new file mode 100644 index 0000000000..55b623fb0e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/22e930.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_2d_array; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32) -> vec4 +fn textureGather_22e930() { + var res: vec4 = textureGather(1, arg_1, arg_2, vec2(), 1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_22e930(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_22e930(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_22e930(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/22e930.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/22e930.wgsl.expected.glsl new file mode 100644 index 0000000000..79022b758b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/22e930.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp sampler2DArray arg_1_arg_2; + +void textureGather_22e930() { + vec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), 1); +} + +vec4 vertex_main() { + textureGather_22e930(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DArray arg_1_arg_2; + +void textureGather_22e930() { + vec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), 1); +} + +void fragment_main() { + textureGather_22e930(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DArray arg_1_arg_2; + +void textureGather_22e930() { + vec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), 1); +} + +void compute_main() { + textureGather_22e930(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/22e930.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureGather/22e930.wgsl.expected.hlsl new file mode 100644 index 0000000000..ad228813d2 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/22e930.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +Texture2DArray arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_22e930() { + float4 res = arg_1.GatherGreen(arg_2, float3(0.0f, 0.0f, float(1))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_22e930(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_22e930(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_22e930(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/22e930.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/22e930.wgsl.expected.msl new file mode 100644 index 0000000000..b432609d49 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/22e930.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureGather_22e930(texture2d_array tint_symbol_1, sampler tint_symbol_2) { + float4 res = tint_symbol_1.gather(tint_symbol_2, float2(0.0f), 1, int2(0), component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_3, sampler tint_symbol_4) { + textureGather_22e930(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_22e930(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_22e930(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureGather/22e930.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/22e930.wgsl.expected.spvasm new file mode 100644 index 0000000000..327eac55d0 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/22e930.wgsl.expected.spvasm @@ -0,0 +1,86 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 46 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_22e930 "textureGather_22e930" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_2 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %22 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 + %float_0 = OpConstant %float 0 + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %32 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_22e930 = OpFunction %void None %15 + %18 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %20 = OpLoad %14 %arg_2 + %21 = OpLoad %11 %arg_1 + %23 = OpSampledImage %22 %21 %20 + %26 = OpConvertSToF %float %int_1 + %29 = OpCompositeConstruct %v3float %float_0 %float_0 %26 + %19 = OpImageGather %v4float %23 %29 %int_1 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %32 + %34 = OpLabel + %35 = OpFunctionCall %void %textureGather_22e930 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %37 = OpLabel + %38 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %38 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %41 = OpLabel + %42 = OpFunctionCall %void %textureGather_22e930 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %44 = OpLabel + %45 = OpFunctionCall %void %textureGather_22e930 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureGather/22e930.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/22e930.wgsl.expected.wgsl new file mode 100644 index 0000000000..59aa3dd96e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/22e930.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(1) var arg_1 : texture_2d_array; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_22e930() { + var res : vec4 = textureGather(1, arg_1, arg_2, vec2(), 1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_22e930(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_22e930(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_22e930(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/2cc066.wgsl b/test/tint/builtins/gen/literal/textureGather/2cc066.wgsl new file mode 100644 index 0000000000..0e87293bc4 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/2cc066.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_2d_array; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32) -> vec4 +fn textureGather_2cc066() { + var res: vec4 = textureGather(1, arg_1, arg_2, vec2(), 1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_2cc066(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_2cc066(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_2cc066(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/2cc066.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/2cc066.wgsl.expected.glsl new file mode 100644 index 0000000000..7c6c1331a1 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/2cc066.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp usampler2DArray arg_1_arg_2; + +void textureGather_2cc066() { + uvec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), 1); +} + +vec4 vertex_main() { + textureGather_2cc066(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp usampler2DArray arg_1_arg_2; + +void textureGather_2cc066() { + uvec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), 1); +} + +void fragment_main() { + textureGather_2cc066(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp usampler2DArray arg_1_arg_2; + +void textureGather_2cc066() { + uvec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), 1); +} + +void compute_main() { + textureGather_2cc066(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/2cc066.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureGather/2cc066.wgsl.expected.hlsl new file mode 100644 index 0000000000..222acf566e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/2cc066.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +Texture2DArray arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_2cc066() { + uint4 res = arg_1.GatherGreen(arg_2, float3(0.0f, 0.0f, float(1))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_2cc066(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_2cc066(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_2cc066(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/2cc066.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/2cc066.wgsl.expected.msl new file mode 100644 index 0000000000..fa0531a389 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/2cc066.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureGather_2cc066(texture2d_array tint_symbol_1, sampler tint_symbol_2) { + uint4 res = tint_symbol_1.gather(tint_symbol_2, float2(0.0f), 1, int2(0), component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_3, sampler tint_symbol_4) { + textureGather_2cc066(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_2cc066(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_2cc066(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureGather/2cc066.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/2cc066.wgsl.expected.spvasm new file mode 100644 index 0000000000..a931db1de4 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/2cc066.wgsl.expected.spvasm @@ -0,0 +1,89 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 49 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_2cc066 "textureGather_2cc066" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %15 = OpTypeSampler +%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 + %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant + %void = OpTypeVoid + %16 = OpTypeFunction %void + %v4uint = OpTypeVector %uint 4 + %24 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 + %float_0 = OpConstant %float 0 + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %34 = OpConstantNull %v4uint + %35 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_2cc066 = OpFunction %void None %16 + %19 = OpLabel + %res = OpVariable %_ptr_Function_v4uint Function %34 + %22 = OpLoad %15 %arg_2 + %23 = OpLoad %11 %arg_1 + %25 = OpSampledImage %24 %23 %22 + %28 = OpConvertSToF %float %int_1 + %31 = OpCompositeConstruct %v3float %float_0 %float_0 %28 + %20 = OpImageGather %v4uint %25 %31 %int_1 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %35 + %37 = OpLabel + %38 = OpFunctionCall %void %textureGather_2cc066 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %16 + %40 = OpLabel + %41 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %41 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %16 + %44 = OpLabel + %45 = OpFunctionCall %void %textureGather_2cc066 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %16 + %47 = OpLabel + %48 = OpFunctionCall %void %textureGather_2cc066 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureGather/2cc066.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/2cc066.wgsl.expected.wgsl new file mode 100644 index 0000000000..777505a610 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/2cc066.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(1) var arg_1 : texture_2d_array; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_2cc066() { + var res : vec4 = textureGather(1, arg_1, arg_2, vec2(), 1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_2cc066(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_2cc066(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_2cc066(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/3112e8.wgsl b/test/tint/builtins/gen/literal/textureGather/3112e8.wgsl deleted file mode 100644 index 8c8de8892d..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/3112e8.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/gen/gen.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(1) var arg_1: texture_cube_array; -@group(1) @binding(2) var arg_2: sampler; - -// fn textureGather(component: i32, texture: texture_cube_array, sampler: sampler, coords: vec3, array_index: i32) -> vec4 -fn textureGather_3112e8() { - var res: vec4 = textureGather(1, arg_1, arg_2, vec3(), 1); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_3112e8(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_3112e8(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_3112e8(); -} diff --git a/test/tint/builtins/gen/literal/textureGather/3112e8.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/3112e8.wgsl.expected.glsl deleted file mode 100644 index 485392506f..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/3112e8.wgsl.expected.glsl +++ /dev/null @@ -1,78 +0,0 @@ -SKIP: FAILED - -#version 310 es - -uniform highp samplerCubeArray arg_1_arg_2; - -void textureGather_3112e8() { - vec4 res = textureGather(arg_1_arg_2, vec4(0.0f, 0.0f, 0.0f, float(1)), 1); -} - -vec4 vertex_main() { - textureGather_3112e8(); - return vec4(0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'samplerCubeArray' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -uniform highp samplerCubeArray arg_1_arg_2; - -void textureGather_3112e8() { - vec4 res = textureGather(arg_1_arg_2, vec4(0.0f, 0.0f, 0.0f, float(1)), 1); -} - -void fragment_main() { - textureGather_3112e8(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'samplerCubeArray' : Reserved word. -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -uniform highp samplerCubeArray arg_1_arg_2; - -void textureGather_3112e8() { - vec4 res = textureGather(arg_1_arg_2, vec4(0.0f, 0.0f, 0.0f, float(1)), 1); -} - -void compute_main() { - textureGather_3112e8(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'samplerCubeArray' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/literal/textureGather/3112e8.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureGather/3112e8.wgsl.expected.hlsl deleted file mode 100644 index efd9d9bef4..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/3112e8.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -TextureCubeArray arg_1 : register(t1, space1); -SamplerState arg_2 : register(s2, space1); - -void textureGather_3112e8() { - float4 res = arg_1.GatherGreen(arg_2, float4(0.0f, 0.0f, 0.0f, float(1))); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureGather_3112e8(); - return (0.0f).xxxx; -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureGather_3112e8(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureGather_3112e8(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureGather/3112e8.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/3112e8.wgsl.expected.msl deleted file mode 100644 index 6ebce318a8..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/3112e8.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureGather_3112e8(texturecube_array tint_symbol_1, sampler tint_symbol_2) { - float4 res = tint_symbol_1.gather(tint_symbol_2, float3(0.0f), 1, component::y); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texturecube_array tint_symbol_3, sampler tint_symbol_4) { - textureGather_3112e8(tint_symbol_3, tint_symbol_4); - return float4(0.0f); -} - -vertex tint_symbol vertex_main(texturecube_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texturecube_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureGather_3112e8(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(texturecube_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureGather_3112e8(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/literal/textureGather/3112e8.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/3112e8.wgsl.expected.spvasm deleted file mode 100644 index 267adbca78..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/3112e8.wgsl.expected.spvasm +++ /dev/null @@ -1,86 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 45 -; Schema: 0 - OpCapability Shader - OpCapability SampledCubeArray - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_1 "arg_1" - OpName %arg_2 "arg_2" - OpName %textureGather_3112e8 "textureGather_3112e8" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - OpDecorate %arg_2 DescriptorSet 1 - OpDecorate %arg_2 Binding 2 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %11 = OpTypeImage %float Cube 0 1 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %14 = OpTypeSampler -%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 - %arg_2 = OpVariable %_ptr_UniformConstant_14 UniformConstant - %void = OpTypeVoid - %15 = OpTypeFunction %void - %22 = OpTypeSampledImage %11 - %float_0 = OpConstant %float 0 - %int = OpTypeInt 32 1 - %int_1 = OpConstant %int 1 -%_ptr_Function_v4float = OpTypePointer Function %v4float - %31 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureGather_3112e8 = OpFunction %void None %15 - %18 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %20 = OpLoad %14 %arg_2 - %21 = OpLoad %11 %arg_1 - %23 = OpSampledImage %22 %21 %20 - %25 = OpConvertSToF %float %int_1 - %28 = OpCompositeConstruct %v4float %float_0 %float_0 %float_0 %25 - %19 = OpImageGather %v4float %23 %28 %int_1 - OpStore %res %19 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %31 - %33 = OpLabel - %34 = OpFunctionCall %void %textureGather_3112e8 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %15 - %36 = OpLabel - %37 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %37 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %15 - %40 = OpLabel - %41 = OpFunctionCall %void %textureGather_3112e8 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %15 - %43 = OpLabel - %44 = OpFunctionCall %void %textureGather_3112e8 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureGather/3112e8.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/3112e8.wgsl.expected.wgsl deleted file mode 100644 index 3f7ac9ee8a..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/3112e8.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(1) var arg_1 : texture_cube_array; - -@group(1) @binding(2) var arg_2 : sampler; - -fn textureGather_3112e8() { - var res : vec4 = textureGather(1, arg_1, arg_2, vec3(), 1); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_3112e8(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_3112e8(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_3112e8(); -} diff --git a/test/tint/builtins/gen/literal/textureGather/32c4e8.wgsl b/test/tint/builtins/gen/literal/textureGather/32c4e8.wgsl new file mode 100644 index 0000000000..8abb587c47 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/32c4e8.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_cube; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_cube, sampler: sampler, coords: vec3) -> vec4 +fn textureGather_32c4e8() { + var res: vec4 = textureGather(1, arg_1, arg_2, vec3()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_32c4e8(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_32c4e8(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_32c4e8(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/32c4e8.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/32c4e8.wgsl.expected.glsl new file mode 100644 index 0000000000..3b5504b9c1 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/32c4e8.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp samplerCube arg_1_arg_2; + +void textureGather_32c4e8() { + vec4 res = textureGather(arg_1_arg_2, vec3(0.0f), 1); +} + +vec4 vertex_main() { + textureGather_32c4e8(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp samplerCube arg_1_arg_2; + +void textureGather_32c4e8() { + vec4 res = textureGather(arg_1_arg_2, vec3(0.0f), 1); +} + +void fragment_main() { + textureGather_32c4e8(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp samplerCube arg_1_arg_2; + +void textureGather_32c4e8() { + vec4 res = textureGather(arg_1_arg_2, vec3(0.0f), 1); +} + +void compute_main() { + textureGather_32c4e8(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/32c4e8.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureGather/32c4e8.wgsl.expected.hlsl new file mode 100644 index 0000000000..ce7b157547 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/32c4e8.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +TextureCube arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_32c4e8() { + float4 res = arg_1.GatherGreen(arg_2, (0.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_32c4e8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_32c4e8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_32c4e8(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/32c4e8.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/32c4e8.wgsl.expected.msl new file mode 100644 index 0000000000..4553861a55 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/32c4e8.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureGather_32c4e8(texturecube tint_symbol_1, sampler tint_symbol_2) { + float4 res = tint_symbol_1.gather(tint_symbol_2, float3(0.0f), component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube tint_symbol_3, sampler tint_symbol_4) { + textureGather_32c4e8(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_32c4e8(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texturecube tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_32c4e8(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureGather/32c4e8.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/32c4e8.wgsl.expected.spvasm new file mode 100644 index 0000000000..f2cc29704e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/32c4e8.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_32c4e8 "textureGather_32c4e8" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float Cube 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_2 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %22 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 + %25 = OpConstantNull %v3float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %30 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_32c4e8 = OpFunction %void None %15 + %18 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %20 = OpLoad %14 %arg_2 + %21 = OpLoad %11 %arg_1 + %23 = OpSampledImage %22 %21 %20 + %19 = OpImageGather %v4float %23 %25 %int_1 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %textureGather_32c4e8 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %35 = OpLabel + %36 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %36 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %39 = OpLabel + %40 = OpFunctionCall %void %textureGather_32c4e8 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %42 = OpLabel + %43 = OpFunctionCall %void %textureGather_32c4e8 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureGather/32c4e8.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/32c4e8.wgsl.expected.wgsl new file mode 100644 index 0000000000..8c6ed677c5 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/32c4e8.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(1) var arg_1 : texture_cube; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_32c4e8() { + var res : vec4 = textureGather(1, arg_1, arg_2, vec3()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_32c4e8(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_32c4e8(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_32c4e8(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/3b32cc.wgsl b/test/tint/builtins/gen/literal/textureGather/3b32cc.wgsl new file mode 100644 index 0000000000..34d7c302f3 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/3b32cc.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_cube; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_cube, sampler: sampler, coords: vec3) -> vec4 +fn textureGather_3b32cc() { + var res: vec4 = textureGather(1, arg_1, arg_2, vec3()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_3b32cc(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_3b32cc(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_3b32cc(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/3b32cc.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/3b32cc.wgsl.expected.glsl new file mode 100644 index 0000000000..38d117622e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/3b32cc.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp usamplerCube arg_1_arg_2; + +void textureGather_3b32cc() { + uvec4 res = textureGather(arg_1_arg_2, vec3(0.0f), 1); +} + +vec4 vertex_main() { + textureGather_3b32cc(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp usamplerCube arg_1_arg_2; + +void textureGather_3b32cc() { + uvec4 res = textureGather(arg_1_arg_2, vec3(0.0f), 1); +} + +void fragment_main() { + textureGather_3b32cc(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp usamplerCube arg_1_arg_2; + +void textureGather_3b32cc() { + uvec4 res = textureGather(arg_1_arg_2, vec3(0.0f), 1); +} + +void compute_main() { + textureGather_3b32cc(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/3b32cc.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureGather/3b32cc.wgsl.expected.hlsl new file mode 100644 index 0000000000..4fe9dd1470 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/3b32cc.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +TextureCube arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_3b32cc() { + uint4 res = arg_1.GatherGreen(arg_2, (0.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_3b32cc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_3b32cc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_3b32cc(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/3b32cc.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/3b32cc.wgsl.expected.msl new file mode 100644 index 0000000000..864d36cf9f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/3b32cc.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureGather_3b32cc(texturecube tint_symbol_1, sampler tint_symbol_2) { + uint4 res = tint_symbol_1.gather(tint_symbol_2, float3(0.0f), component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube tint_symbol_3, sampler tint_symbol_4) { + textureGather_3b32cc(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_3b32cc(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texturecube tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_3b32cc(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureGather/3b32cc.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/3b32cc.wgsl.expected.spvasm new file mode 100644 index 0000000000..829beb2df2 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/3b32cc.wgsl.expected.spvasm @@ -0,0 +1,87 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_3b32cc "textureGather_3b32cc" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint Cube 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %15 = OpTypeSampler +%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 + %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant + %void = OpTypeVoid + %16 = OpTypeFunction %void + %v4uint = OpTypeVector %uint 4 + %24 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 + %27 = OpConstantNull %v3float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %32 = OpConstantNull %v4uint + %33 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_3b32cc = OpFunction %void None %16 + %19 = OpLabel + %res = OpVariable %_ptr_Function_v4uint Function %32 + %22 = OpLoad %15 %arg_2 + %23 = OpLoad %11 %arg_1 + %25 = OpSampledImage %24 %23 %22 + %20 = OpImageGather %v4uint %25 %27 %int_1 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %33 + %35 = OpLabel + %36 = OpFunctionCall %void %textureGather_3b32cc + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %16 + %38 = OpLabel + %39 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %39 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %16 + %42 = OpLabel + %43 = OpFunctionCall %void %textureGather_3b32cc + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %16 + %45 = OpLabel + %46 = OpFunctionCall %void %textureGather_3b32cc + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureGather/3b32cc.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/3b32cc.wgsl.expected.wgsl new file mode 100644 index 0000000000..f10092ee02 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/3b32cc.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(1) var arg_1 : texture_cube; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_3b32cc() { + var res : vec4 = textureGather(1, arg_1, arg_2, vec3()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_3b32cc(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_3b32cc(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_3b32cc(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/3c527e.wgsl b/test/tint/builtins/gen/literal/textureGather/3c527e.wgsl deleted file mode 100644 index 8f68c440f3..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/3c527e.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/gen/gen.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(1) var arg_1: texture_cube_array; -@group(1) @binding(2) var arg_2: sampler; - -// fn textureGather(component: i32, texture: texture_cube_array, sampler: sampler, coords: vec3, array_index: i32) -> vec4 -fn textureGather_3c527e() { - var res: vec4 = textureGather(1, arg_1, arg_2, vec3(), 1); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_3c527e(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_3c527e(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_3c527e(); -} diff --git a/test/tint/builtins/gen/literal/textureGather/3c527e.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/3c527e.wgsl.expected.glsl deleted file mode 100644 index 406f5df550..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/3c527e.wgsl.expected.glsl +++ /dev/null @@ -1,78 +0,0 @@ -SKIP: FAILED - -#version 310 es - -uniform highp usamplerCubeArray arg_1_arg_2; - -void textureGather_3c527e() { - uvec4 res = textureGather(arg_1_arg_2, vec4(0.0f, 0.0f, 0.0f, float(1)), 1); -} - -vec4 vertex_main() { - textureGather_3c527e(); - return vec4(0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'usamplerCubeArray' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -uniform highp usamplerCubeArray arg_1_arg_2; - -void textureGather_3c527e() { - uvec4 res = textureGather(arg_1_arg_2, vec4(0.0f, 0.0f, 0.0f, float(1)), 1); -} - -void fragment_main() { - textureGather_3c527e(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'usamplerCubeArray' : Reserved word. -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -uniform highp usamplerCubeArray arg_1_arg_2; - -void textureGather_3c527e() { - uvec4 res = textureGather(arg_1_arg_2, vec4(0.0f, 0.0f, 0.0f, float(1)), 1); -} - -void compute_main() { - textureGather_3c527e(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'usamplerCubeArray' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/literal/textureGather/3c527e.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureGather/3c527e.wgsl.expected.hlsl deleted file mode 100644 index 6de2c853c5..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/3c527e.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -TextureCubeArray arg_1 : register(t1, space1); -SamplerState arg_2 : register(s2, space1); - -void textureGather_3c527e() { - uint4 res = arg_1.GatherGreen(arg_2, float4(0.0f, 0.0f, 0.0f, float(1))); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureGather_3c527e(); - return (0.0f).xxxx; -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureGather_3c527e(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureGather_3c527e(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureGather/3c527e.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/3c527e.wgsl.expected.msl deleted file mode 100644 index ff4aec3d36..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/3c527e.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureGather_3c527e(texturecube_array tint_symbol_1, sampler tint_symbol_2) { - uint4 res = tint_symbol_1.gather(tint_symbol_2, float3(0.0f), 1, component::y); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texturecube_array tint_symbol_3, sampler tint_symbol_4) { - textureGather_3c527e(tint_symbol_3, tint_symbol_4); - return float4(0.0f); -} - -vertex tint_symbol vertex_main(texturecube_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texturecube_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureGather_3c527e(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(texturecube_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureGather_3c527e(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/literal/textureGather/3c527e.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/3c527e.wgsl.expected.spvasm deleted file mode 100644 index 4ee0085682..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/3c527e.wgsl.expected.spvasm +++ /dev/null @@ -1,89 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 48 -; Schema: 0 - OpCapability Shader - OpCapability SampledCubeArray - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_1 "arg_1" - OpName %arg_2 "arg_2" - OpName %textureGather_3c527e "textureGather_3c527e" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - OpDecorate %arg_2 DescriptorSet 1 - OpDecorate %arg_2 Binding 2 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %uint = OpTypeInt 32 0 - %11 = OpTypeImage %uint Cube 0 1 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %15 = OpTypeSampler -%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 - %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant - %void = OpTypeVoid - %16 = OpTypeFunction %void - %v4uint = OpTypeVector %uint 4 - %24 = OpTypeSampledImage %11 - %float_0 = OpConstant %float 0 - %int = OpTypeInt 32 1 - %int_1 = OpConstant %int 1 -%_ptr_Function_v4uint = OpTypePointer Function %v4uint - %33 = OpConstantNull %v4uint - %34 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureGather_3c527e = OpFunction %void None %16 - %19 = OpLabel - %res = OpVariable %_ptr_Function_v4uint Function %33 - %22 = OpLoad %15 %arg_2 - %23 = OpLoad %11 %arg_1 - %25 = OpSampledImage %24 %23 %22 - %27 = OpConvertSToF %float %int_1 - %30 = OpCompositeConstruct %v4float %float_0 %float_0 %float_0 %27 - %20 = OpImageGather %v4uint %25 %30 %int_1 - OpStore %res %20 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %34 - %36 = OpLabel - %37 = OpFunctionCall %void %textureGather_3c527e - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %16 - %39 = OpLabel - %40 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %40 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %16 - %43 = OpLabel - %44 = OpFunctionCall %void %textureGather_3c527e - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %16 - %46 = OpLabel - %47 = OpFunctionCall %void %textureGather_3c527e - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureGather/3c527e.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/3c527e.wgsl.expected.wgsl deleted file mode 100644 index 9753db49b7..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/3c527e.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(1) var arg_1 : texture_cube_array; - -@group(1) @binding(2) var arg_2 : sampler; - -fn textureGather_3c527e() { - var res : vec4 = textureGather(1, arg_1, arg_2, vec3(), 1); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_3c527e(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_3c527e(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_3c527e(); -} diff --git a/test/tint/builtins/gen/literal/textureGather/49b07f.wgsl b/test/tint/builtins/gen/literal/textureGather/49b07f.wgsl new file mode 100644 index 0000000000..c2232949eb --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/49b07f.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_2d; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_2d, sampler: sampler, coords: vec2, @const offset: vec2) -> vec4 +fn textureGather_49b07f() { + var res: vec4 = textureGather(1, arg_1, arg_2, vec2(), vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_49b07f(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_49b07f(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_49b07f(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/49b07f.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/49b07f.wgsl.expected.glsl new file mode 100644 index 0000000000..fbcc858c58 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/49b07f.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp usampler2D arg_1_arg_2; + +void textureGather_49b07f() { + uvec4 res = textureGatherOffset(arg_1_arg_2, vec2(0.0f), ivec2(0), 1); +} + +vec4 vertex_main() { + textureGather_49b07f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp usampler2D arg_1_arg_2; + +void textureGather_49b07f() { + uvec4 res = textureGatherOffset(arg_1_arg_2, vec2(0.0f), ivec2(0), 1); +} + +void fragment_main() { + textureGather_49b07f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp usampler2D arg_1_arg_2; + +void textureGather_49b07f() { + uvec4 res = textureGatherOffset(arg_1_arg_2, vec2(0.0f), ivec2(0), 1); +} + +void compute_main() { + textureGather_49b07f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/49b07f.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureGather/49b07f.wgsl.expected.hlsl new file mode 100644 index 0000000000..b70c4827dd --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/49b07f.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +Texture2D arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_49b07f() { + uint4 res = arg_1.GatherGreen(arg_2, (0.0f).xx, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_49b07f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_49b07f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_49b07f(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/49b07f.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/49b07f.wgsl.expected.msl new file mode 100644 index 0000000000..3f485b49d0 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/49b07f.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureGather_49b07f(texture2d tint_symbol_1, sampler tint_symbol_2) { + uint4 res = tint_symbol_1.gather(tint_symbol_2, float2(0.0f), int2(0), component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_3, sampler tint_symbol_4) { + textureGather_49b07f(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_49b07f(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_49b07f(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureGather/49b07f.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/49b07f.wgsl.expected.spvasm new file mode 100644 index 0000000000..74778200f2 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/49b07f.wgsl.expected.spvasm @@ -0,0 +1,89 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 49 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_49b07f "textureGather_49b07f" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %15 = OpTypeSampler +%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 + %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant + %void = OpTypeVoid + %16 = OpTypeFunction %void + %v4uint = OpTypeVector %uint 4 + %24 = OpTypeSampledImage %11 + %v2float = OpTypeVector %float 2 + %27 = OpConstantNull %v2float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %v2int = OpTypeVector %int 2 + %31 = OpConstantNull %v2int +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %34 = OpConstantNull %v4uint + %35 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_49b07f = OpFunction %void None %16 + %19 = OpLabel + %res = OpVariable %_ptr_Function_v4uint Function %34 + %22 = OpLoad %15 %arg_2 + %23 = OpLoad %11 %arg_1 + %25 = OpSampledImage %24 %23 %22 + %20 = OpImageGather %v4uint %25 %27 %int_1 ConstOffset %31 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %35 + %37 = OpLabel + %38 = OpFunctionCall %void %textureGather_49b07f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %16 + %40 = OpLabel + %41 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %41 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %16 + %44 = OpLabel + %45 = OpFunctionCall %void %textureGather_49b07f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %16 + %47 = OpLabel + %48 = OpFunctionCall %void %textureGather_49b07f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureGather/49b07f.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/49b07f.wgsl.expected.wgsl new file mode 100644 index 0000000000..c6cb144fea --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/49b07f.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(1) var arg_1 : texture_2d; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_49b07f() { + var res : vec4 = textureGather(1, arg_1, arg_2, vec2(), vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_49b07f(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_49b07f(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_49b07f(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/4b8103.wgsl b/test/tint/builtins/gen/literal/textureGather/4b8103.wgsl new file mode 100644 index 0000000000..055e1967dd --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/4b8103.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_2d_array; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, @const offset: vec2) -> vec4 +fn textureGather_4b8103() { + var res: vec4 = textureGather(1, arg_1, arg_2, vec2(), 1, vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_4b8103(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_4b8103(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_4b8103(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/4b8103.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/4b8103.wgsl.expected.glsl new file mode 100644 index 0000000000..2eeca6e86e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/4b8103.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp sampler2DArray arg_1_arg_2; + +void textureGather_4b8103() { + vec4 res = textureGatherOffset(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), ivec2(0), 1); +} + +vec4 vertex_main() { + textureGather_4b8103(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DArray arg_1_arg_2; + +void textureGather_4b8103() { + vec4 res = textureGatherOffset(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), ivec2(0), 1); +} + +void fragment_main() { + textureGather_4b8103(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DArray arg_1_arg_2; + +void textureGather_4b8103() { + vec4 res = textureGatherOffset(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), ivec2(0), 1); +} + +void compute_main() { + textureGather_4b8103(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/4b8103.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureGather/4b8103.wgsl.expected.hlsl new file mode 100644 index 0000000000..3a7dca0279 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/4b8103.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +Texture2DArray arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_4b8103() { + float4 res = arg_1.GatherGreen(arg_2, float3(0.0f, 0.0f, float(1)), (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_4b8103(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_4b8103(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_4b8103(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/4b8103.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/4b8103.wgsl.expected.msl new file mode 100644 index 0000000000..f1604b9054 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/4b8103.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureGather_4b8103(texture2d_array tint_symbol_1, sampler tint_symbol_2) { + float4 res = tint_symbol_1.gather(tint_symbol_2, float2(0.0f), 1, int2(0), component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_3, sampler tint_symbol_4) { + textureGather_4b8103(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_4b8103(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_4b8103(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureGather/4b8103.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/4b8103.wgsl.expected.spvasm new file mode 100644 index 0000000000..d995343f5a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/4b8103.wgsl.expected.spvasm @@ -0,0 +1,88 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 48 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_4b8103 "textureGather_4b8103" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_2 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %22 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 + %float_0 = OpConstant %float 0 + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %v2int = OpTypeVector %int 2 + %31 = OpConstantNull %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %34 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_4b8103 = OpFunction %void None %15 + %18 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %20 = OpLoad %14 %arg_2 + %21 = OpLoad %11 %arg_1 + %23 = OpSampledImage %22 %21 %20 + %26 = OpConvertSToF %float %int_1 + %29 = OpCompositeConstruct %v3float %float_0 %float_0 %26 + %19 = OpImageGather %v4float %23 %29 %int_1 ConstOffset %31 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %34 + %36 = OpLabel + %37 = OpFunctionCall %void %textureGather_4b8103 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %39 = OpLabel + %40 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %40 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %43 = OpLabel + %44 = OpFunctionCall %void %textureGather_4b8103 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %46 = OpLabel + %47 = OpFunctionCall %void %textureGather_4b8103 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureGather/4b8103.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/4b8103.wgsl.expected.wgsl new file mode 100644 index 0000000000..94d2c7e4b7 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/4b8103.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(1) var arg_1 : texture_2d_array; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_4b8103() { + var res : vec4 = textureGather(1, arg_1, arg_2, vec2(), 1, vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_4b8103(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_4b8103(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_4b8103(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/4f2350.wgsl b/test/tint/builtins/gen/literal/textureGather/4f2350.wgsl deleted file mode 100644 index 8ff0bf7259..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/4f2350.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/gen/gen.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(1) var arg_1: texture_2d_array; -@group(1) @binding(2) var arg_2: sampler; - -// fn textureGather(component: i32, texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, offset: vec2) -> vec4 -fn textureGather_4f2350() { - var res: vec4 = textureGather(1, arg_1, arg_2, vec2(), 1, vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_4f2350(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_4f2350(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_4f2350(); -} diff --git a/test/tint/builtins/gen/literal/textureGather/4f2350.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/4f2350.wgsl.expected.glsl deleted file mode 100644 index 82d6a06204..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/4f2350.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp isampler2DArray arg_1_arg_2; - -void textureGather_4f2350() { - ivec4 res = textureGatherOffset(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), ivec2(0), 1); -} - -vec4 vertex_main() { - textureGather_4f2350(); - return vec4(0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp isampler2DArray arg_1_arg_2; - -void textureGather_4f2350() { - ivec4 res = textureGatherOffset(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), ivec2(0), 1); -} - -void fragment_main() { - textureGather_4f2350(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp isampler2DArray arg_1_arg_2; - -void textureGather_4f2350() { - ivec4 res = textureGatherOffset(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), ivec2(0), 1); -} - -void compute_main() { - textureGather_4f2350(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureGather/4f2350.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureGather/4f2350.wgsl.expected.hlsl deleted file mode 100644 index d109a47cff..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/4f2350.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -Texture2DArray arg_1 : register(t1, space1); -SamplerState arg_2 : register(s2, space1); - -void textureGather_4f2350() { - int4 res = arg_1.GatherGreen(arg_2, float3(0.0f, 0.0f, float(1)), (0).xx); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureGather_4f2350(); - return (0.0f).xxxx; -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureGather_4f2350(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureGather_4f2350(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureGather/4f2350.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/4f2350.wgsl.expected.msl deleted file mode 100644 index 95a43357d4..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/4f2350.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureGather_4f2350(texture2d_array tint_symbol_1, sampler tint_symbol_2) { - int4 res = tint_symbol_1.gather(tint_symbol_2, float2(0.0f), 1, int2(0), component::y); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_3, sampler tint_symbol_4) { - textureGather_4f2350(tint_symbol_3, tint_symbol_4); - return float4(0.0f); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureGather_4f2350(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureGather_4f2350(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/literal/textureGather/4f2350.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/4f2350.wgsl.expected.spvasm deleted file mode 100644 index c6ff85cb1f..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/4f2350.wgsl.expected.spvasm +++ /dev/null @@ -1,90 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 50 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_1 "arg_1" - OpName %arg_2 "arg_2" - OpName %textureGather_4f2350 "textureGather_4f2350" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - OpDecorate %arg_2 DescriptorSet 1 - OpDecorate %arg_2 Binding 2 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %int = OpTypeInt 32 1 - %11 = OpTypeImage %int 2D 0 1 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %15 = OpTypeSampler -%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 - %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant - %void = OpTypeVoid - %16 = OpTypeFunction %void - %v4int = OpTypeVector %int 4 - %24 = OpTypeSampledImage %11 - %v3float = OpTypeVector %float 3 - %float_0 = OpConstant %float 0 - %int_1 = OpConstant %int 1 - %v2int = OpTypeVector %int 2 - %32 = OpConstantNull %v2int -%_ptr_Function_v4int = OpTypePointer Function %v4int - %35 = OpConstantNull %v4int - %36 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureGather_4f2350 = OpFunction %void None %16 - %19 = OpLabel - %res = OpVariable %_ptr_Function_v4int Function %35 - %22 = OpLoad %15 %arg_2 - %23 = OpLoad %11 %arg_1 - %25 = OpSampledImage %24 %23 %22 - %28 = OpConvertSToF %float %int_1 - %30 = OpCompositeConstruct %v3float %float_0 %float_0 %28 - %20 = OpImageGather %v4int %25 %30 %int_1 ConstOffset %32 - OpStore %res %20 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %36 - %38 = OpLabel - %39 = OpFunctionCall %void %textureGather_4f2350 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %16 - %41 = OpLabel - %42 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %42 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %16 - %45 = OpLabel - %46 = OpFunctionCall %void %textureGather_4f2350 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %16 - %48 = OpLabel - %49 = OpFunctionCall %void %textureGather_4f2350 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureGather/4f2350.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/4f2350.wgsl.expected.wgsl deleted file mode 100644 index 75a6912f6a..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/4f2350.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(1) var arg_1 : texture_2d_array; - -@group(1) @binding(2) var arg_2 : sampler; - -fn textureGather_4f2350() { - var res : vec4 = textureGather(1, arg_1, arg_2, vec2(), 1, vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_4f2350(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_4f2350(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_4f2350(); -} diff --git a/test/tint/builtins/gen/literal/textureGather/51cf0b.wgsl b/test/tint/builtins/gen/literal/textureGather/51cf0b.wgsl deleted file mode 100644 index 1fdec123bb..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/51cf0b.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/gen/gen.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(1) var arg_1: texture_2d_array; -@group(1) @binding(2) var arg_2: sampler; - -// fn textureGather(component: i32, texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32) -> vec4 -fn textureGather_51cf0b() { - var res: vec4 = textureGather(1, arg_1, arg_2, vec2(), 1); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_51cf0b(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_51cf0b(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_51cf0b(); -} diff --git a/test/tint/builtins/gen/literal/textureGather/51cf0b.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/51cf0b.wgsl.expected.glsl deleted file mode 100644 index 4a4c778f36..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/51cf0b.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp isampler2DArray arg_1_arg_2; - -void textureGather_51cf0b() { - ivec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), 1); -} - -vec4 vertex_main() { - textureGather_51cf0b(); - return vec4(0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp isampler2DArray arg_1_arg_2; - -void textureGather_51cf0b() { - ivec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), 1); -} - -void fragment_main() { - textureGather_51cf0b(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp isampler2DArray arg_1_arg_2; - -void textureGather_51cf0b() { - ivec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), 1); -} - -void compute_main() { - textureGather_51cf0b(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureGather/51cf0b.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureGather/51cf0b.wgsl.expected.hlsl deleted file mode 100644 index 77626e4b4d..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/51cf0b.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -Texture2DArray arg_1 : register(t1, space1); -SamplerState arg_2 : register(s2, space1); - -void textureGather_51cf0b() { - int4 res = arg_1.GatherGreen(arg_2, float3(0.0f, 0.0f, float(1))); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureGather_51cf0b(); - return (0.0f).xxxx; -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureGather_51cf0b(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureGather_51cf0b(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureGather/51cf0b.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/51cf0b.wgsl.expected.msl deleted file mode 100644 index 4ba9e53605..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/51cf0b.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureGather_51cf0b(texture2d_array tint_symbol_1, sampler tint_symbol_2) { - int4 res = tint_symbol_1.gather(tint_symbol_2, float2(0.0f), 1, int2(0), component::y); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_3, sampler tint_symbol_4) { - textureGather_51cf0b(tint_symbol_3, tint_symbol_4); - return float4(0.0f); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureGather_51cf0b(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureGather_51cf0b(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/literal/textureGather/51cf0b.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/51cf0b.wgsl.expected.spvasm deleted file mode 100644 index 4bc14404e9..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/51cf0b.wgsl.expected.spvasm +++ /dev/null @@ -1,88 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 48 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_1 "arg_1" - OpName %arg_2 "arg_2" - OpName %textureGather_51cf0b "textureGather_51cf0b" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - OpDecorate %arg_2 DescriptorSet 1 - OpDecorate %arg_2 Binding 2 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %int = OpTypeInt 32 1 - %11 = OpTypeImage %int 2D 0 1 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %15 = OpTypeSampler -%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 - %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant - %void = OpTypeVoid - %16 = OpTypeFunction %void - %v4int = OpTypeVector %int 4 - %24 = OpTypeSampledImage %11 - %v3float = OpTypeVector %float 3 - %float_0 = OpConstant %float 0 - %int_1 = OpConstant %int 1 -%_ptr_Function_v4int = OpTypePointer Function %v4int - %33 = OpConstantNull %v4int - %34 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureGather_51cf0b = OpFunction %void None %16 - %19 = OpLabel - %res = OpVariable %_ptr_Function_v4int Function %33 - %22 = OpLoad %15 %arg_2 - %23 = OpLoad %11 %arg_1 - %25 = OpSampledImage %24 %23 %22 - %28 = OpConvertSToF %float %int_1 - %30 = OpCompositeConstruct %v3float %float_0 %float_0 %28 - %20 = OpImageGather %v4int %25 %30 %int_1 - OpStore %res %20 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %34 - %36 = OpLabel - %37 = OpFunctionCall %void %textureGather_51cf0b - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %16 - %39 = OpLabel - %40 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %40 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %16 - %43 = OpLabel - %44 = OpFunctionCall %void %textureGather_51cf0b - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %16 - %46 = OpLabel - %47 = OpFunctionCall %void %textureGather_51cf0b - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureGather/51cf0b.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/51cf0b.wgsl.expected.wgsl deleted file mode 100644 index e326e20388..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/51cf0b.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(1) var arg_1 : texture_2d_array; - -@group(1) @binding(2) var arg_2 : sampler; - -fn textureGather_51cf0b() { - var res : vec4 = textureGather(1, arg_1, arg_2, vec2(), 1); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_51cf0b(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_51cf0b(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_51cf0b(); -} diff --git a/test/tint/builtins/gen/literal/textureGather/5266da.wgsl b/test/tint/builtins/gen/literal/textureGather/5266da.wgsl new file mode 100644 index 0000000000..e05113fd52 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/5266da.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_2d; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_2d, sampler: sampler, coords: vec2) -> vec4 +fn textureGather_5266da() { + var res: vec4 = textureGather(1, arg_1, arg_2, vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_5266da(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_5266da(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_5266da(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/5266da.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/5266da.wgsl.expected.glsl new file mode 100644 index 0000000000..9bc3a2832d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/5266da.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp sampler2D arg_1_arg_2; + +void textureGather_5266da() { + vec4 res = textureGather(arg_1_arg_2, vec2(0.0f), 1); +} + +vec4 vertex_main() { + textureGather_5266da(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2D arg_1_arg_2; + +void textureGather_5266da() { + vec4 res = textureGather(arg_1_arg_2, vec2(0.0f), 1); +} + +void fragment_main() { + textureGather_5266da(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2D arg_1_arg_2; + +void textureGather_5266da() { + vec4 res = textureGather(arg_1_arg_2, vec2(0.0f), 1); +} + +void compute_main() { + textureGather_5266da(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/5266da.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureGather/5266da.wgsl.expected.hlsl new file mode 100644 index 0000000000..a616ea774a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/5266da.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +Texture2D arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_5266da() { + float4 res = arg_1.GatherGreen(arg_2, (0.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_5266da(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_5266da(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_5266da(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/5266da.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/5266da.wgsl.expected.msl new file mode 100644 index 0000000000..2082f6a54b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/5266da.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureGather_5266da(texture2d tint_symbol_1, sampler tint_symbol_2) { + float4 res = tint_symbol_1.gather(tint_symbol_2, float2(0.0f), int2(0), component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_3, sampler tint_symbol_4) { + textureGather_5266da(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_5266da(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_5266da(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureGather/5266da.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/5266da.wgsl.expected.spvasm new file mode 100644 index 0000000000..51c672ed6b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/5266da.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_5266da "textureGather_5266da" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_2 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %22 = OpTypeSampledImage %11 + %v2float = OpTypeVector %float 2 + %25 = OpConstantNull %v2float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %30 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_5266da = OpFunction %void None %15 + %18 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %20 = OpLoad %14 %arg_2 + %21 = OpLoad %11 %arg_1 + %23 = OpSampledImage %22 %21 %20 + %19 = OpImageGather %v4float %23 %25 %int_1 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %textureGather_5266da + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %35 = OpLabel + %36 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %36 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %39 = OpLabel + %40 = OpFunctionCall %void %textureGather_5266da + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %42 = OpLabel + %43 = OpFunctionCall %void %textureGather_5266da + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureGather/5266da.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/5266da.wgsl.expected.wgsl new file mode 100644 index 0000000000..246b0474e7 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/5266da.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(1) var arg_1 : texture_2d; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_5266da() { + var res : vec4 = textureGather(1, arg_1, arg_2, vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_5266da(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_5266da(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_5266da(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/53ece6.wgsl b/test/tint/builtins/gen/literal/textureGather/53ece6.wgsl deleted file mode 100644 index 3bcf11a6a2..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/53ece6.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/gen/gen.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_depth_2d_array; -@group(1) @binding(1) var arg_1: sampler; - -// fn textureGather(texture: texture_depth_2d_array, sampler: sampler, coords: vec2, array_index: i32, offset: vec2) -> vec4 -fn textureGather_53ece6() { - var res: vec4 = textureGather(arg_0, arg_1, vec2(), 1, vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_53ece6(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_53ece6(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_53ece6(); -} diff --git a/test/tint/builtins/gen/literal/textureGather/53ece6.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/53ece6.wgsl.expected.glsl deleted file mode 100644 index 113e02ded7..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/53ece6.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp sampler2DArrayShadow arg_0_arg_1; - -void textureGather_53ece6() { - vec4 res = textureGatherOffset(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), 0.0, ivec2(0)); -} - -vec4 vertex_main() { - textureGather_53ece6(); - return vec4(0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp sampler2DArrayShadow arg_0_arg_1; - -void textureGather_53ece6() { - vec4 res = textureGatherOffset(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), 0.0, ivec2(0)); -} - -void fragment_main() { - textureGather_53ece6(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp sampler2DArrayShadow arg_0_arg_1; - -void textureGather_53ece6() { - vec4 res = textureGatherOffset(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), 0.0, ivec2(0)); -} - -void compute_main() { - textureGather_53ece6(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureGather/53ece6.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureGather/53ece6.wgsl.expected.hlsl deleted file mode 100644 index af2d8c944d..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/53ece6.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -Texture2DArray arg_0 : register(t0, space1); -SamplerState arg_1 : register(s1, space1); - -void textureGather_53ece6() { - float4 res = arg_0.Gather(arg_1, float3(0.0f, 0.0f, float(1)), (0).xx); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureGather_53ece6(); - return (0.0f).xxxx; -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureGather_53ece6(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureGather_53ece6(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureGather/53ece6.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/53ece6.wgsl.expected.msl deleted file mode 100644 index 0138daa5d8..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/53ece6.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureGather_53ece6(depth2d_array tint_symbol_1, sampler tint_symbol_2) { - float4 res = tint_symbol_1.gather(tint_symbol_2, float2(0.0f), 1, int2(0)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(depth2d_array tint_symbol_3, sampler tint_symbol_4) { - textureGather_53ece6(tint_symbol_3, tint_symbol_4); - return float4(0.0f); -} - -vertex tint_symbol vertex_main(depth2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(depth2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureGather_53ece6(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(depth2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureGather_53ece6(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/literal/textureGather/53ece6.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/53ece6.wgsl.expected.spvasm deleted file mode 100644 index ab53c1f530..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/53ece6.wgsl.expected.spvasm +++ /dev/null @@ -1,89 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 49 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_0 "arg_0" - OpName %arg_1 "arg_1" - OpName %textureGather_53ece6 "textureGather_53ece6" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %11 = OpTypeImage %float 2D 0 1 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %14 = OpTypeSampler -%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 - %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant - %void = OpTypeVoid - %15 = OpTypeFunction %void - %22 = OpTypeSampledImage %11 - %v3float = OpTypeVector %float 3 - %float_0 = OpConstant %float 0 - %int = OpTypeInt 32 1 - %int_1 = OpConstant %int 1 - %int_0 = OpConstant %int 0 - %v2int = OpTypeVector %int 2 - %32 = OpConstantNull %v2int -%_ptr_Function_v4float = OpTypePointer Function %v4float - %35 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureGather_53ece6 = OpFunction %void None %15 - %18 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %20 = OpLoad %14 %arg_1 - %21 = OpLoad %11 %arg_0 - %23 = OpSampledImage %22 %21 %20 - %26 = OpConvertSToF %float %int_1 - %29 = OpCompositeConstruct %v3float %float_0 %float_0 %26 - %19 = OpImageGather %v4float %23 %29 %int_0 ConstOffset %32 - OpStore %res %19 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %35 - %37 = OpLabel - %38 = OpFunctionCall %void %textureGather_53ece6 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %15 - %40 = OpLabel - %41 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %41 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %15 - %44 = OpLabel - %45 = OpFunctionCall %void %textureGather_53ece6 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %15 - %47 = OpLabel - %48 = OpFunctionCall %void %textureGather_53ece6 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureGather/53ece6.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/53ece6.wgsl.expected.wgsl deleted file mode 100644 index 27c47cfc4d..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/53ece6.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_depth_2d_array; - -@group(1) @binding(1) var arg_1 : sampler; - -fn textureGather_53ece6() { - var res : vec4 = textureGather(arg_0, arg_1, vec2(), 1, vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_53ece6(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_53ece6(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_53ece6(); -} diff --git a/test/tint/builtins/gen/literal/textureGather/57bfc6.wgsl b/test/tint/builtins/gen/literal/textureGather/57bfc6.wgsl deleted file mode 100644 index 4676766f36..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/57bfc6.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/gen/gen.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(1) var arg_1: texture_cube; -@group(1) @binding(2) var arg_2: sampler; - -// fn textureGather(component: i32, texture: texture_cube, sampler: sampler, coords: vec3) -> vec4 -fn textureGather_57bfc6() { - var res: vec4 = textureGather(1, arg_1, arg_2, vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_57bfc6(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_57bfc6(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_57bfc6(); -} diff --git a/test/tint/builtins/gen/literal/textureGather/57bfc6.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/57bfc6.wgsl.expected.glsl deleted file mode 100644 index d6f10cc653..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/57bfc6.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp samplerCube arg_1_arg_2; - -void textureGather_57bfc6() { - vec4 res = textureGather(arg_1_arg_2, vec3(0.0f), 1); -} - -vec4 vertex_main() { - textureGather_57bfc6(); - return vec4(0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp samplerCube arg_1_arg_2; - -void textureGather_57bfc6() { - vec4 res = textureGather(arg_1_arg_2, vec3(0.0f), 1); -} - -void fragment_main() { - textureGather_57bfc6(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp samplerCube arg_1_arg_2; - -void textureGather_57bfc6() { - vec4 res = textureGather(arg_1_arg_2, vec3(0.0f), 1); -} - -void compute_main() { - textureGather_57bfc6(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureGather/57bfc6.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureGather/57bfc6.wgsl.expected.hlsl deleted file mode 100644 index 0597538ada..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/57bfc6.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -TextureCube arg_1 : register(t1, space1); -SamplerState arg_2 : register(s2, space1); - -void textureGather_57bfc6() { - float4 res = arg_1.GatherGreen(arg_2, (0.0f).xxx); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureGather_57bfc6(); - return (0.0f).xxxx; -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureGather_57bfc6(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureGather_57bfc6(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureGather/57bfc6.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/57bfc6.wgsl.expected.msl deleted file mode 100644 index bbe676a2e4..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/57bfc6.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureGather_57bfc6(texturecube tint_symbol_1, sampler tint_symbol_2) { - float4 res = tint_symbol_1.gather(tint_symbol_2, float3(0.0f), component::y); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texturecube tint_symbol_3, sampler tint_symbol_4) { - textureGather_57bfc6(tint_symbol_3, tint_symbol_4); - return float4(0.0f); -} - -vertex tint_symbol vertex_main(texturecube tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texturecube tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureGather_57bfc6(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(texturecube tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureGather_57bfc6(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/literal/textureGather/57bfc6.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/57bfc6.wgsl.expected.spvasm deleted file mode 100644 index 531f1964a4..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/57bfc6.wgsl.expected.spvasm +++ /dev/null @@ -1,84 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 44 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_1 "arg_1" - OpName %arg_2 "arg_2" - OpName %textureGather_57bfc6 "textureGather_57bfc6" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - OpDecorate %arg_2 DescriptorSet 1 - OpDecorate %arg_2 Binding 2 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %11 = OpTypeImage %float Cube 0 0 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %14 = OpTypeSampler -%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 - %arg_2 = OpVariable %_ptr_UniformConstant_14 UniformConstant - %void = OpTypeVoid - %15 = OpTypeFunction %void - %22 = OpTypeSampledImage %11 - %v3float = OpTypeVector %float 3 - %25 = OpConstantNull %v3float - %int = OpTypeInt 32 1 - %int_1 = OpConstant %int 1 -%_ptr_Function_v4float = OpTypePointer Function %v4float - %30 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureGather_57bfc6 = OpFunction %void None %15 - %18 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %20 = OpLoad %14 %arg_2 - %21 = OpLoad %11 %arg_1 - %23 = OpSampledImage %22 %21 %20 - %19 = OpImageGather %v4float %23 %25 %int_1 - OpStore %res %19 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %30 - %32 = OpLabel - %33 = OpFunctionCall %void %textureGather_57bfc6 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %15 - %35 = OpLabel - %36 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %36 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %15 - %39 = OpLabel - %40 = OpFunctionCall %void %textureGather_57bfc6 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %15 - %42 = OpLabel - %43 = OpFunctionCall %void %textureGather_57bfc6 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureGather/57bfc6.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/57bfc6.wgsl.expected.wgsl deleted file mode 100644 index 8273199c8e..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/57bfc6.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(1) var arg_1 : texture_cube; - -@group(1) @binding(2) var arg_2 : sampler; - -fn textureGather_57bfc6() { - var res : vec4 = textureGather(1, arg_1, arg_2, vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_57bfc6(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_57bfc6(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_57bfc6(); -} diff --git a/test/tint/builtins/gen/literal/textureGather/587ba3.wgsl b/test/tint/builtins/gen/literal/textureGather/587ba3.wgsl deleted file mode 100644 index 06c9f40c9f..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/587ba3.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/gen/gen.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(1) var arg_1: texture_2d; -@group(1) @binding(2) var arg_2: sampler; - -// fn textureGather(component: i32, texture: texture_2d, sampler: sampler, coords: vec2) -> vec4 -fn textureGather_587ba3() { - var res: vec4 = textureGather(1, arg_1, arg_2, vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_587ba3(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_587ba3(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_587ba3(); -} diff --git a/test/tint/builtins/gen/literal/textureGather/587ba3.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/587ba3.wgsl.expected.glsl deleted file mode 100644 index cd495cbcd2..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/587ba3.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp isampler2D arg_1_arg_2; - -void textureGather_587ba3() { - ivec4 res = textureGather(arg_1_arg_2, vec2(0.0f), 1); -} - -vec4 vertex_main() { - textureGather_587ba3(); - return vec4(0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp isampler2D arg_1_arg_2; - -void textureGather_587ba3() { - ivec4 res = textureGather(arg_1_arg_2, vec2(0.0f), 1); -} - -void fragment_main() { - textureGather_587ba3(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp isampler2D arg_1_arg_2; - -void textureGather_587ba3() { - ivec4 res = textureGather(arg_1_arg_2, vec2(0.0f), 1); -} - -void compute_main() { - textureGather_587ba3(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureGather/587ba3.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureGather/587ba3.wgsl.expected.hlsl deleted file mode 100644 index 9ae472c74a..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/587ba3.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -Texture2D arg_1 : register(t1, space1); -SamplerState arg_2 : register(s2, space1); - -void textureGather_587ba3() { - int4 res = arg_1.GatherGreen(arg_2, (0.0f).xx); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureGather_587ba3(); - return (0.0f).xxxx; -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureGather_587ba3(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureGather_587ba3(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureGather/587ba3.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/587ba3.wgsl.expected.msl deleted file mode 100644 index a4a66f910d..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/587ba3.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureGather_587ba3(texture2d tint_symbol_1, sampler tint_symbol_2) { - int4 res = tint_symbol_1.gather(tint_symbol_2, float2(0.0f), int2(0), component::y); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d tint_symbol_3, sampler tint_symbol_4) { - textureGather_587ba3(tint_symbol_3, tint_symbol_4); - return float4(0.0f); -} - -vertex tint_symbol vertex_main(texture2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureGather_587ba3(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(texture2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureGather_587ba3(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/literal/textureGather/587ba3.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/587ba3.wgsl.expected.spvasm deleted file mode 100644 index 512819dbc2..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/587ba3.wgsl.expected.spvasm +++ /dev/null @@ -1,86 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 46 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_1 "arg_1" - OpName %arg_2 "arg_2" - OpName %textureGather_587ba3 "textureGather_587ba3" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - OpDecorate %arg_2 DescriptorSet 1 - OpDecorate %arg_2 Binding 2 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %int = OpTypeInt 32 1 - %11 = OpTypeImage %int 2D 0 0 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %15 = OpTypeSampler -%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 - %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant - %void = OpTypeVoid - %16 = OpTypeFunction %void - %v4int = OpTypeVector %int 4 - %24 = OpTypeSampledImage %11 - %v2float = OpTypeVector %float 2 - %27 = OpConstantNull %v2float - %int_1 = OpConstant %int 1 -%_ptr_Function_v4int = OpTypePointer Function %v4int - %31 = OpConstantNull %v4int - %32 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureGather_587ba3 = OpFunction %void None %16 - %19 = OpLabel - %res = OpVariable %_ptr_Function_v4int Function %31 - %22 = OpLoad %15 %arg_2 - %23 = OpLoad %11 %arg_1 - %25 = OpSampledImage %24 %23 %22 - %20 = OpImageGather %v4int %25 %27 %int_1 - OpStore %res %20 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %32 - %34 = OpLabel - %35 = OpFunctionCall %void %textureGather_587ba3 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %16 - %37 = OpLabel - %38 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %38 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %16 - %41 = OpLabel - %42 = OpFunctionCall %void %textureGather_587ba3 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %16 - %44 = OpLabel - %45 = OpFunctionCall %void %textureGather_587ba3 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureGather/587ba3.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/587ba3.wgsl.expected.wgsl deleted file mode 100644 index d906b0b34b..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/587ba3.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(1) var arg_1 : texture_2d; - -@group(1) @binding(2) var arg_2 : sampler; - -fn textureGather_587ba3() { - var res : vec4 = textureGather(1, arg_1, arg_2, vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_587ba3(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_587ba3(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_587ba3(); -} diff --git a/test/tint/builtins/gen/literal/textureGather/5ba85f.wgsl b/test/tint/builtins/gen/literal/textureGather/5ba85f.wgsl new file mode 100644 index 0000000000..8ee08a1d22 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/5ba85f.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_cube; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_cube, sampler: sampler, coords: vec3) -> vec4 +fn textureGather_5ba85f() { + var res: vec4 = textureGather(1, arg_1, arg_2, vec3()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_5ba85f(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_5ba85f(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_5ba85f(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/5ba85f.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/5ba85f.wgsl.expected.glsl new file mode 100644 index 0000000000..fcb3cf832b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/5ba85f.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp isamplerCube arg_1_arg_2; + +void textureGather_5ba85f() { + ivec4 res = textureGather(arg_1_arg_2, vec3(0.0f), 1); +} + +vec4 vertex_main() { + textureGather_5ba85f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp isamplerCube arg_1_arg_2; + +void textureGather_5ba85f() { + ivec4 res = textureGather(arg_1_arg_2, vec3(0.0f), 1); +} + +void fragment_main() { + textureGather_5ba85f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp isamplerCube arg_1_arg_2; + +void textureGather_5ba85f() { + ivec4 res = textureGather(arg_1_arg_2, vec3(0.0f), 1); +} + +void compute_main() { + textureGather_5ba85f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/5ba85f.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureGather/5ba85f.wgsl.expected.hlsl new file mode 100644 index 0000000000..4a550ea27a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/5ba85f.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +TextureCube arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_5ba85f() { + int4 res = arg_1.GatherGreen(arg_2, (0.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_5ba85f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_5ba85f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_5ba85f(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/5ba85f.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/5ba85f.wgsl.expected.msl new file mode 100644 index 0000000000..d0ae48190b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/5ba85f.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureGather_5ba85f(texturecube tint_symbol_1, sampler tint_symbol_2) { + int4 res = tint_symbol_1.gather(tint_symbol_2, float3(0.0f), component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube tint_symbol_3, sampler tint_symbol_4) { + textureGather_5ba85f(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_5ba85f(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texturecube tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_5ba85f(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureGather/5ba85f.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/5ba85f.wgsl.expected.spvasm new file mode 100644 index 0000000000..29ef2a4c28 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/5ba85f.wgsl.expected.spvasm @@ -0,0 +1,86 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 46 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_5ba85f "textureGather_5ba85f" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int Cube 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %15 = OpTypeSampler +%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 + %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant + %void = OpTypeVoid + %16 = OpTypeFunction %void + %v4int = OpTypeVector %int 4 + %24 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 + %27 = OpConstantNull %v3float + %int_1 = OpConstant %int 1 +%_ptr_Function_v4int = OpTypePointer Function %v4int + %31 = OpConstantNull %v4int + %32 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_5ba85f = OpFunction %void None %16 + %19 = OpLabel + %res = OpVariable %_ptr_Function_v4int Function %31 + %22 = OpLoad %15 %arg_2 + %23 = OpLoad %11 %arg_1 + %25 = OpSampledImage %24 %23 %22 + %20 = OpImageGather %v4int %25 %27 %int_1 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %32 + %34 = OpLabel + %35 = OpFunctionCall %void %textureGather_5ba85f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %16 + %37 = OpLabel + %38 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %38 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %16 + %41 = OpLabel + %42 = OpFunctionCall %void %textureGather_5ba85f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %16 + %44 = OpLabel + %45 = OpFunctionCall %void %textureGather_5ba85f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureGather/5ba85f.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/5ba85f.wgsl.expected.wgsl new file mode 100644 index 0000000000..02ad6aa667 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/5ba85f.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(1) var arg_1 : texture_cube; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_5ba85f() { + var res : vec4 = textureGather(1, arg_1, arg_2, vec3()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_5ba85f(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_5ba85f(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_5ba85f(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/5bd491.wgsl b/test/tint/builtins/gen/literal/textureGather/5bd491.wgsl new file mode 100644 index 0000000000..10038d6c4d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/5bd491.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_2d; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_2d, sampler: sampler, coords: vec2) -> vec4 +fn textureGather_5bd491() { + var res: vec4 = textureGather(1, arg_1, arg_2, vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_5bd491(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_5bd491(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_5bd491(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/5bd491.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/5bd491.wgsl.expected.glsl new file mode 100644 index 0000000000..d96776aaf6 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/5bd491.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp usampler2D arg_1_arg_2; + +void textureGather_5bd491() { + uvec4 res = textureGather(arg_1_arg_2, vec2(0.0f), 1); +} + +vec4 vertex_main() { + textureGather_5bd491(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp usampler2D arg_1_arg_2; + +void textureGather_5bd491() { + uvec4 res = textureGather(arg_1_arg_2, vec2(0.0f), 1); +} + +void fragment_main() { + textureGather_5bd491(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp usampler2D arg_1_arg_2; + +void textureGather_5bd491() { + uvec4 res = textureGather(arg_1_arg_2, vec2(0.0f), 1); +} + +void compute_main() { + textureGather_5bd491(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/5bd491.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureGather/5bd491.wgsl.expected.hlsl new file mode 100644 index 0000000000..6c830b8246 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/5bd491.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +Texture2D arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_5bd491() { + uint4 res = arg_1.GatherGreen(arg_2, (0.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_5bd491(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_5bd491(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_5bd491(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/5bd491.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/5bd491.wgsl.expected.msl new file mode 100644 index 0000000000..2b48ea550b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/5bd491.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureGather_5bd491(texture2d tint_symbol_1, sampler tint_symbol_2) { + uint4 res = tint_symbol_1.gather(tint_symbol_2, float2(0.0f), int2(0), component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_3, sampler tint_symbol_4) { + textureGather_5bd491(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_5bd491(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_5bd491(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureGather/5bd491.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/5bd491.wgsl.expected.spvasm new file mode 100644 index 0000000000..b22abf0ef8 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/5bd491.wgsl.expected.spvasm @@ -0,0 +1,87 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_5bd491 "textureGather_5bd491" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %15 = OpTypeSampler +%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 + %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant + %void = OpTypeVoid + %16 = OpTypeFunction %void + %v4uint = OpTypeVector %uint 4 + %24 = OpTypeSampledImage %11 + %v2float = OpTypeVector %float 2 + %27 = OpConstantNull %v2float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %32 = OpConstantNull %v4uint + %33 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_5bd491 = OpFunction %void None %16 + %19 = OpLabel + %res = OpVariable %_ptr_Function_v4uint Function %32 + %22 = OpLoad %15 %arg_2 + %23 = OpLoad %11 %arg_1 + %25 = OpSampledImage %24 %23 %22 + %20 = OpImageGather %v4uint %25 %27 %int_1 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %33 + %35 = OpLabel + %36 = OpFunctionCall %void %textureGather_5bd491 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %16 + %38 = OpLabel + %39 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %39 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %16 + %42 = OpLabel + %43 = OpFunctionCall %void %textureGather_5bd491 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %16 + %45 = OpLabel + %46 = OpFunctionCall %void %textureGather_5bd491 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureGather/5bd491.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/5bd491.wgsl.expected.wgsl new file mode 100644 index 0000000000..a9cc8846f1 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/5bd491.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(1) var arg_1 : texture_2d; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_5bd491() { + var res : vec4 = textureGather(1, arg_1, arg_2, vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_5bd491(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_5bd491(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_5bd491(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/69e0fb.wgsl b/test/tint/builtins/gen/literal/textureGather/69e0fb.wgsl deleted file mode 100644 index f2dc5cc58d..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/69e0fb.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/gen/gen.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(1) var arg_1: texture_2d; -@group(1) @binding(2) var arg_2: sampler; - -// fn textureGather(component: i32, texture: texture_2d, sampler: sampler, coords: vec2, offset: vec2) -> vec4 -fn textureGather_69e0fb() { - var res: vec4 = textureGather(1, arg_1, arg_2, vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_69e0fb(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_69e0fb(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_69e0fb(); -} diff --git a/test/tint/builtins/gen/literal/textureGather/69e0fb.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/69e0fb.wgsl.expected.glsl deleted file mode 100644 index 8a023845e0..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/69e0fb.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp isampler2D arg_1_arg_2; - -void textureGather_69e0fb() { - ivec4 res = textureGatherOffset(arg_1_arg_2, vec2(0.0f), ivec2(0), 1); -} - -vec4 vertex_main() { - textureGather_69e0fb(); - return vec4(0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp isampler2D arg_1_arg_2; - -void textureGather_69e0fb() { - ivec4 res = textureGatherOffset(arg_1_arg_2, vec2(0.0f), ivec2(0), 1); -} - -void fragment_main() { - textureGather_69e0fb(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp isampler2D arg_1_arg_2; - -void textureGather_69e0fb() { - ivec4 res = textureGatherOffset(arg_1_arg_2, vec2(0.0f), ivec2(0), 1); -} - -void compute_main() { - textureGather_69e0fb(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureGather/69e0fb.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureGather/69e0fb.wgsl.expected.hlsl deleted file mode 100644 index 251dd81919..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/69e0fb.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -Texture2D arg_1 : register(t1, space1); -SamplerState arg_2 : register(s2, space1); - -void textureGather_69e0fb() { - int4 res = arg_1.GatherGreen(arg_2, (0.0f).xx, (0).xx); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureGather_69e0fb(); - return (0.0f).xxxx; -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureGather_69e0fb(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureGather_69e0fb(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureGather/69e0fb.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/69e0fb.wgsl.expected.msl deleted file mode 100644 index 9e8ac80817..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/69e0fb.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureGather_69e0fb(texture2d tint_symbol_1, sampler tint_symbol_2) { - int4 res = tint_symbol_1.gather(tint_symbol_2, float2(0.0f), int2(0), component::y); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d tint_symbol_3, sampler tint_symbol_4) { - textureGather_69e0fb(tint_symbol_3, tint_symbol_4); - return float4(0.0f); -} - -vertex tint_symbol vertex_main(texture2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureGather_69e0fb(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(texture2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureGather_69e0fb(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/literal/textureGather/69e0fb.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/69e0fb.wgsl.expected.spvasm deleted file mode 100644 index 977638a52f..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/69e0fb.wgsl.expected.spvasm +++ /dev/null @@ -1,88 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 48 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_1 "arg_1" - OpName %arg_2 "arg_2" - OpName %textureGather_69e0fb "textureGather_69e0fb" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - OpDecorate %arg_2 DescriptorSet 1 - OpDecorate %arg_2 Binding 2 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %int = OpTypeInt 32 1 - %11 = OpTypeImage %int 2D 0 0 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %15 = OpTypeSampler -%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 - %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant - %void = OpTypeVoid - %16 = OpTypeFunction %void - %v4int = OpTypeVector %int 4 - %24 = OpTypeSampledImage %11 - %v2float = OpTypeVector %float 2 - %27 = OpConstantNull %v2float - %int_1 = OpConstant %int 1 - %v2int = OpTypeVector %int 2 - %30 = OpConstantNull %v2int -%_ptr_Function_v4int = OpTypePointer Function %v4int - %33 = OpConstantNull %v4int - %34 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureGather_69e0fb = OpFunction %void None %16 - %19 = OpLabel - %res = OpVariable %_ptr_Function_v4int Function %33 - %22 = OpLoad %15 %arg_2 - %23 = OpLoad %11 %arg_1 - %25 = OpSampledImage %24 %23 %22 - %20 = OpImageGather %v4int %25 %27 %int_1 ConstOffset %30 - OpStore %res %20 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %34 - %36 = OpLabel - %37 = OpFunctionCall %void %textureGather_69e0fb - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %16 - %39 = OpLabel - %40 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %40 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %16 - %43 = OpLabel - %44 = OpFunctionCall %void %textureGather_69e0fb - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %16 - %46 = OpLabel - %47 = OpFunctionCall %void %textureGather_69e0fb - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureGather/69e0fb.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/69e0fb.wgsl.expected.wgsl deleted file mode 100644 index a23c38fa43..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/69e0fb.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(1) var arg_1 : texture_2d; - -@group(1) @binding(2) var arg_2 : sampler; - -fn textureGather_69e0fb() { - var res : vec4 = textureGather(1, arg_1, arg_2, vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_69e0fb(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_69e0fb(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_69e0fb(); -} diff --git a/test/tint/builtins/gen/literal/textureGather/751f8a.wgsl b/test/tint/builtins/gen/literal/textureGather/751f8a.wgsl new file mode 100644 index 0000000000..5ebea8869a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/751f8a.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_cube_array; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_cube_array, sampler: sampler, coords: vec3, array_index: i32) -> vec4 +fn textureGather_751f8a() { + var res: vec4 = textureGather(1, arg_1, arg_2, vec3(), 1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_751f8a(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_751f8a(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_751f8a(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/751f8a.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/751f8a.wgsl.expected.glsl new file mode 100644 index 0000000000..032fe349e3 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/751f8a.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp samplerCubeArray arg_1_arg_2; + +void textureGather_751f8a() { + vec4 res = textureGather(arg_1_arg_2, vec4(0.0f, 0.0f, 0.0f, float(1)), 1); +} + +vec4 vertex_main() { + textureGather_751f8a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp samplerCubeArray arg_1_arg_2; + +void textureGather_751f8a() { + vec4 res = textureGather(arg_1_arg_2, vec4(0.0f, 0.0f, 0.0f, float(1)), 1); +} + +void fragment_main() { + textureGather_751f8a(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'samplerCubeArray' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp samplerCubeArray arg_1_arg_2; + +void textureGather_751f8a() { + vec4 res = textureGather(arg_1_arg_2, vec4(0.0f, 0.0f, 0.0f, float(1)), 1); +} + +void compute_main() { + textureGather_751f8a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureGather/751f8a.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureGather/751f8a.wgsl.expected.hlsl new file mode 100644 index 0000000000..3f07457516 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/751f8a.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +TextureCubeArray arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_751f8a() { + float4 res = arg_1.GatherGreen(arg_2, float4(0.0f, 0.0f, 0.0f, float(1))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_751f8a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_751f8a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_751f8a(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/751f8a.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/751f8a.wgsl.expected.msl new file mode 100644 index 0000000000..2fbbc1a5b1 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/751f8a.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureGather_751f8a(texturecube_array tint_symbol_1, sampler tint_symbol_2) { + float4 res = tint_symbol_1.gather(tint_symbol_2, float3(0.0f), 1, component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube_array tint_symbol_3, sampler tint_symbol_4) { + textureGather_751f8a(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_751f8a(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texturecube_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_751f8a(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureGather/751f8a.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/751f8a.wgsl.expected.spvasm new file mode 100644 index 0000000000..39748135db --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/751f8a.wgsl.expected.spvasm @@ -0,0 +1,86 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_751f8a "textureGather_751f8a" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_2 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %22 = OpTypeSampledImage %11 + %float_0 = OpConstant %float 0 + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %31 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_751f8a = OpFunction %void None %15 + %18 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %20 = OpLoad %14 %arg_2 + %21 = OpLoad %11 %arg_1 + %23 = OpSampledImage %22 %21 %20 + %25 = OpConvertSToF %float %int_1 + %28 = OpCompositeConstruct %v4float %float_0 %float_0 %float_0 %25 + %19 = OpImageGather %v4float %23 %28 %int_1 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %31 + %33 = OpLabel + %34 = OpFunctionCall %void %textureGather_751f8a + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %36 = OpLabel + %37 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %37 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %40 = OpLabel + %41 = OpFunctionCall %void %textureGather_751f8a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %43 = OpLabel + %44 = OpFunctionCall %void %textureGather_751f8a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureGather/751f8a.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/751f8a.wgsl.expected.wgsl new file mode 100644 index 0000000000..f59c76c6c6 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/751f8a.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(1) var arg_1 : texture_cube_array; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_751f8a() { + var res : vec4 = textureGather(1, arg_1, arg_2, vec3(), 1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_751f8a(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_751f8a(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_751f8a(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/7c3828.wgsl b/test/tint/builtins/gen/literal/textureGather/7c3828.wgsl new file mode 100644 index 0000000000..0eb843a4ac --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/7c3828.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_2d; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_2d, sampler: sampler, coords: vec2, @const offset: vec2) -> vec4 +fn textureGather_7c3828() { + var res: vec4 = textureGather(1, arg_1, arg_2, vec2(), vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_7c3828(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_7c3828(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_7c3828(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/7c3828.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/7c3828.wgsl.expected.glsl new file mode 100644 index 0000000000..6fcedbf362 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/7c3828.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp isampler2D arg_1_arg_2; + +void textureGather_7c3828() { + ivec4 res = textureGatherOffset(arg_1_arg_2, vec2(0.0f), ivec2(0), 1); +} + +vec4 vertex_main() { + textureGather_7c3828(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp isampler2D arg_1_arg_2; + +void textureGather_7c3828() { + ivec4 res = textureGatherOffset(arg_1_arg_2, vec2(0.0f), ivec2(0), 1); +} + +void fragment_main() { + textureGather_7c3828(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp isampler2D arg_1_arg_2; + +void textureGather_7c3828() { + ivec4 res = textureGatherOffset(arg_1_arg_2, vec2(0.0f), ivec2(0), 1); +} + +void compute_main() { + textureGather_7c3828(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/7c3828.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureGather/7c3828.wgsl.expected.hlsl new file mode 100644 index 0000000000..5efb022606 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/7c3828.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +Texture2D arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_7c3828() { + int4 res = arg_1.GatherGreen(arg_2, (0.0f).xx, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_7c3828(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_7c3828(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_7c3828(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/7c3828.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/7c3828.wgsl.expected.msl new file mode 100644 index 0000000000..a8134ee6fc --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/7c3828.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureGather_7c3828(texture2d tint_symbol_1, sampler tint_symbol_2) { + int4 res = tint_symbol_1.gather(tint_symbol_2, float2(0.0f), int2(0), component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_3, sampler tint_symbol_4) { + textureGather_7c3828(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_7c3828(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_7c3828(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureGather/7c3828.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/7c3828.wgsl.expected.spvasm new file mode 100644 index 0000000000..1e1f646e94 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/7c3828.wgsl.expected.spvasm @@ -0,0 +1,88 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 48 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_7c3828 "textureGather_7c3828" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %15 = OpTypeSampler +%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 + %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant + %void = OpTypeVoid + %16 = OpTypeFunction %void + %v4int = OpTypeVector %int 4 + %24 = OpTypeSampledImage %11 + %v2float = OpTypeVector %float 2 + %27 = OpConstantNull %v2float + %int_1 = OpConstant %int 1 + %v2int = OpTypeVector %int 2 + %30 = OpConstantNull %v2int +%_ptr_Function_v4int = OpTypePointer Function %v4int + %33 = OpConstantNull %v4int + %34 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_7c3828 = OpFunction %void None %16 + %19 = OpLabel + %res = OpVariable %_ptr_Function_v4int Function %33 + %22 = OpLoad %15 %arg_2 + %23 = OpLoad %11 %arg_1 + %25 = OpSampledImage %24 %23 %22 + %20 = OpImageGather %v4int %25 %27 %int_1 ConstOffset %30 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %34 + %36 = OpLabel + %37 = OpFunctionCall %void %textureGather_7c3828 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %16 + %39 = OpLabel + %40 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %40 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %16 + %43 = OpLabel + %44 = OpFunctionCall %void %textureGather_7c3828 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %16 + %46 = OpLabel + %47 = OpFunctionCall %void %textureGather_7c3828 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureGather/7c3828.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/7c3828.wgsl.expected.wgsl new file mode 100644 index 0000000000..14e3334ff8 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/7c3828.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(1) var arg_1 : texture_2d; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_7c3828() { + var res : vec4 = textureGather(1, arg_1, arg_2, vec2(), vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_7c3828(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_7c3828(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_7c3828(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/8b754c.wgsl b/test/tint/builtins/gen/literal/textureGather/8b754c.wgsl new file mode 100644 index 0000000000..6a6f2d67a3 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/8b754c.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_2d_array; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32) -> vec4 +fn textureGather_8b754c() { + var res: vec4 = textureGather(1, arg_1, arg_2, vec2(), 1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_8b754c(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_8b754c(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_8b754c(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/8b754c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/8b754c.wgsl.expected.glsl new file mode 100644 index 0000000000..deec62c53b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/8b754c.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp isampler2DArray arg_1_arg_2; + +void textureGather_8b754c() { + ivec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), 1); +} + +vec4 vertex_main() { + textureGather_8b754c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp isampler2DArray arg_1_arg_2; + +void textureGather_8b754c() { + ivec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), 1); +} + +void fragment_main() { + textureGather_8b754c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp isampler2DArray arg_1_arg_2; + +void textureGather_8b754c() { + ivec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), 1); +} + +void compute_main() { + textureGather_8b754c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/8b754c.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureGather/8b754c.wgsl.expected.hlsl new file mode 100644 index 0000000000..f8ffc7c726 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/8b754c.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +Texture2DArray arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_8b754c() { + int4 res = arg_1.GatherGreen(arg_2, float3(0.0f, 0.0f, float(1))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_8b754c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_8b754c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_8b754c(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/8b754c.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/8b754c.wgsl.expected.msl new file mode 100644 index 0000000000..2bd2f19a7c --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/8b754c.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureGather_8b754c(texture2d_array tint_symbol_1, sampler tint_symbol_2) { + int4 res = tint_symbol_1.gather(tint_symbol_2, float2(0.0f), 1, int2(0), component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_3, sampler tint_symbol_4) { + textureGather_8b754c(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_8b754c(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_8b754c(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureGather/8b754c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/8b754c.wgsl.expected.spvasm new file mode 100644 index 0000000000..97669769ec --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/8b754c.wgsl.expected.spvasm @@ -0,0 +1,88 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 48 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_8b754c "textureGather_8b754c" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %15 = OpTypeSampler +%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 + %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant + %void = OpTypeVoid + %16 = OpTypeFunction %void + %v4int = OpTypeVector %int 4 + %24 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 + %float_0 = OpConstant %float 0 + %int_1 = OpConstant %int 1 +%_ptr_Function_v4int = OpTypePointer Function %v4int + %33 = OpConstantNull %v4int + %34 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_8b754c = OpFunction %void None %16 + %19 = OpLabel + %res = OpVariable %_ptr_Function_v4int Function %33 + %22 = OpLoad %15 %arg_2 + %23 = OpLoad %11 %arg_1 + %25 = OpSampledImage %24 %23 %22 + %28 = OpConvertSToF %float %int_1 + %30 = OpCompositeConstruct %v3float %float_0 %float_0 %28 + %20 = OpImageGather %v4int %25 %30 %int_1 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %34 + %36 = OpLabel + %37 = OpFunctionCall %void %textureGather_8b754c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %16 + %39 = OpLabel + %40 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %40 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %16 + %43 = OpLabel + %44 = OpFunctionCall %void %textureGather_8b754c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %16 + %46 = OpLabel + %47 = OpFunctionCall %void %textureGather_8b754c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureGather/8b754c.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/8b754c.wgsl.expected.wgsl new file mode 100644 index 0000000000..4b10cfbb2e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/8b754c.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(1) var arg_1 : texture_2d_array; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_8b754c() { + var res : vec4 = textureGather(1, arg_1, arg_2, vec2(), 1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_8b754c(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_8b754c(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_8b754c(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/93003d.wgsl b/test/tint/builtins/gen/literal/textureGather/93003d.wgsl deleted file mode 100644 index 54eba98205..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/93003d.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/gen/gen.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(1) var arg_1: texture_2d; -@group(1) @binding(2) var arg_2: sampler; - -// fn textureGather(component: i32, texture: texture_2d, sampler: sampler, coords: vec2, offset: vec2) -> vec4 -fn textureGather_93003d() { - var res: vec4 = textureGather(1, arg_1, arg_2, vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_93003d(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_93003d(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_93003d(); -} diff --git a/test/tint/builtins/gen/literal/textureGather/93003d.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/93003d.wgsl.expected.glsl deleted file mode 100644 index 755df46026..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/93003d.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp usampler2D arg_1_arg_2; - -void textureGather_93003d() { - uvec4 res = textureGatherOffset(arg_1_arg_2, vec2(0.0f), ivec2(0), 1); -} - -vec4 vertex_main() { - textureGather_93003d(); - return vec4(0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp usampler2D arg_1_arg_2; - -void textureGather_93003d() { - uvec4 res = textureGatherOffset(arg_1_arg_2, vec2(0.0f), ivec2(0), 1); -} - -void fragment_main() { - textureGather_93003d(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp usampler2D arg_1_arg_2; - -void textureGather_93003d() { - uvec4 res = textureGatherOffset(arg_1_arg_2, vec2(0.0f), ivec2(0), 1); -} - -void compute_main() { - textureGather_93003d(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureGather/93003d.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureGather/93003d.wgsl.expected.hlsl deleted file mode 100644 index 008e995fbb..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/93003d.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -Texture2D arg_1 : register(t1, space1); -SamplerState arg_2 : register(s2, space1); - -void textureGather_93003d() { - uint4 res = arg_1.GatherGreen(arg_2, (0.0f).xx, (0).xx); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureGather_93003d(); - return (0.0f).xxxx; -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureGather_93003d(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureGather_93003d(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureGather/93003d.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/93003d.wgsl.expected.msl deleted file mode 100644 index 2f83621424..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/93003d.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureGather_93003d(texture2d tint_symbol_1, sampler tint_symbol_2) { - uint4 res = tint_symbol_1.gather(tint_symbol_2, float2(0.0f), int2(0), component::y); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d tint_symbol_3, sampler tint_symbol_4) { - textureGather_93003d(tint_symbol_3, tint_symbol_4); - return float4(0.0f); -} - -vertex tint_symbol vertex_main(texture2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureGather_93003d(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(texture2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureGather_93003d(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/literal/textureGather/93003d.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/93003d.wgsl.expected.spvasm deleted file mode 100644 index e31ea804ce..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/93003d.wgsl.expected.spvasm +++ /dev/null @@ -1,89 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 49 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_1 "arg_1" - OpName %arg_2 "arg_2" - OpName %textureGather_93003d "textureGather_93003d" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - OpDecorate %arg_2 DescriptorSet 1 - OpDecorate %arg_2 Binding 2 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %uint = OpTypeInt 32 0 - %11 = OpTypeImage %uint 2D 0 0 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %15 = OpTypeSampler -%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 - %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant - %void = OpTypeVoid - %16 = OpTypeFunction %void - %v4uint = OpTypeVector %uint 4 - %24 = OpTypeSampledImage %11 - %v2float = OpTypeVector %float 2 - %27 = OpConstantNull %v2float - %int = OpTypeInt 32 1 - %int_1 = OpConstant %int 1 - %v2int = OpTypeVector %int 2 - %31 = OpConstantNull %v2int -%_ptr_Function_v4uint = OpTypePointer Function %v4uint - %34 = OpConstantNull %v4uint - %35 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureGather_93003d = OpFunction %void None %16 - %19 = OpLabel - %res = OpVariable %_ptr_Function_v4uint Function %34 - %22 = OpLoad %15 %arg_2 - %23 = OpLoad %11 %arg_1 - %25 = OpSampledImage %24 %23 %22 - %20 = OpImageGather %v4uint %25 %27 %int_1 ConstOffset %31 - OpStore %res %20 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %35 - %37 = OpLabel - %38 = OpFunctionCall %void %textureGather_93003d - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %16 - %40 = OpLabel - %41 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %41 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %16 - %44 = OpLabel - %45 = OpFunctionCall %void %textureGather_93003d - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %16 - %47 = OpLabel - %48 = OpFunctionCall %void %textureGather_93003d - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureGather/93003d.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/93003d.wgsl.expected.wgsl deleted file mode 100644 index c4adea5eea..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/93003d.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(1) var arg_1 : texture_2d; - -@group(1) @binding(2) var arg_2 : sampler; - -fn textureGather_93003d() { - var res : vec4 = textureGather(1, arg_1, arg_2, vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_93003d(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_93003d(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_93003d(); -} diff --git a/test/tint/builtins/gen/literal/textureGather/9efca2.wgsl b/test/tint/builtins/gen/literal/textureGather/9efca2.wgsl deleted file mode 100644 index 3099ce7b48..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/9efca2.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/gen/gen.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(1) var arg_1: texture_2d_array; -@group(1) @binding(2) var arg_2: sampler; - -// fn textureGather(component: i32, texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32) -> vec4 -fn textureGather_9efca2() { - var res: vec4 = textureGather(1, arg_1, arg_2, vec2(), 1); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_9efca2(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_9efca2(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_9efca2(); -} diff --git a/test/tint/builtins/gen/literal/textureGather/9efca2.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/9efca2.wgsl.expected.glsl deleted file mode 100644 index 4adc8849fe..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/9efca2.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp sampler2DArray arg_1_arg_2; - -void textureGather_9efca2() { - vec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), 1); -} - -vec4 vertex_main() { - textureGather_9efca2(); - return vec4(0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp sampler2DArray arg_1_arg_2; - -void textureGather_9efca2() { - vec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), 1); -} - -void fragment_main() { - textureGather_9efca2(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp sampler2DArray arg_1_arg_2; - -void textureGather_9efca2() { - vec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), 1); -} - -void compute_main() { - textureGather_9efca2(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureGather/9efca2.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureGather/9efca2.wgsl.expected.hlsl deleted file mode 100644 index 6debc9b356..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/9efca2.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -Texture2DArray arg_1 : register(t1, space1); -SamplerState arg_2 : register(s2, space1); - -void textureGather_9efca2() { - float4 res = arg_1.GatherGreen(arg_2, float3(0.0f, 0.0f, float(1))); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureGather_9efca2(); - return (0.0f).xxxx; -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureGather_9efca2(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureGather_9efca2(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureGather/9efca2.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/9efca2.wgsl.expected.msl deleted file mode 100644 index a3cde10552..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/9efca2.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureGather_9efca2(texture2d_array tint_symbol_1, sampler tint_symbol_2) { - float4 res = tint_symbol_1.gather(tint_symbol_2, float2(0.0f), 1, int2(0), component::y); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_3, sampler tint_symbol_4) { - textureGather_9efca2(tint_symbol_3, tint_symbol_4); - return float4(0.0f); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureGather_9efca2(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureGather_9efca2(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/literal/textureGather/9efca2.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/9efca2.wgsl.expected.spvasm deleted file mode 100644 index 55026388d7..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/9efca2.wgsl.expected.spvasm +++ /dev/null @@ -1,86 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 46 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_1 "arg_1" - OpName %arg_2 "arg_2" - OpName %textureGather_9efca2 "textureGather_9efca2" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - OpDecorate %arg_2 DescriptorSet 1 - OpDecorate %arg_2 Binding 2 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %11 = OpTypeImage %float 2D 0 1 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %14 = OpTypeSampler -%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 - %arg_2 = OpVariable %_ptr_UniformConstant_14 UniformConstant - %void = OpTypeVoid - %15 = OpTypeFunction %void - %22 = OpTypeSampledImage %11 - %v3float = OpTypeVector %float 3 - %float_0 = OpConstant %float 0 - %int = OpTypeInt 32 1 - %int_1 = OpConstant %int 1 -%_ptr_Function_v4float = OpTypePointer Function %v4float - %32 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureGather_9efca2 = OpFunction %void None %15 - %18 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %20 = OpLoad %14 %arg_2 - %21 = OpLoad %11 %arg_1 - %23 = OpSampledImage %22 %21 %20 - %26 = OpConvertSToF %float %int_1 - %29 = OpCompositeConstruct %v3float %float_0 %float_0 %26 - %19 = OpImageGather %v4float %23 %29 %int_1 - OpStore %res %19 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %32 - %34 = OpLabel - %35 = OpFunctionCall %void %textureGather_9efca2 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %15 - %37 = OpLabel - %38 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %38 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %15 - %41 = OpLabel - %42 = OpFunctionCall %void %textureGather_9efca2 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %15 - %44 = OpLabel - %45 = OpFunctionCall %void %textureGather_9efca2 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureGather/9efca2.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/9efca2.wgsl.expected.wgsl deleted file mode 100644 index c9774286eb..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/9efca2.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(1) var arg_1 : texture_2d_array; - -@group(1) @binding(2) var arg_2 : sampler; - -fn textureGather_9efca2() { - var res : vec4 = textureGather(1, arg_1, arg_2, vec2(), 1); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_9efca2(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_9efca2(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_9efca2(); -} diff --git a/test/tint/builtins/gen/literal/textureGather/af55b3.wgsl b/test/tint/builtins/gen/literal/textureGather/af55b3.wgsl new file mode 100644 index 0000000000..6d8f00725e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/af55b3.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_2d; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_2d, sampler: sampler, coords: vec2, @const offset: vec2) -> vec4 +fn textureGather_af55b3() { + var res: vec4 = textureGather(1, arg_1, arg_2, vec2(), vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_af55b3(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_af55b3(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_af55b3(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/af55b3.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/af55b3.wgsl.expected.glsl new file mode 100644 index 0000000000..b9e44ef1ad --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/af55b3.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp sampler2D arg_1_arg_2; + +void textureGather_af55b3() { + vec4 res = textureGatherOffset(arg_1_arg_2, vec2(0.0f), ivec2(0), 1); +} + +vec4 vertex_main() { + textureGather_af55b3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2D arg_1_arg_2; + +void textureGather_af55b3() { + vec4 res = textureGatherOffset(arg_1_arg_2, vec2(0.0f), ivec2(0), 1); +} + +void fragment_main() { + textureGather_af55b3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2D arg_1_arg_2; + +void textureGather_af55b3() { + vec4 res = textureGatherOffset(arg_1_arg_2, vec2(0.0f), ivec2(0), 1); +} + +void compute_main() { + textureGather_af55b3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/af55b3.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureGather/af55b3.wgsl.expected.hlsl new file mode 100644 index 0000000000..11eeb8b23f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/af55b3.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +Texture2D arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_af55b3() { + float4 res = arg_1.GatherGreen(arg_2, (0.0f).xx, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_af55b3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_af55b3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_af55b3(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/af55b3.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/af55b3.wgsl.expected.msl new file mode 100644 index 0000000000..292679bd37 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/af55b3.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureGather_af55b3(texture2d tint_symbol_1, sampler tint_symbol_2) { + float4 res = tint_symbol_1.gather(tint_symbol_2, float2(0.0f), int2(0), component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_3, sampler tint_symbol_4) { + textureGather_af55b3(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_af55b3(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_af55b3(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureGather/af55b3.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/af55b3.wgsl.expected.spvasm new file mode 100644 index 0000000000..ec4850a13e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/af55b3.wgsl.expected.spvasm @@ -0,0 +1,86 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 46 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_af55b3 "textureGather_af55b3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_2 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %22 = OpTypeSampledImage %11 + %v2float = OpTypeVector %float 2 + %25 = OpConstantNull %v2float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %v2int = OpTypeVector %int 2 + %29 = OpConstantNull %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %32 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_af55b3 = OpFunction %void None %15 + %18 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %20 = OpLoad %14 %arg_2 + %21 = OpLoad %11 %arg_1 + %23 = OpSampledImage %22 %21 %20 + %19 = OpImageGather %v4float %23 %25 %int_1 ConstOffset %29 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %32 + %34 = OpLabel + %35 = OpFunctionCall %void %textureGather_af55b3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %37 = OpLabel + %38 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %38 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %41 = OpLabel + %42 = OpFunctionCall %void %textureGather_af55b3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %44 = OpLabel + %45 = OpFunctionCall %void %textureGather_af55b3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureGather/af55b3.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/af55b3.wgsl.expected.wgsl new file mode 100644 index 0000000000..fb4d43f084 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/af55b3.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(1) var arg_1 : texture_2d; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_af55b3() { + var res : vec4 = textureGather(1, arg_1, arg_2, vec2(), vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_af55b3(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_af55b3(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_af55b3(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/bb3ac5.wgsl b/test/tint/builtins/gen/literal/textureGather/bb3ac5.wgsl new file mode 100644 index 0000000000..0217549cb8 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/bb3ac5.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_2d; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_2d, sampler: sampler, coords: vec2) -> vec4 +fn textureGather_bb3ac5() { + var res: vec4 = textureGather(1, arg_1, arg_2, vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_bb3ac5(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_bb3ac5(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_bb3ac5(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/bb3ac5.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/bb3ac5.wgsl.expected.glsl new file mode 100644 index 0000000000..a1b2221f64 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/bb3ac5.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp isampler2D arg_1_arg_2; + +void textureGather_bb3ac5() { + ivec4 res = textureGather(arg_1_arg_2, vec2(0.0f), 1); +} + +vec4 vertex_main() { + textureGather_bb3ac5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp isampler2D arg_1_arg_2; + +void textureGather_bb3ac5() { + ivec4 res = textureGather(arg_1_arg_2, vec2(0.0f), 1); +} + +void fragment_main() { + textureGather_bb3ac5(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp isampler2D arg_1_arg_2; + +void textureGather_bb3ac5() { + ivec4 res = textureGather(arg_1_arg_2, vec2(0.0f), 1); +} + +void compute_main() { + textureGather_bb3ac5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/bb3ac5.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureGather/bb3ac5.wgsl.expected.hlsl new file mode 100644 index 0000000000..e893100e0a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/bb3ac5.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +Texture2D arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_bb3ac5() { + int4 res = arg_1.GatherGreen(arg_2, (0.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_bb3ac5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_bb3ac5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_bb3ac5(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/bb3ac5.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/bb3ac5.wgsl.expected.msl new file mode 100644 index 0000000000..9be015a16f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/bb3ac5.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureGather_bb3ac5(texture2d tint_symbol_1, sampler tint_symbol_2) { + int4 res = tint_symbol_1.gather(tint_symbol_2, float2(0.0f), int2(0), component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_3, sampler tint_symbol_4) { + textureGather_bb3ac5(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_bb3ac5(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_bb3ac5(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureGather/bb3ac5.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/bb3ac5.wgsl.expected.spvasm new file mode 100644 index 0000000000..4d5ffe4dbf --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/bb3ac5.wgsl.expected.spvasm @@ -0,0 +1,86 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 46 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_bb3ac5 "textureGather_bb3ac5" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %15 = OpTypeSampler +%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 + %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant + %void = OpTypeVoid + %16 = OpTypeFunction %void + %v4int = OpTypeVector %int 4 + %24 = OpTypeSampledImage %11 + %v2float = OpTypeVector %float 2 + %27 = OpConstantNull %v2float + %int_1 = OpConstant %int 1 +%_ptr_Function_v4int = OpTypePointer Function %v4int + %31 = OpConstantNull %v4int + %32 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_bb3ac5 = OpFunction %void None %16 + %19 = OpLabel + %res = OpVariable %_ptr_Function_v4int Function %31 + %22 = OpLoad %15 %arg_2 + %23 = OpLoad %11 %arg_1 + %25 = OpSampledImage %24 %23 %22 + %20 = OpImageGather %v4int %25 %27 %int_1 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %32 + %34 = OpLabel + %35 = OpFunctionCall %void %textureGather_bb3ac5 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %16 + %37 = OpLabel + %38 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %38 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %16 + %41 = OpLabel + %42 = OpFunctionCall %void %textureGather_bb3ac5 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %16 + %44 = OpLabel + %45 = OpFunctionCall %void %textureGather_bb3ac5 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureGather/bb3ac5.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/bb3ac5.wgsl.expected.wgsl new file mode 100644 index 0000000000..b7b8732809 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/bb3ac5.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(1) var arg_1 : texture_2d; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_bb3ac5() { + var res : vec4 = textureGather(1, arg_1, arg_2, vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_bb3ac5(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_bb3ac5(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_bb3ac5(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/bd0b1e.wgsl b/test/tint/builtins/gen/literal/textureGather/bd0b1e.wgsl deleted file mode 100644 index 2dc3001202..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/bd0b1e.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/gen/gen.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(1) var arg_1: texture_2d; -@group(1) @binding(2) var arg_2: sampler; - -// fn textureGather(component: i32, texture: texture_2d, sampler: sampler, coords: vec2) -> vec4 -fn textureGather_bd0b1e() { - var res: vec4 = textureGather(1, arg_1, arg_2, vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_bd0b1e(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_bd0b1e(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_bd0b1e(); -} diff --git a/test/tint/builtins/gen/literal/textureGather/bd0b1e.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/bd0b1e.wgsl.expected.glsl deleted file mode 100644 index a98b6204ff..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/bd0b1e.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp sampler2D arg_1_arg_2; - -void textureGather_bd0b1e() { - vec4 res = textureGather(arg_1_arg_2, vec2(0.0f), 1); -} - -vec4 vertex_main() { - textureGather_bd0b1e(); - return vec4(0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp sampler2D arg_1_arg_2; - -void textureGather_bd0b1e() { - vec4 res = textureGather(arg_1_arg_2, vec2(0.0f), 1); -} - -void fragment_main() { - textureGather_bd0b1e(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp sampler2D arg_1_arg_2; - -void textureGather_bd0b1e() { - vec4 res = textureGather(arg_1_arg_2, vec2(0.0f), 1); -} - -void compute_main() { - textureGather_bd0b1e(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureGather/bd0b1e.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureGather/bd0b1e.wgsl.expected.hlsl deleted file mode 100644 index 5d515eca75..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/bd0b1e.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -Texture2D arg_1 : register(t1, space1); -SamplerState arg_2 : register(s2, space1); - -void textureGather_bd0b1e() { - float4 res = arg_1.GatherGreen(arg_2, (0.0f).xx); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureGather_bd0b1e(); - return (0.0f).xxxx; -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureGather_bd0b1e(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureGather_bd0b1e(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureGather/bd0b1e.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/bd0b1e.wgsl.expected.msl deleted file mode 100644 index 7f576edb1c..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/bd0b1e.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureGather_bd0b1e(texture2d tint_symbol_1, sampler tint_symbol_2) { - float4 res = tint_symbol_1.gather(tint_symbol_2, float2(0.0f), int2(0), component::y); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d tint_symbol_3, sampler tint_symbol_4) { - textureGather_bd0b1e(tint_symbol_3, tint_symbol_4); - return float4(0.0f); -} - -vertex tint_symbol vertex_main(texture2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureGather_bd0b1e(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(texture2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureGather_bd0b1e(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/literal/textureGather/bd0b1e.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/bd0b1e.wgsl.expected.spvasm deleted file mode 100644 index aeeccf160f..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/bd0b1e.wgsl.expected.spvasm +++ /dev/null @@ -1,84 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 44 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_1 "arg_1" - OpName %arg_2 "arg_2" - OpName %textureGather_bd0b1e "textureGather_bd0b1e" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - OpDecorate %arg_2 DescriptorSet 1 - OpDecorate %arg_2 Binding 2 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %11 = OpTypeImage %float 2D 0 0 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %14 = OpTypeSampler -%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 - %arg_2 = OpVariable %_ptr_UniformConstant_14 UniformConstant - %void = OpTypeVoid - %15 = OpTypeFunction %void - %22 = OpTypeSampledImage %11 - %v2float = OpTypeVector %float 2 - %25 = OpConstantNull %v2float - %int = OpTypeInt 32 1 - %int_1 = OpConstant %int 1 -%_ptr_Function_v4float = OpTypePointer Function %v4float - %30 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureGather_bd0b1e = OpFunction %void None %15 - %18 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %20 = OpLoad %14 %arg_2 - %21 = OpLoad %11 %arg_1 - %23 = OpSampledImage %22 %21 %20 - %19 = OpImageGather %v4float %23 %25 %int_1 - OpStore %res %19 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %30 - %32 = OpLabel - %33 = OpFunctionCall %void %textureGather_bd0b1e - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %15 - %35 = OpLabel - %36 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %36 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %15 - %39 = OpLabel - %40 = OpFunctionCall %void %textureGather_bd0b1e - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %15 - %42 = OpLabel - %43 = OpFunctionCall %void %textureGather_bd0b1e - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureGather/bd0b1e.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/bd0b1e.wgsl.expected.wgsl deleted file mode 100644 index c4f05ce89f..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/bd0b1e.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(1) var arg_1 : texture_2d; - -@group(1) @binding(2) var arg_2 : sampler; - -fn textureGather_bd0b1e() { - var res : vec4 = textureGather(1, arg_1, arg_2, vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_bd0b1e(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_bd0b1e(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_bd0b1e(); -} diff --git a/test/tint/builtins/gen/literal/textureGather/c0640c.wgsl b/test/tint/builtins/gen/literal/textureGather/c0640c.wgsl new file mode 100644 index 0000000000..6908c00836 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/c0640c.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_cube_array; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_cube_array, sampler: sampler, coords: vec3, array_index: i32) -> vec4 +fn textureGather_c0640c() { + var res: vec4 = textureGather(1, arg_1, arg_2, vec3(), 1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_c0640c(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_c0640c(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_c0640c(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/c0640c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/c0640c.wgsl.expected.glsl new file mode 100644 index 0000000000..b4697afe2d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/c0640c.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp isamplerCubeArray arg_1_arg_2; + +void textureGather_c0640c() { + ivec4 res = textureGather(arg_1_arg_2, vec4(0.0f, 0.0f, 0.0f, float(1)), 1); +} + +vec4 vertex_main() { + textureGather_c0640c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'isamplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp isamplerCubeArray arg_1_arg_2; + +void textureGather_c0640c() { + ivec4 res = textureGather(arg_1_arg_2, vec4(0.0f, 0.0f, 0.0f, float(1)), 1); +} + +void fragment_main() { + textureGather_c0640c(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'isamplerCubeArray' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp isamplerCubeArray arg_1_arg_2; + +void textureGather_c0640c() { + ivec4 res = textureGather(arg_1_arg_2, vec4(0.0f, 0.0f, 0.0f, float(1)), 1); +} + +void compute_main() { + textureGather_c0640c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'isamplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureGather/c0640c.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureGather/c0640c.wgsl.expected.hlsl new file mode 100644 index 0000000000..d86b7f2a2e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/c0640c.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +TextureCubeArray arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_c0640c() { + int4 res = arg_1.GatherGreen(arg_2, float4(0.0f, 0.0f, 0.0f, float(1))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_c0640c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_c0640c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_c0640c(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/c0640c.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/c0640c.wgsl.expected.msl new file mode 100644 index 0000000000..2af36677fe --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/c0640c.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureGather_c0640c(texturecube_array tint_symbol_1, sampler tint_symbol_2) { + int4 res = tint_symbol_1.gather(tint_symbol_2, float3(0.0f), 1, component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube_array tint_symbol_3, sampler tint_symbol_4) { + textureGather_c0640c(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_c0640c(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texturecube_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_c0640c(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureGather/c0640c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/c0640c.wgsl.expected.spvasm new file mode 100644 index 0000000000..0f1c64918f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/c0640c.wgsl.expected.spvasm @@ -0,0 +1,88 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_c0640c "textureGather_c0640c" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %15 = OpTypeSampler +%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 + %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant + %void = OpTypeVoid + %16 = OpTypeFunction %void + %v4int = OpTypeVector %int 4 + %24 = OpTypeSampledImage %11 + %float_0 = OpConstant %float 0 + %int_1 = OpConstant %int 1 +%_ptr_Function_v4int = OpTypePointer Function %v4int + %32 = OpConstantNull %v4int + %33 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_c0640c = OpFunction %void None %16 + %19 = OpLabel + %res = OpVariable %_ptr_Function_v4int Function %32 + %22 = OpLoad %15 %arg_2 + %23 = OpLoad %11 %arg_1 + %25 = OpSampledImage %24 %23 %22 + %27 = OpConvertSToF %float %int_1 + %29 = OpCompositeConstruct %v4float %float_0 %float_0 %float_0 %27 + %20 = OpImageGather %v4int %25 %29 %int_1 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %33 + %35 = OpLabel + %36 = OpFunctionCall %void %textureGather_c0640c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %16 + %38 = OpLabel + %39 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %39 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %16 + %42 = OpLabel + %43 = OpFunctionCall %void %textureGather_c0640c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %16 + %45 = OpLabel + %46 = OpFunctionCall %void %textureGather_c0640c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureGather/c0640c.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/c0640c.wgsl.expected.wgsl new file mode 100644 index 0000000000..7ec8f4ec14 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/c0640c.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(1) var arg_1 : texture_cube_array; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_c0640c() { + var res : vec4 = textureGather(1, arg_1, arg_2, vec3(), 1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_c0640c(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_c0640c(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_c0640c(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/c409ae.wgsl b/test/tint/builtins/gen/literal/textureGather/c409ae.wgsl deleted file mode 100644 index f9932477bf..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/c409ae.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/gen/gen.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_depth_2d; -@group(1) @binding(1) var arg_1: sampler; - -// fn textureGather(texture: texture_depth_2d, sampler: sampler, coords: vec2, offset: vec2) -> vec4 -fn textureGather_c409ae() { - var res: vec4 = textureGather(arg_0, arg_1, vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_c409ae(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_c409ae(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_c409ae(); -} diff --git a/test/tint/builtins/gen/literal/textureGather/c409ae.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/c409ae.wgsl.expected.glsl deleted file mode 100644 index 90da7abd60..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/c409ae.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp sampler2DShadow arg_0_arg_1; - -void textureGather_c409ae() { - vec4 res = textureGatherOffset(arg_0_arg_1, vec2(0.0f), 0.0, ivec2(0)); -} - -vec4 vertex_main() { - textureGather_c409ae(); - return vec4(0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp sampler2DShadow arg_0_arg_1; - -void textureGather_c409ae() { - vec4 res = textureGatherOffset(arg_0_arg_1, vec2(0.0f), 0.0, ivec2(0)); -} - -void fragment_main() { - textureGather_c409ae(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp sampler2DShadow arg_0_arg_1; - -void textureGather_c409ae() { - vec4 res = textureGatherOffset(arg_0_arg_1, vec2(0.0f), 0.0, ivec2(0)); -} - -void compute_main() { - textureGather_c409ae(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureGather/c409ae.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureGather/c409ae.wgsl.expected.hlsl deleted file mode 100644 index c5f59de818..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/c409ae.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -Texture2D arg_0 : register(t0, space1); -SamplerState arg_1 : register(s1, space1); - -void textureGather_c409ae() { - float4 res = arg_0.Gather(arg_1, (0.0f).xx, (0).xx); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureGather_c409ae(); - return (0.0f).xxxx; -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureGather_c409ae(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureGather_c409ae(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureGather/c409ae.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/c409ae.wgsl.expected.msl deleted file mode 100644 index d5c9793525..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/c409ae.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureGather_c409ae(depth2d tint_symbol_1, sampler tint_symbol_2) { - float4 res = tint_symbol_1.gather(tint_symbol_2, float2(0.0f), int2(0)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(depth2d tint_symbol_3, sampler tint_symbol_4) { - textureGather_c409ae(tint_symbol_3, tint_symbol_4); - return float4(0.0f); -} - -vertex tint_symbol vertex_main(depth2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(depth2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureGather_c409ae(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(depth2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureGather_c409ae(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/literal/textureGather/c409ae.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/c409ae.wgsl.expected.spvasm deleted file mode 100644 index d5f4ba6770..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/c409ae.wgsl.expected.spvasm +++ /dev/null @@ -1,86 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 46 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_0 "arg_0" - OpName %arg_1 "arg_1" - OpName %textureGather_c409ae "textureGather_c409ae" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %11 = OpTypeImage %float 2D 0 0 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %14 = OpTypeSampler -%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 - %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant - %void = OpTypeVoid - %15 = OpTypeFunction %void - %22 = OpTypeSampledImage %11 - %v2float = OpTypeVector %float 2 - %25 = OpConstantNull %v2float - %int = OpTypeInt 32 1 - %int_0 = OpConstant %int 0 - %v2int = OpTypeVector %int 2 - %29 = OpConstantNull %v2int -%_ptr_Function_v4float = OpTypePointer Function %v4float - %32 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureGather_c409ae = OpFunction %void None %15 - %18 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %20 = OpLoad %14 %arg_1 - %21 = OpLoad %11 %arg_0 - %23 = OpSampledImage %22 %21 %20 - %19 = OpImageGather %v4float %23 %25 %int_0 ConstOffset %29 - OpStore %res %19 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %32 - %34 = OpLabel - %35 = OpFunctionCall %void %textureGather_c409ae - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %15 - %37 = OpLabel - %38 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %38 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %15 - %41 = OpLabel - %42 = OpFunctionCall %void %textureGather_c409ae - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %15 - %44 = OpLabel - %45 = OpFunctionCall %void %textureGather_c409ae - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureGather/c409ae.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/c409ae.wgsl.expected.wgsl deleted file mode 100644 index 3610a5df80..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/c409ae.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_depth_2d; - -@group(1) @binding(1) var arg_1 : sampler; - -fn textureGather_c409ae() { - var res : vec4 = textureGather(arg_0, arg_1, vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_c409ae(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_c409ae(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_c409ae(); -} diff --git a/test/tint/builtins/gen/literal/textureGather/c55822.wgsl b/test/tint/builtins/gen/literal/textureGather/c55822.wgsl deleted file mode 100644 index af96349834..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/c55822.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/gen/gen.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(1) var arg_1: texture_cube_array; -@group(1) @binding(2) var arg_2: sampler; - -// fn textureGather(component: i32, texture: texture_cube_array, sampler: sampler, coords: vec3, array_index: i32) -> vec4 -fn textureGather_c55822() { - var res: vec4 = textureGather(1, arg_1, arg_2, vec3(), 1); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_c55822(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_c55822(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_c55822(); -} diff --git a/test/tint/builtins/gen/literal/textureGather/c55822.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/c55822.wgsl.expected.glsl deleted file mode 100644 index d2c583ff71..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/c55822.wgsl.expected.glsl +++ /dev/null @@ -1,78 +0,0 @@ -SKIP: FAILED - -#version 310 es - -uniform highp isamplerCubeArray arg_1_arg_2; - -void textureGather_c55822() { - ivec4 res = textureGather(arg_1_arg_2, vec4(0.0f, 0.0f, 0.0f, float(1)), 1); -} - -vec4 vertex_main() { - textureGather_c55822(); - return vec4(0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'isamplerCubeArray' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -uniform highp isamplerCubeArray arg_1_arg_2; - -void textureGather_c55822() { - ivec4 res = textureGather(arg_1_arg_2, vec4(0.0f, 0.0f, 0.0f, float(1)), 1); -} - -void fragment_main() { - textureGather_c55822(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'isamplerCubeArray' : Reserved word. -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -uniform highp isamplerCubeArray arg_1_arg_2; - -void textureGather_c55822() { - ivec4 res = textureGather(arg_1_arg_2, vec4(0.0f, 0.0f, 0.0f, float(1)), 1); -} - -void compute_main() { - textureGather_c55822(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'isamplerCubeArray' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/literal/textureGather/c55822.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureGather/c55822.wgsl.expected.hlsl deleted file mode 100644 index 6cd09d4472..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/c55822.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -TextureCubeArray arg_1 : register(t1, space1); -SamplerState arg_2 : register(s2, space1); - -void textureGather_c55822() { - int4 res = arg_1.GatherGreen(arg_2, float4(0.0f, 0.0f, 0.0f, float(1))); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureGather_c55822(); - return (0.0f).xxxx; -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureGather_c55822(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureGather_c55822(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureGather/c55822.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/c55822.wgsl.expected.msl deleted file mode 100644 index 56981c001d..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/c55822.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureGather_c55822(texturecube_array tint_symbol_1, sampler tint_symbol_2) { - int4 res = tint_symbol_1.gather(tint_symbol_2, float3(0.0f), 1, component::y); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texturecube_array tint_symbol_3, sampler tint_symbol_4) { - textureGather_c55822(tint_symbol_3, tint_symbol_4); - return float4(0.0f); -} - -vertex tint_symbol vertex_main(texturecube_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texturecube_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureGather_c55822(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(texturecube_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureGather_c55822(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/literal/textureGather/c55822.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/c55822.wgsl.expected.spvasm deleted file mode 100644 index 3b73a1cf66..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/c55822.wgsl.expected.spvasm +++ /dev/null @@ -1,88 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 47 -; Schema: 0 - OpCapability Shader - OpCapability SampledCubeArray - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_1 "arg_1" - OpName %arg_2 "arg_2" - OpName %textureGather_c55822 "textureGather_c55822" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - OpDecorate %arg_2 DescriptorSet 1 - OpDecorate %arg_2 Binding 2 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %int = OpTypeInt 32 1 - %11 = OpTypeImage %int Cube 0 1 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %15 = OpTypeSampler -%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 - %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant - %void = OpTypeVoid - %16 = OpTypeFunction %void - %v4int = OpTypeVector %int 4 - %24 = OpTypeSampledImage %11 - %float_0 = OpConstant %float 0 - %int_1 = OpConstant %int 1 -%_ptr_Function_v4int = OpTypePointer Function %v4int - %32 = OpConstantNull %v4int - %33 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureGather_c55822 = OpFunction %void None %16 - %19 = OpLabel - %res = OpVariable %_ptr_Function_v4int Function %32 - %22 = OpLoad %15 %arg_2 - %23 = OpLoad %11 %arg_1 - %25 = OpSampledImage %24 %23 %22 - %27 = OpConvertSToF %float %int_1 - %29 = OpCompositeConstruct %v4float %float_0 %float_0 %float_0 %27 - %20 = OpImageGather %v4int %25 %29 %int_1 - OpStore %res %20 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %33 - %35 = OpLabel - %36 = OpFunctionCall %void %textureGather_c55822 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %16 - %38 = OpLabel - %39 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %39 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %16 - %42 = OpLabel - %43 = OpFunctionCall %void %textureGather_c55822 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %16 - %45 = OpLabel - %46 = OpFunctionCall %void %textureGather_c55822 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureGather/c55822.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/c55822.wgsl.expected.wgsl deleted file mode 100644 index 261b01b039..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/c55822.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(1) var arg_1 : texture_cube_array; - -@group(1) @binding(2) var arg_2 : sampler; - -fn textureGather_c55822() { - var res : vec4 = textureGather(1, arg_1, arg_2, vec3(), 1); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_c55822(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_c55822(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_c55822(); -} diff --git a/test/tint/builtins/gen/literal/textureGather/d1f187.wgsl b/test/tint/builtins/gen/literal/textureGather/d1f187.wgsl new file mode 100644 index 0000000000..eb50d20952 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/d1f187.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_2d_array; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, @const offset: vec2) -> vec4 +fn textureGather_d1f187() { + var res: vec4 = textureGather(1, arg_1, arg_2, vec2(), 1, vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_d1f187(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_d1f187(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_d1f187(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/d1f187.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/d1f187.wgsl.expected.glsl new file mode 100644 index 0000000000..442d77ae01 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/d1f187.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp usampler2DArray arg_1_arg_2; + +void textureGather_d1f187() { + uvec4 res = textureGatherOffset(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), ivec2(0), 1); +} + +vec4 vertex_main() { + textureGather_d1f187(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp usampler2DArray arg_1_arg_2; + +void textureGather_d1f187() { + uvec4 res = textureGatherOffset(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), ivec2(0), 1); +} + +void fragment_main() { + textureGather_d1f187(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp usampler2DArray arg_1_arg_2; + +void textureGather_d1f187() { + uvec4 res = textureGatherOffset(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), ivec2(0), 1); +} + +void compute_main() { + textureGather_d1f187(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/d1f187.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureGather/d1f187.wgsl.expected.hlsl new file mode 100644 index 0000000000..ad1a98fa20 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/d1f187.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +Texture2DArray arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_d1f187() { + uint4 res = arg_1.GatherGreen(arg_2, float3(0.0f, 0.0f, float(1)), (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_d1f187(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_d1f187(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_d1f187(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/d1f187.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/d1f187.wgsl.expected.msl new file mode 100644 index 0000000000..1f50d685e2 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/d1f187.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureGather_d1f187(texture2d_array tint_symbol_1, sampler tint_symbol_2) { + uint4 res = tint_symbol_1.gather(tint_symbol_2, float2(0.0f), 1, int2(0), component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_3, sampler tint_symbol_4) { + textureGather_d1f187(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_d1f187(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_d1f187(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureGather/d1f187.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/d1f187.wgsl.expected.spvasm new file mode 100644 index 0000000000..369e2a3d72 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/d1f187.wgsl.expected.spvasm @@ -0,0 +1,91 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 51 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_d1f187 "textureGather_d1f187" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %15 = OpTypeSampler +%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 + %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant + %void = OpTypeVoid + %16 = OpTypeFunction %void + %v4uint = OpTypeVector %uint 4 + %24 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 + %float_0 = OpConstant %float 0 + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %v2int = OpTypeVector %int 2 + %33 = OpConstantNull %v2int +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %36 = OpConstantNull %v4uint + %37 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_d1f187 = OpFunction %void None %16 + %19 = OpLabel + %res = OpVariable %_ptr_Function_v4uint Function %36 + %22 = OpLoad %15 %arg_2 + %23 = OpLoad %11 %arg_1 + %25 = OpSampledImage %24 %23 %22 + %28 = OpConvertSToF %float %int_1 + %31 = OpCompositeConstruct %v3float %float_0 %float_0 %28 + %20 = OpImageGather %v4uint %25 %31 %int_1 ConstOffset %33 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %37 + %39 = OpLabel + %40 = OpFunctionCall %void %textureGather_d1f187 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %16 + %42 = OpLabel + %43 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %43 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %16 + %46 = OpLabel + %47 = OpFunctionCall %void %textureGather_d1f187 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %16 + %49 = OpLabel + %50 = OpFunctionCall %void %textureGather_d1f187 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureGather/d1f187.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/d1f187.wgsl.expected.wgsl new file mode 100644 index 0000000000..e7dcb990dc --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/d1f187.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(1) var arg_1 : texture_2d_array; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_d1f187() { + var res : vec4 = textureGather(1, arg_1, arg_2, vec2(), 1, vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_d1f187(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_d1f187(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_d1f187(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/d90605.wgsl b/test/tint/builtins/gen/literal/textureGather/d90605.wgsl new file mode 100644 index 0000000000..337a626ff9 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/d90605.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d_array; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureGather(texture: texture_depth_2d_array, sampler: sampler, coords: vec2, array_index: i32, @const offset: vec2) -> vec4 +fn textureGather_d90605() { + var res: vec4 = textureGather(arg_0, arg_1, vec2(), 1, vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_d90605(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_d90605(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_d90605(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/d90605.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/d90605.wgsl.expected.glsl new file mode 100644 index 0000000000..5028f86173 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/d90605.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureGather_d90605() { + vec4 res = textureGatherOffset(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), 0.0, ivec2(0)); +} + +vec4 vertex_main() { + textureGather_d90605(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureGather_d90605() { + vec4 res = textureGatherOffset(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), 0.0, ivec2(0)); +} + +void fragment_main() { + textureGather_d90605(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureGather_d90605() { + vec4 res = textureGatherOffset(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), 0.0, ivec2(0)); +} + +void compute_main() { + textureGather_d90605(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/d90605.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureGather/d90605.wgsl.expected.hlsl new file mode 100644 index 0000000000..8a54bc6267 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/d90605.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureGather_d90605() { + float4 res = arg_0.Gather(arg_1, float3(0.0f, 0.0f, float(1)), (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_d90605(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_d90605(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_d90605(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/d90605.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/d90605.wgsl.expected.msl new file mode 100644 index 0000000000..90be232ac8 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/d90605.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureGather_d90605(depth2d_array tint_symbol_1, sampler tint_symbol_2) { + float4 res = tint_symbol_1.gather(tint_symbol_2, float2(0.0f), 1, int2(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d_array tint_symbol_3, sampler tint_symbol_4) { + textureGather_d90605(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_d90605(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depth2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_d90605(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureGather/d90605.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/d90605.wgsl.expected.spvasm new file mode 100644 index 0000000000..38cffa3654 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/d90605.wgsl.expected.spvasm @@ -0,0 +1,89 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 49 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureGather_d90605 "textureGather_d90605" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %22 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 + %float_0 = OpConstant %float 0 + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %int_0 = OpConstant %int 0 + %v2int = OpTypeVector %int 2 + %32 = OpConstantNull %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %35 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_d90605 = OpFunction %void None %15 + %18 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %20 = OpLoad %14 %arg_1 + %21 = OpLoad %11 %arg_0 + %23 = OpSampledImage %22 %21 %20 + %26 = OpConvertSToF %float %int_1 + %29 = OpCompositeConstruct %v3float %float_0 %float_0 %26 + %19 = OpImageGather %v4float %23 %29 %int_0 ConstOffset %32 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %35 + %37 = OpLabel + %38 = OpFunctionCall %void %textureGather_d90605 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %40 = OpLabel + %41 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %41 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %44 = OpLabel + %45 = OpFunctionCall %void %textureGather_d90605 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %47 = OpLabel + %48 = OpFunctionCall %void %textureGather_d90605 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureGather/d90605.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/d90605.wgsl.expected.wgsl new file mode 100644 index 0000000000..c88f42caf1 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/d90605.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d_array; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureGather_d90605() { + var res : vec4 = textureGather(arg_0, arg_1, vec2(), 1, vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_d90605(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_d90605(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_d90605(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/e1b67d.wgsl b/test/tint/builtins/gen/literal/textureGather/e1b67d.wgsl deleted file mode 100644 index 148009f212..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/e1b67d.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/gen/gen.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(1) var arg_1: texture_cube; -@group(1) @binding(2) var arg_2: sampler; - -// fn textureGather(component: i32, texture: texture_cube, sampler: sampler, coords: vec3) -> vec4 -fn textureGather_e1b67d() { - var res: vec4 = textureGather(1, arg_1, arg_2, vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_e1b67d(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_e1b67d(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_e1b67d(); -} diff --git a/test/tint/builtins/gen/literal/textureGather/e1b67d.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/e1b67d.wgsl.expected.glsl deleted file mode 100644 index bb68eb7d0c..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/e1b67d.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp usamplerCube arg_1_arg_2; - -void textureGather_e1b67d() { - uvec4 res = textureGather(arg_1_arg_2, vec3(0.0f), 1); -} - -vec4 vertex_main() { - textureGather_e1b67d(); - return vec4(0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp usamplerCube arg_1_arg_2; - -void textureGather_e1b67d() { - uvec4 res = textureGather(arg_1_arg_2, vec3(0.0f), 1); -} - -void fragment_main() { - textureGather_e1b67d(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp usamplerCube arg_1_arg_2; - -void textureGather_e1b67d() { - uvec4 res = textureGather(arg_1_arg_2, vec3(0.0f), 1); -} - -void compute_main() { - textureGather_e1b67d(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureGather/e1b67d.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureGather/e1b67d.wgsl.expected.hlsl deleted file mode 100644 index 9d4524fa17..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/e1b67d.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -TextureCube arg_1 : register(t1, space1); -SamplerState arg_2 : register(s2, space1); - -void textureGather_e1b67d() { - uint4 res = arg_1.GatherGreen(arg_2, (0.0f).xxx); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureGather_e1b67d(); - return (0.0f).xxxx; -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureGather_e1b67d(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureGather_e1b67d(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureGather/e1b67d.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/e1b67d.wgsl.expected.msl deleted file mode 100644 index d78d2d328c..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/e1b67d.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureGather_e1b67d(texturecube tint_symbol_1, sampler tint_symbol_2) { - uint4 res = tint_symbol_1.gather(tint_symbol_2, float3(0.0f), component::y); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texturecube tint_symbol_3, sampler tint_symbol_4) { - textureGather_e1b67d(tint_symbol_3, tint_symbol_4); - return float4(0.0f); -} - -vertex tint_symbol vertex_main(texturecube tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texturecube tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureGather_e1b67d(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(texturecube tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureGather_e1b67d(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/literal/textureGather/e1b67d.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/e1b67d.wgsl.expected.spvasm deleted file mode 100644 index e7664cb340..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/e1b67d.wgsl.expected.spvasm +++ /dev/null @@ -1,87 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 47 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_1 "arg_1" - OpName %arg_2 "arg_2" - OpName %textureGather_e1b67d "textureGather_e1b67d" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - OpDecorate %arg_2 DescriptorSet 1 - OpDecorate %arg_2 Binding 2 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %uint = OpTypeInt 32 0 - %11 = OpTypeImage %uint Cube 0 0 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %15 = OpTypeSampler -%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 - %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant - %void = OpTypeVoid - %16 = OpTypeFunction %void - %v4uint = OpTypeVector %uint 4 - %24 = OpTypeSampledImage %11 - %v3float = OpTypeVector %float 3 - %27 = OpConstantNull %v3float - %int = OpTypeInt 32 1 - %int_1 = OpConstant %int 1 -%_ptr_Function_v4uint = OpTypePointer Function %v4uint - %32 = OpConstantNull %v4uint - %33 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureGather_e1b67d = OpFunction %void None %16 - %19 = OpLabel - %res = OpVariable %_ptr_Function_v4uint Function %32 - %22 = OpLoad %15 %arg_2 - %23 = OpLoad %11 %arg_1 - %25 = OpSampledImage %24 %23 %22 - %20 = OpImageGather %v4uint %25 %27 %int_1 - OpStore %res %20 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %33 - %35 = OpLabel - %36 = OpFunctionCall %void %textureGather_e1b67d - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %16 - %38 = OpLabel - %39 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %39 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %16 - %42 = OpLabel - %43 = OpFunctionCall %void %textureGather_e1b67d - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %16 - %45 = OpLabel - %46 = OpFunctionCall %void %textureGather_e1b67d - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureGather/e1b67d.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/e1b67d.wgsl.expected.wgsl deleted file mode 100644 index 4f60ac795e..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/e1b67d.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(1) var arg_1 : texture_cube; - -@group(1) @binding(2) var arg_2 : sampler; - -fn textureGather_e1b67d() { - var res : vec4 = textureGather(1, arg_1, arg_2, vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_e1b67d(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_e1b67d(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_e1b67d(); -} diff --git a/test/tint/builtins/gen/literal/textureGather/e9d390.wgsl b/test/tint/builtins/gen/literal/textureGather/e9d390.wgsl new file mode 100644 index 0000000000..d01ae42347 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/e9d390.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_2d_array; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, @const offset: vec2) -> vec4 +fn textureGather_e9d390() { + var res: vec4 = textureGather(1, arg_1, arg_2, vec2(), 1, vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_e9d390(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_e9d390(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_e9d390(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/e9d390.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/e9d390.wgsl.expected.glsl new file mode 100644 index 0000000000..fc9b73f561 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/e9d390.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp isampler2DArray arg_1_arg_2; + +void textureGather_e9d390() { + ivec4 res = textureGatherOffset(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), ivec2(0), 1); +} + +vec4 vertex_main() { + textureGather_e9d390(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp isampler2DArray arg_1_arg_2; + +void textureGather_e9d390() { + ivec4 res = textureGatherOffset(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), ivec2(0), 1); +} + +void fragment_main() { + textureGather_e9d390(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp isampler2DArray arg_1_arg_2; + +void textureGather_e9d390() { + ivec4 res = textureGatherOffset(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), ivec2(0), 1); +} + +void compute_main() { + textureGather_e9d390(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/e9d390.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureGather/e9d390.wgsl.expected.hlsl new file mode 100644 index 0000000000..2d2893d773 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/e9d390.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +Texture2DArray arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_e9d390() { + int4 res = arg_1.GatherGreen(arg_2, float3(0.0f, 0.0f, float(1)), (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_e9d390(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_e9d390(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_e9d390(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/e9d390.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/e9d390.wgsl.expected.msl new file mode 100644 index 0000000000..2449d25a52 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/e9d390.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureGather_e9d390(texture2d_array tint_symbol_1, sampler tint_symbol_2) { + int4 res = tint_symbol_1.gather(tint_symbol_2, float2(0.0f), 1, int2(0), component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_3, sampler tint_symbol_4) { + textureGather_e9d390(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_e9d390(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_e9d390(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureGather/e9d390.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/e9d390.wgsl.expected.spvasm new file mode 100644 index 0000000000..aa462bc923 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/e9d390.wgsl.expected.spvasm @@ -0,0 +1,90 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 50 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_e9d390 "textureGather_e9d390" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %15 = OpTypeSampler +%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 + %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant + %void = OpTypeVoid + %16 = OpTypeFunction %void + %v4int = OpTypeVector %int 4 + %24 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 + %float_0 = OpConstant %float 0 + %int_1 = OpConstant %int 1 + %v2int = OpTypeVector %int 2 + %32 = OpConstantNull %v2int +%_ptr_Function_v4int = OpTypePointer Function %v4int + %35 = OpConstantNull %v4int + %36 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_e9d390 = OpFunction %void None %16 + %19 = OpLabel + %res = OpVariable %_ptr_Function_v4int Function %35 + %22 = OpLoad %15 %arg_2 + %23 = OpLoad %11 %arg_1 + %25 = OpSampledImage %24 %23 %22 + %28 = OpConvertSToF %float %int_1 + %30 = OpCompositeConstruct %v3float %float_0 %float_0 %28 + %20 = OpImageGather %v4int %25 %30 %int_1 ConstOffset %32 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %36 + %38 = OpLabel + %39 = OpFunctionCall %void %textureGather_e9d390 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %16 + %41 = OpLabel + %42 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %42 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %16 + %45 = OpLabel + %46 = OpFunctionCall %void %textureGather_e9d390 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %16 + %48 = OpLabel + %49 = OpFunctionCall %void %textureGather_e9d390 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureGather/e9d390.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/e9d390.wgsl.expected.wgsl new file mode 100644 index 0000000000..bbfe7c50a3 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/e9d390.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(1) var arg_1 : texture_2d_array; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_e9d390() { + var res : vec4 = textureGather(1, arg_1, arg_2, vec2(), 1, vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_e9d390(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_e9d390(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_e9d390(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/e9eff6.wgsl b/test/tint/builtins/gen/literal/textureGather/e9eff6.wgsl deleted file mode 100644 index 8d001a0b02..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/e9eff6.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/gen/gen.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(1) var arg_1: texture_2d; -@group(1) @binding(2) var arg_2: sampler; - -// fn textureGather(component: i32, texture: texture_2d, sampler: sampler, coords: vec2) -> vec4 -fn textureGather_e9eff6() { - var res: vec4 = textureGather(1, arg_1, arg_2, vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_e9eff6(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_e9eff6(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_e9eff6(); -} diff --git a/test/tint/builtins/gen/literal/textureGather/e9eff6.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/e9eff6.wgsl.expected.glsl deleted file mode 100644 index 369c32fbb1..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/e9eff6.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp usampler2D arg_1_arg_2; - -void textureGather_e9eff6() { - uvec4 res = textureGather(arg_1_arg_2, vec2(0.0f), 1); -} - -vec4 vertex_main() { - textureGather_e9eff6(); - return vec4(0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp usampler2D arg_1_arg_2; - -void textureGather_e9eff6() { - uvec4 res = textureGather(arg_1_arg_2, vec2(0.0f), 1); -} - -void fragment_main() { - textureGather_e9eff6(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp usampler2D arg_1_arg_2; - -void textureGather_e9eff6() { - uvec4 res = textureGather(arg_1_arg_2, vec2(0.0f), 1); -} - -void compute_main() { - textureGather_e9eff6(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureGather/e9eff6.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureGather/e9eff6.wgsl.expected.hlsl deleted file mode 100644 index 6dd6b27ebb..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/e9eff6.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -Texture2D arg_1 : register(t1, space1); -SamplerState arg_2 : register(s2, space1); - -void textureGather_e9eff6() { - uint4 res = arg_1.GatherGreen(arg_2, (0.0f).xx); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureGather_e9eff6(); - return (0.0f).xxxx; -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureGather_e9eff6(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureGather_e9eff6(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureGather/e9eff6.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/e9eff6.wgsl.expected.msl deleted file mode 100644 index 1324b2d235..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/e9eff6.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureGather_e9eff6(texture2d tint_symbol_1, sampler tint_symbol_2) { - uint4 res = tint_symbol_1.gather(tint_symbol_2, float2(0.0f), int2(0), component::y); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d tint_symbol_3, sampler tint_symbol_4) { - textureGather_e9eff6(tint_symbol_3, tint_symbol_4); - return float4(0.0f); -} - -vertex tint_symbol vertex_main(texture2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureGather_e9eff6(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(texture2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureGather_e9eff6(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/literal/textureGather/e9eff6.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/e9eff6.wgsl.expected.spvasm deleted file mode 100644 index 621964021f..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/e9eff6.wgsl.expected.spvasm +++ /dev/null @@ -1,87 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 47 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_1 "arg_1" - OpName %arg_2 "arg_2" - OpName %textureGather_e9eff6 "textureGather_e9eff6" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - OpDecorate %arg_2 DescriptorSet 1 - OpDecorate %arg_2 Binding 2 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %uint = OpTypeInt 32 0 - %11 = OpTypeImage %uint 2D 0 0 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %15 = OpTypeSampler -%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 - %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant - %void = OpTypeVoid - %16 = OpTypeFunction %void - %v4uint = OpTypeVector %uint 4 - %24 = OpTypeSampledImage %11 - %v2float = OpTypeVector %float 2 - %27 = OpConstantNull %v2float - %int = OpTypeInt 32 1 - %int_1 = OpConstant %int 1 -%_ptr_Function_v4uint = OpTypePointer Function %v4uint - %32 = OpConstantNull %v4uint - %33 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureGather_e9eff6 = OpFunction %void None %16 - %19 = OpLabel - %res = OpVariable %_ptr_Function_v4uint Function %32 - %22 = OpLoad %15 %arg_2 - %23 = OpLoad %11 %arg_1 - %25 = OpSampledImage %24 %23 %22 - %20 = OpImageGather %v4uint %25 %27 %int_1 - OpStore %res %20 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %33 - %35 = OpLabel - %36 = OpFunctionCall %void %textureGather_e9eff6 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %16 - %38 = OpLabel - %39 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %39 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %16 - %42 = OpLabel - %43 = OpFunctionCall %void %textureGather_e9eff6 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %16 - %45 = OpLabel - %46 = OpFunctionCall %void %textureGather_e9eff6 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureGather/e9eff6.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/e9eff6.wgsl.expected.wgsl deleted file mode 100644 index 708a011d5c..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/e9eff6.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(1) var arg_1 : texture_2d; - -@group(1) @binding(2) var arg_2 : sampler; - -fn textureGather_e9eff6() { - var res : vec4 = textureGather(1, arg_1, arg_2, vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_e9eff6(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_e9eff6(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_e9eff6(); -} diff --git a/test/tint/builtins/gen/literal/textureGather/f2c6e3.wgsl b/test/tint/builtins/gen/literal/textureGather/f2c6e3.wgsl new file mode 100644 index 0000000000..170ca5137f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/f2c6e3.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_cube_array; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_cube_array, sampler: sampler, coords: vec3, array_index: i32) -> vec4 +fn textureGather_f2c6e3() { + var res: vec4 = textureGather(1, arg_1, arg_2, vec3(), 1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_f2c6e3(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_f2c6e3(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_f2c6e3(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/f2c6e3.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/f2c6e3.wgsl.expected.glsl new file mode 100644 index 0000000000..f8eed5e615 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/f2c6e3.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp usamplerCubeArray arg_1_arg_2; + +void textureGather_f2c6e3() { + uvec4 res = textureGather(arg_1_arg_2, vec4(0.0f, 0.0f, 0.0f, float(1)), 1); +} + +vec4 vertex_main() { + textureGather_f2c6e3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'usamplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp usamplerCubeArray arg_1_arg_2; + +void textureGather_f2c6e3() { + uvec4 res = textureGather(arg_1_arg_2, vec4(0.0f, 0.0f, 0.0f, float(1)), 1); +} + +void fragment_main() { + textureGather_f2c6e3(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'usamplerCubeArray' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp usamplerCubeArray arg_1_arg_2; + +void textureGather_f2c6e3() { + uvec4 res = textureGather(arg_1_arg_2, vec4(0.0f, 0.0f, 0.0f, float(1)), 1); +} + +void compute_main() { + textureGather_f2c6e3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'usamplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureGather/f2c6e3.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureGather/f2c6e3.wgsl.expected.hlsl new file mode 100644 index 0000000000..a6114a7f6f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/f2c6e3.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +TextureCubeArray arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_f2c6e3() { + uint4 res = arg_1.GatherGreen(arg_2, float4(0.0f, 0.0f, 0.0f, float(1))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_f2c6e3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_f2c6e3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_f2c6e3(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/f2c6e3.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/f2c6e3.wgsl.expected.msl new file mode 100644 index 0000000000..3d5fb84107 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/f2c6e3.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureGather_f2c6e3(texturecube_array tint_symbol_1, sampler tint_symbol_2) { + uint4 res = tint_symbol_1.gather(tint_symbol_2, float3(0.0f), 1, component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube_array tint_symbol_3, sampler tint_symbol_4) { + textureGather_f2c6e3(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_f2c6e3(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texturecube_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_f2c6e3(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureGather/f2c6e3.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/f2c6e3.wgsl.expected.spvasm new file mode 100644 index 0000000000..43cb212c2e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/f2c6e3.wgsl.expected.spvasm @@ -0,0 +1,89 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 48 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_f2c6e3 "textureGather_f2c6e3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %15 = OpTypeSampler +%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 + %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant + %void = OpTypeVoid + %16 = OpTypeFunction %void + %v4uint = OpTypeVector %uint 4 + %24 = OpTypeSampledImage %11 + %float_0 = OpConstant %float 0 + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %33 = OpConstantNull %v4uint + %34 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_f2c6e3 = OpFunction %void None %16 + %19 = OpLabel + %res = OpVariable %_ptr_Function_v4uint Function %33 + %22 = OpLoad %15 %arg_2 + %23 = OpLoad %11 %arg_1 + %25 = OpSampledImage %24 %23 %22 + %27 = OpConvertSToF %float %int_1 + %30 = OpCompositeConstruct %v4float %float_0 %float_0 %float_0 %27 + %20 = OpImageGather %v4uint %25 %30 %int_1 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %34 + %36 = OpLabel + %37 = OpFunctionCall %void %textureGather_f2c6e3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %16 + %39 = OpLabel + %40 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %40 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %16 + %43 = OpLabel + %44 = OpFunctionCall %void %textureGather_f2c6e3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %16 + %46 = OpLabel + %47 = OpFunctionCall %void %textureGather_f2c6e3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureGather/f2c6e3.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/f2c6e3.wgsl.expected.wgsl new file mode 100644 index 0000000000..2f4a223908 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/f2c6e3.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(1) var arg_1 : texture_cube_array; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_f2c6e3() { + var res : vec4 = textureGather(1, arg_1, arg_2, vec3(), 1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_f2c6e3(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_f2c6e3(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_f2c6e3(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/f5f3ba.wgsl b/test/tint/builtins/gen/literal/textureGather/f5f3ba.wgsl deleted file mode 100644 index b7886ebfb3..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/f5f3ba.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/gen/gen.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(1) var arg_1: texture_2d_array; -@group(1) @binding(2) var arg_2: sampler; - -// fn textureGather(component: i32, texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, offset: vec2) -> vec4 -fn textureGather_f5f3ba() { - var res: vec4 = textureGather(1, arg_1, arg_2, vec2(), 1, vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_f5f3ba(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_f5f3ba(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_f5f3ba(); -} diff --git a/test/tint/builtins/gen/literal/textureGather/f5f3ba.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/f5f3ba.wgsl.expected.glsl deleted file mode 100644 index 0d1fb5a8e7..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/f5f3ba.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp usampler2DArray arg_1_arg_2; - -void textureGather_f5f3ba() { - uvec4 res = textureGatherOffset(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), ivec2(0), 1); -} - -vec4 vertex_main() { - textureGather_f5f3ba(); - return vec4(0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp usampler2DArray arg_1_arg_2; - -void textureGather_f5f3ba() { - uvec4 res = textureGatherOffset(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), ivec2(0), 1); -} - -void fragment_main() { - textureGather_f5f3ba(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp usampler2DArray arg_1_arg_2; - -void textureGather_f5f3ba() { - uvec4 res = textureGatherOffset(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), ivec2(0), 1); -} - -void compute_main() { - textureGather_f5f3ba(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureGather/f5f3ba.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureGather/f5f3ba.wgsl.expected.hlsl deleted file mode 100644 index c151d9717e..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/f5f3ba.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -Texture2DArray arg_1 : register(t1, space1); -SamplerState arg_2 : register(s2, space1); - -void textureGather_f5f3ba() { - uint4 res = arg_1.GatherGreen(arg_2, float3(0.0f, 0.0f, float(1)), (0).xx); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureGather_f5f3ba(); - return (0.0f).xxxx; -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureGather_f5f3ba(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureGather_f5f3ba(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureGather/f5f3ba.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/f5f3ba.wgsl.expected.msl deleted file mode 100644 index 89c7e7d120..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/f5f3ba.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureGather_f5f3ba(texture2d_array tint_symbol_1, sampler tint_symbol_2) { - uint4 res = tint_symbol_1.gather(tint_symbol_2, float2(0.0f), 1, int2(0), component::y); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_3, sampler tint_symbol_4) { - textureGather_f5f3ba(tint_symbol_3, tint_symbol_4); - return float4(0.0f); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureGather_f5f3ba(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureGather_f5f3ba(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/literal/textureGather/f5f3ba.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/f5f3ba.wgsl.expected.spvasm deleted file mode 100644 index 893c80af07..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/f5f3ba.wgsl.expected.spvasm +++ /dev/null @@ -1,91 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 51 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_1 "arg_1" - OpName %arg_2 "arg_2" - OpName %textureGather_f5f3ba "textureGather_f5f3ba" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - OpDecorate %arg_2 DescriptorSet 1 - OpDecorate %arg_2 Binding 2 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %uint = OpTypeInt 32 0 - %11 = OpTypeImage %uint 2D 0 1 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %15 = OpTypeSampler -%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 - %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant - %void = OpTypeVoid - %16 = OpTypeFunction %void - %v4uint = OpTypeVector %uint 4 - %24 = OpTypeSampledImage %11 - %v3float = OpTypeVector %float 3 - %float_0 = OpConstant %float 0 - %int = OpTypeInt 32 1 - %int_1 = OpConstant %int 1 - %v2int = OpTypeVector %int 2 - %33 = OpConstantNull %v2int -%_ptr_Function_v4uint = OpTypePointer Function %v4uint - %36 = OpConstantNull %v4uint - %37 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureGather_f5f3ba = OpFunction %void None %16 - %19 = OpLabel - %res = OpVariable %_ptr_Function_v4uint Function %36 - %22 = OpLoad %15 %arg_2 - %23 = OpLoad %11 %arg_1 - %25 = OpSampledImage %24 %23 %22 - %28 = OpConvertSToF %float %int_1 - %31 = OpCompositeConstruct %v3float %float_0 %float_0 %28 - %20 = OpImageGather %v4uint %25 %31 %int_1 ConstOffset %33 - OpStore %res %20 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %37 - %39 = OpLabel - %40 = OpFunctionCall %void %textureGather_f5f3ba - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %16 - %42 = OpLabel - %43 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %43 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %16 - %46 = OpLabel - %47 = OpFunctionCall %void %textureGather_f5f3ba - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %16 - %49 = OpLabel - %50 = OpFunctionCall %void %textureGather_f5f3ba - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureGather/f5f3ba.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/f5f3ba.wgsl.expected.wgsl deleted file mode 100644 index b5ddcdc14f..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/f5f3ba.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(1) var arg_1 : texture_2d_array; - -@group(1) @binding(2) var arg_2 : sampler; - -fn textureGather_f5f3ba() { - var res : vec4 = textureGather(1, arg_1, arg_2, vec2(), 1, vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_f5f3ba(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_f5f3ba(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_f5f3ba(); -} diff --git a/test/tint/builtins/gen/literal/textureGather/f7995a.wgsl b/test/tint/builtins/gen/literal/textureGather/f7995a.wgsl deleted file mode 100644 index b811706f85..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/f7995a.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/gen/gen.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(1) var arg_1: texture_cube; -@group(1) @binding(2) var arg_2: sampler; - -// fn textureGather(component: i32, texture: texture_cube, sampler: sampler, coords: vec3) -> vec4 -fn textureGather_f7995a() { - var res: vec4 = textureGather(1, arg_1, arg_2, vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_f7995a(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_f7995a(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_f7995a(); -} diff --git a/test/tint/builtins/gen/literal/textureGather/f7995a.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/f7995a.wgsl.expected.glsl deleted file mode 100644 index 57a2fdbdc6..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/f7995a.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp isamplerCube arg_1_arg_2; - -void textureGather_f7995a() { - ivec4 res = textureGather(arg_1_arg_2, vec3(0.0f), 1); -} - -vec4 vertex_main() { - textureGather_f7995a(); - return vec4(0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp isamplerCube arg_1_arg_2; - -void textureGather_f7995a() { - ivec4 res = textureGather(arg_1_arg_2, vec3(0.0f), 1); -} - -void fragment_main() { - textureGather_f7995a(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp isamplerCube arg_1_arg_2; - -void textureGather_f7995a() { - ivec4 res = textureGather(arg_1_arg_2, vec3(0.0f), 1); -} - -void compute_main() { - textureGather_f7995a(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureGather/f7995a.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureGather/f7995a.wgsl.expected.hlsl deleted file mode 100644 index 65c13a9dbe..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/f7995a.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -TextureCube arg_1 : register(t1, space1); -SamplerState arg_2 : register(s2, space1); - -void textureGather_f7995a() { - int4 res = arg_1.GatherGreen(arg_2, (0.0f).xxx); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureGather_f7995a(); - return (0.0f).xxxx; -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureGather_f7995a(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureGather_f7995a(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureGather/f7995a.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/f7995a.wgsl.expected.msl deleted file mode 100644 index 0dd9987356..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/f7995a.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureGather_f7995a(texturecube tint_symbol_1, sampler tint_symbol_2) { - int4 res = tint_symbol_1.gather(tint_symbol_2, float3(0.0f), component::y); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texturecube tint_symbol_3, sampler tint_symbol_4) { - textureGather_f7995a(tint_symbol_3, tint_symbol_4); - return float4(0.0f); -} - -vertex tint_symbol vertex_main(texturecube tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texturecube tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureGather_f7995a(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(texturecube tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureGather_f7995a(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/literal/textureGather/f7995a.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/f7995a.wgsl.expected.spvasm deleted file mode 100644 index 08fb6fc339..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/f7995a.wgsl.expected.spvasm +++ /dev/null @@ -1,86 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 46 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_1 "arg_1" - OpName %arg_2 "arg_2" - OpName %textureGather_f7995a "textureGather_f7995a" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - OpDecorate %arg_2 DescriptorSet 1 - OpDecorate %arg_2 Binding 2 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %int = OpTypeInt 32 1 - %11 = OpTypeImage %int Cube 0 0 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %15 = OpTypeSampler -%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 - %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant - %void = OpTypeVoid - %16 = OpTypeFunction %void - %v4int = OpTypeVector %int 4 - %24 = OpTypeSampledImage %11 - %v3float = OpTypeVector %float 3 - %27 = OpConstantNull %v3float - %int_1 = OpConstant %int 1 -%_ptr_Function_v4int = OpTypePointer Function %v4int - %31 = OpConstantNull %v4int - %32 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureGather_f7995a = OpFunction %void None %16 - %19 = OpLabel - %res = OpVariable %_ptr_Function_v4int Function %31 - %22 = OpLoad %15 %arg_2 - %23 = OpLoad %11 %arg_1 - %25 = OpSampledImage %24 %23 %22 - %20 = OpImageGather %v4int %25 %27 %int_1 - OpStore %res %20 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %32 - %34 = OpLabel - %35 = OpFunctionCall %void %textureGather_f7995a - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %16 - %37 = OpLabel - %38 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %38 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %16 - %41 = OpLabel - %42 = OpFunctionCall %void %textureGather_f7995a - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %16 - %44 = OpLabel - %45 = OpFunctionCall %void %textureGather_f7995a - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureGather/f7995a.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/f7995a.wgsl.expected.wgsl deleted file mode 100644 index 59c890e172..0000000000 --- a/test/tint/builtins/gen/literal/textureGather/f7995a.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(1) var arg_1 : texture_cube; - -@group(1) @binding(2) var arg_2 : sampler; - -fn textureGather_f7995a() { - var res : vec4 = textureGather(1, arg_1, arg_2, vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_f7995a(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_f7995a(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_f7995a(); -} diff --git a/test/tint/builtins/gen/literal/textureGatherCompare/313add.wgsl b/test/tint/builtins/gen/literal/textureGatherCompare/313add.wgsl new file mode 100644 index 0000000000..bbe27100e2 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGatherCompare/313add.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d; +@group(1) @binding(1) var arg_1: sampler_comparison; + +// fn textureGatherCompare(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2, depth_ref: f32, @const offset: vec2) -> vec4 +fn textureGatherCompare_313add() { + var res: vec4 = textureGatherCompare(arg_0, arg_1, vec2(), 1.0, vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGatherCompare_313add(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGatherCompare_313add(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGatherCompare_313add(); +} diff --git a/test/tint/builtins/gen/literal/textureGatherCompare/313add.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGatherCompare/313add.wgsl.expected.glsl new file mode 100644 index 0000000000..7416e88749 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGatherCompare/313add.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureGatherCompare_313add() { + vec4 res = textureGatherOffset(arg_0_arg_1, vec2(0.0f), 1.0f, ivec2(0)); +} + +vec4 vertex_main() { + textureGatherCompare_313add(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureGatherCompare_313add() { + vec4 res = textureGatherOffset(arg_0_arg_1, vec2(0.0f), 1.0f, ivec2(0)); +} + +void fragment_main() { + textureGatherCompare_313add(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureGatherCompare_313add() { + vec4 res = textureGatherOffset(arg_0_arg_1, vec2(0.0f), 1.0f, ivec2(0)); +} + +void compute_main() { + textureGatherCompare_313add(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGatherCompare/313add.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureGatherCompare/313add.wgsl.expected.hlsl new file mode 100644 index 0000000000..3512f9a768 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGatherCompare/313add.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +Texture2D arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureGatherCompare_313add() { + float4 res = arg_0.GatherCmp(arg_1, (0.0f).xx, 1.0f, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGatherCompare_313add(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGatherCompare_313add(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGatherCompare_313add(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGatherCompare/313add.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGatherCompare/313add.wgsl.expected.msl new file mode 100644 index 0000000000..2b15285c32 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGatherCompare/313add.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureGatherCompare_313add(depth2d tint_symbol_1, sampler tint_symbol_2) { + float4 res = tint_symbol_1.gather_compare(tint_symbol_2, float2(0.0f), 1.0f, int2(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d tint_symbol_3, sampler tint_symbol_4) { + textureGatherCompare_313add(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGatherCompare_313add(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depth2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGatherCompare_313add(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureGatherCompare/313add.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGatherCompare/313add.wgsl.expected.spvasm new file mode 100644 index 0000000000..1875a0a776 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGatherCompare/313add.wgsl.expected.spvasm @@ -0,0 +1,85 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureGatherCompare_313add "textureGatherCompare_313add" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %22 = OpTypeSampledImage %11 + %v2float = OpTypeVector %float 2 + %25 = OpConstantNull %v2float + %float_1 = OpConstant %float 1 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %29 = OpConstantNull %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %32 = OpTypeFunction %v4float +%textureGatherCompare_313add = OpFunction %void None %15 + %18 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %20 = OpLoad %14 %arg_1 + %21 = OpLoad %11 %arg_0 + %23 = OpSampledImage %22 %21 %20 + %19 = OpImageDrefGather %v4float %23 %25 %float_1 ConstOffset %29 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %32 + %34 = OpLabel + %35 = OpFunctionCall %void %textureGatherCompare_313add + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %37 = OpLabel + %38 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %38 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %40 = OpLabel + %41 = OpFunctionCall %void %textureGatherCompare_313add + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %43 = OpLabel + %44 = OpFunctionCall %void %textureGatherCompare_313add + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureGatherCompare/313add.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGatherCompare/313add.wgsl.expected.wgsl new file mode 100644 index 0000000000..9260823ada --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGatherCompare/313add.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d; + +@group(1) @binding(1) var arg_1 : sampler_comparison; + +fn textureGatherCompare_313add() { + var res : vec4 = textureGatherCompare(arg_0, arg_1, vec2(), 1.0, vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGatherCompare_313add(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGatherCompare_313add(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGatherCompare_313add(); +} diff --git a/test/tint/builtins/gen/literal/textureGatherCompare/6f1267.wgsl b/test/tint/builtins/gen/literal/textureGatherCompare/6f1267.wgsl deleted file mode 100644 index ade1d7ae99..0000000000 --- a/test/tint/builtins/gen/literal/textureGatherCompare/6f1267.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/gen/gen.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_depth_2d_array; -@group(1) @binding(1) var arg_1: sampler_comparison; - -// fn textureGatherCompare(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2, array_index: i32, depth_ref: f32, offset: vec2) -> vec4 -fn textureGatherCompare_6f1267() { - var res: vec4 = textureGatherCompare(arg_0, arg_1, vec2(), 1, 1.0, vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGatherCompare_6f1267(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGatherCompare_6f1267(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGatherCompare_6f1267(); -} diff --git a/test/tint/builtins/gen/literal/textureGatherCompare/6f1267.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGatherCompare/6f1267.wgsl.expected.glsl deleted file mode 100644 index 0611405c92..0000000000 --- a/test/tint/builtins/gen/literal/textureGatherCompare/6f1267.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp sampler2DArrayShadow arg_0_arg_1; - -void textureGatherCompare_6f1267() { - vec4 res = textureGatherOffset(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), 1.0f, ivec2(0)); -} - -vec4 vertex_main() { - textureGatherCompare_6f1267(); - return vec4(0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp sampler2DArrayShadow arg_0_arg_1; - -void textureGatherCompare_6f1267() { - vec4 res = textureGatherOffset(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), 1.0f, ivec2(0)); -} - -void fragment_main() { - textureGatherCompare_6f1267(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp sampler2DArrayShadow arg_0_arg_1; - -void textureGatherCompare_6f1267() { - vec4 res = textureGatherOffset(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), 1.0f, ivec2(0)); -} - -void compute_main() { - textureGatherCompare_6f1267(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureGatherCompare/6f1267.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureGatherCompare/6f1267.wgsl.expected.hlsl deleted file mode 100644 index 0e99f7bf47..0000000000 --- a/test/tint/builtins/gen/literal/textureGatherCompare/6f1267.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -Texture2DArray arg_0 : register(t0, space1); -SamplerComparisonState arg_1 : register(s1, space1); - -void textureGatherCompare_6f1267() { - float4 res = arg_0.GatherCmp(arg_1, float3(0.0f, 0.0f, float(1)), 1.0f, (0).xx); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureGatherCompare_6f1267(); - return (0.0f).xxxx; -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureGatherCompare_6f1267(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureGatherCompare_6f1267(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureGatherCompare/6f1267.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGatherCompare/6f1267.wgsl.expected.msl deleted file mode 100644 index 1332ccb82a..0000000000 --- a/test/tint/builtins/gen/literal/textureGatherCompare/6f1267.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureGatherCompare_6f1267(depth2d_array tint_symbol_1, sampler tint_symbol_2) { - float4 res = tint_symbol_1.gather_compare(tint_symbol_2, float2(0.0f), 1, 1.0f, int2(0)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(depth2d_array tint_symbol_3, sampler tint_symbol_4) { - textureGatherCompare_6f1267(tint_symbol_3, tint_symbol_4); - return float4(0.0f); -} - -vertex tint_symbol vertex_main(depth2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(depth2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureGatherCompare_6f1267(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(depth2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureGatherCompare_6f1267(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/literal/textureGatherCompare/6f1267.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGatherCompare/6f1267.wgsl.expected.spvasm deleted file mode 100644 index af1a777aed..0000000000 --- a/test/tint/builtins/gen/literal/textureGatherCompare/6f1267.wgsl.expected.spvasm +++ /dev/null @@ -1,88 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 48 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_0 "arg_0" - OpName %arg_1 "arg_1" - OpName %textureGatherCompare_6f1267 "textureGatherCompare_6f1267" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %11 = OpTypeImage %float 2D 0 1 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %14 = OpTypeSampler -%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 - %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant - %void = OpTypeVoid - %15 = OpTypeFunction %void - %22 = OpTypeSampledImage %11 - %v3float = OpTypeVector %float 3 - %float_0 = OpConstant %float 0 - %int = OpTypeInt 32 1 - %int_1 = OpConstant %int 1 - %float_1 = OpConstant %float 1 - %v2int = OpTypeVector %int 2 - %32 = OpConstantNull %v2int -%_ptr_Function_v4float = OpTypePointer Function %v4float - %35 = OpTypeFunction %v4float -%textureGatherCompare_6f1267 = OpFunction %void None %15 - %18 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %20 = OpLoad %14 %arg_1 - %21 = OpLoad %11 %arg_0 - %23 = OpSampledImage %22 %21 %20 - %26 = OpConvertSToF %float %int_1 - %29 = OpCompositeConstruct %v3float %float_0 %float_0 %26 - %19 = OpImageDrefGather %v4float %23 %29 %float_1 ConstOffset %32 - OpStore %res %19 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %35 - %37 = OpLabel - %38 = OpFunctionCall %void %textureGatherCompare_6f1267 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %15 - %40 = OpLabel - %41 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %41 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %15 - %43 = OpLabel - %44 = OpFunctionCall %void %textureGatherCompare_6f1267 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %15 - %46 = OpLabel - %47 = OpFunctionCall %void %textureGatherCompare_6f1267 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureGatherCompare/6f1267.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGatherCompare/6f1267.wgsl.expected.wgsl deleted file mode 100644 index 19e782d584..0000000000 --- a/test/tint/builtins/gen/literal/textureGatherCompare/6f1267.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_depth_2d_array; - -@group(1) @binding(1) var arg_1 : sampler_comparison; - -fn textureGatherCompare_6f1267() { - var res : vec4 = textureGatherCompare(arg_0, arg_1, vec2(), 1, 1.0, vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGatherCompare_6f1267(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGatherCompare_6f1267(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGatherCompare_6f1267(); -} diff --git a/test/tint/builtins/gen/literal/textureGatherCompare/a5f587.wgsl b/test/tint/builtins/gen/literal/textureGatherCompare/a5f587.wgsl deleted file mode 100644 index f8c05c85ec..0000000000 --- a/test/tint/builtins/gen/literal/textureGatherCompare/a5f587.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/gen/gen.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_depth_2d; -@group(1) @binding(1) var arg_1: sampler_comparison; - -// fn textureGatherCompare(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2, depth_ref: f32, offset: vec2) -> vec4 -fn textureGatherCompare_a5f587() { - var res: vec4 = textureGatherCompare(arg_0, arg_1, vec2(), 1.0, vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGatherCompare_a5f587(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGatherCompare_a5f587(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGatherCompare_a5f587(); -} diff --git a/test/tint/builtins/gen/literal/textureGatherCompare/a5f587.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGatherCompare/a5f587.wgsl.expected.glsl deleted file mode 100644 index 347e0da8f3..0000000000 --- a/test/tint/builtins/gen/literal/textureGatherCompare/a5f587.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp sampler2DShadow arg_0_arg_1; - -void textureGatherCompare_a5f587() { - vec4 res = textureGatherOffset(arg_0_arg_1, vec2(0.0f), 1.0f, ivec2(0)); -} - -vec4 vertex_main() { - textureGatherCompare_a5f587(); - return vec4(0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp sampler2DShadow arg_0_arg_1; - -void textureGatherCompare_a5f587() { - vec4 res = textureGatherOffset(arg_0_arg_1, vec2(0.0f), 1.0f, ivec2(0)); -} - -void fragment_main() { - textureGatherCompare_a5f587(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp sampler2DShadow arg_0_arg_1; - -void textureGatherCompare_a5f587() { - vec4 res = textureGatherOffset(arg_0_arg_1, vec2(0.0f), 1.0f, ivec2(0)); -} - -void compute_main() { - textureGatherCompare_a5f587(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureGatherCompare/a5f587.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureGatherCompare/a5f587.wgsl.expected.hlsl deleted file mode 100644 index 9fa53d3032..0000000000 --- a/test/tint/builtins/gen/literal/textureGatherCompare/a5f587.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -Texture2D arg_0 : register(t0, space1); -SamplerComparisonState arg_1 : register(s1, space1); - -void textureGatherCompare_a5f587() { - float4 res = arg_0.GatherCmp(arg_1, (0.0f).xx, 1.0f, (0).xx); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureGatherCompare_a5f587(); - return (0.0f).xxxx; -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureGatherCompare_a5f587(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureGatherCompare_a5f587(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureGatherCompare/a5f587.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGatherCompare/a5f587.wgsl.expected.msl deleted file mode 100644 index 2ceef170c2..0000000000 --- a/test/tint/builtins/gen/literal/textureGatherCompare/a5f587.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureGatherCompare_a5f587(depth2d tint_symbol_1, sampler tint_symbol_2) { - float4 res = tint_symbol_1.gather_compare(tint_symbol_2, float2(0.0f), 1.0f, int2(0)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(depth2d tint_symbol_3, sampler tint_symbol_4) { - textureGatherCompare_a5f587(tint_symbol_3, tint_symbol_4); - return float4(0.0f); -} - -vertex tint_symbol vertex_main(depth2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(depth2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureGatherCompare_a5f587(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(depth2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureGatherCompare_a5f587(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/literal/textureGatherCompare/a5f587.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGatherCompare/a5f587.wgsl.expected.spvasm deleted file mode 100644 index 1cace3a92b..0000000000 --- a/test/tint/builtins/gen/literal/textureGatherCompare/a5f587.wgsl.expected.spvasm +++ /dev/null @@ -1,85 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 45 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_0 "arg_0" - OpName %arg_1 "arg_1" - OpName %textureGatherCompare_a5f587 "textureGatherCompare_a5f587" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %11 = OpTypeImage %float 2D 0 0 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %14 = OpTypeSampler -%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 - %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant - %void = OpTypeVoid - %15 = OpTypeFunction %void - %22 = OpTypeSampledImage %11 - %v2float = OpTypeVector %float 2 - %25 = OpConstantNull %v2float - %float_1 = OpConstant %float 1 - %int = OpTypeInt 32 1 - %v2int = OpTypeVector %int 2 - %29 = OpConstantNull %v2int -%_ptr_Function_v4float = OpTypePointer Function %v4float - %32 = OpTypeFunction %v4float -%textureGatherCompare_a5f587 = OpFunction %void None %15 - %18 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %20 = OpLoad %14 %arg_1 - %21 = OpLoad %11 %arg_0 - %23 = OpSampledImage %22 %21 %20 - %19 = OpImageDrefGather %v4float %23 %25 %float_1 ConstOffset %29 - OpStore %res %19 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %32 - %34 = OpLabel - %35 = OpFunctionCall %void %textureGatherCompare_a5f587 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %15 - %37 = OpLabel - %38 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %38 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %15 - %40 = OpLabel - %41 = OpFunctionCall %void %textureGatherCompare_a5f587 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %15 - %43 = OpLabel - %44 = OpFunctionCall %void %textureGatherCompare_a5f587 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureGatherCompare/a5f587.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGatherCompare/a5f587.wgsl.expected.wgsl deleted file mode 100644 index 44b3cf1515..0000000000 --- a/test/tint/builtins/gen/literal/textureGatherCompare/a5f587.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_depth_2d; - -@group(1) @binding(1) var arg_1 : sampler_comparison; - -fn textureGatherCompare_a5f587() { - var res : vec4 = textureGatherCompare(arg_0, arg_1, vec2(), 1.0, vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGatherCompare_a5f587(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGatherCompare_a5f587(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGatherCompare_a5f587(); -} diff --git a/test/tint/builtins/gen/literal/textureGatherCompare/f585cc.wgsl b/test/tint/builtins/gen/literal/textureGatherCompare/f585cc.wgsl new file mode 100644 index 0000000000..65b554a92c --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGatherCompare/f585cc.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d_array; +@group(1) @binding(1) var arg_1: sampler_comparison; + +// fn textureGatherCompare(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2, array_index: i32, depth_ref: f32, @const offset: vec2) -> vec4 +fn textureGatherCompare_f585cc() { + var res: vec4 = textureGatherCompare(arg_0, arg_1, vec2(), 1, 1.0, vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGatherCompare_f585cc(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGatherCompare_f585cc(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGatherCompare_f585cc(); +} diff --git a/test/tint/builtins/gen/literal/textureGatherCompare/f585cc.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGatherCompare/f585cc.wgsl.expected.glsl new file mode 100644 index 0000000000..be0c7bf89d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGatherCompare/f585cc.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureGatherCompare_f585cc() { + vec4 res = textureGatherOffset(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), 1.0f, ivec2(0)); +} + +vec4 vertex_main() { + textureGatherCompare_f585cc(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureGatherCompare_f585cc() { + vec4 res = textureGatherOffset(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), 1.0f, ivec2(0)); +} + +void fragment_main() { + textureGatherCompare_f585cc(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureGatherCompare_f585cc() { + vec4 res = textureGatherOffset(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), 1.0f, ivec2(0)); +} + +void compute_main() { + textureGatherCompare_f585cc(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGatherCompare/f585cc.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureGatherCompare/f585cc.wgsl.expected.hlsl new file mode 100644 index 0000000000..ba3d6fdb54 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGatherCompare/f585cc.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureGatherCompare_f585cc() { + float4 res = arg_0.GatherCmp(arg_1, float3(0.0f, 0.0f, float(1)), 1.0f, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGatherCompare_f585cc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGatherCompare_f585cc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGatherCompare_f585cc(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGatherCompare/f585cc.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGatherCompare/f585cc.wgsl.expected.msl new file mode 100644 index 0000000000..e6c687e19d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGatherCompare/f585cc.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureGatherCompare_f585cc(depth2d_array tint_symbol_1, sampler tint_symbol_2) { + float4 res = tint_symbol_1.gather_compare(tint_symbol_2, float2(0.0f), 1, 1.0f, int2(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d_array tint_symbol_3, sampler tint_symbol_4) { + textureGatherCompare_f585cc(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGatherCompare_f585cc(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depth2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGatherCompare_f585cc(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureGatherCompare/f585cc.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGatherCompare/f585cc.wgsl.expected.spvasm new file mode 100644 index 0000000000..d52aee2043 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGatherCompare/f585cc.wgsl.expected.spvasm @@ -0,0 +1,88 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 48 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureGatherCompare_f585cc "textureGatherCompare_f585cc" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %22 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 + %float_0 = OpConstant %float 0 + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %float_1 = OpConstant %float 1 + %v2int = OpTypeVector %int 2 + %32 = OpConstantNull %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %35 = OpTypeFunction %v4float +%textureGatherCompare_f585cc = OpFunction %void None %15 + %18 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %20 = OpLoad %14 %arg_1 + %21 = OpLoad %11 %arg_0 + %23 = OpSampledImage %22 %21 %20 + %26 = OpConvertSToF %float %int_1 + %29 = OpCompositeConstruct %v3float %float_0 %float_0 %26 + %19 = OpImageDrefGather %v4float %23 %29 %float_1 ConstOffset %32 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %35 + %37 = OpLabel + %38 = OpFunctionCall %void %textureGatherCompare_f585cc + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %40 = OpLabel + %41 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %41 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %43 = OpLabel + %44 = OpFunctionCall %void %textureGatherCompare_f585cc + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %46 = OpLabel + %47 = OpFunctionCall %void %textureGatherCompare_f585cc + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureGatherCompare/f585cc.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGatherCompare/f585cc.wgsl.expected.wgsl new file mode 100644 index 0000000000..699022ac84 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGatherCompare/f585cc.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d_array; + +@group(1) @binding(1) var arg_1 : sampler_comparison; + +fn textureGatherCompare_f585cc() { + var res : vec4 = textureGatherCompare(arg_0, arg_1, vec2(), 1, 1.0, vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGatherCompare_f585cc(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGatherCompare_f585cc(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGatherCompare_f585cc(); +} diff --git a/test/tint/builtins/gen/literal/textureSample/02aa9b.wgsl b/test/tint/builtins/gen/literal/textureSample/02aa9b.wgsl deleted file mode 100644 index 3175d4d7d9..0000000000 --- a/test/tint/builtins/gen/literal/textureSample/02aa9b.wgsl +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/gen/gen.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_2d_array; -@group(1) @binding(1) var arg_1: sampler; - -// fn textureSample(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, offset: vec2) -> vec4 -fn textureSample_02aa9b() { - var res: vec4 = textureSample(arg_0, arg_1, vec2(), 1, vec2()); -} - -@stage(fragment) -fn fragment_main() { - textureSample_02aa9b(); -} diff --git a/test/tint/builtins/gen/literal/textureSample/02aa9b.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSample/02aa9b.wgsl.expected.glsl deleted file mode 100644 index 8ad0c43b97..0000000000 --- a/test/tint/builtins/gen/literal/textureSample/02aa9b.wgsl.expected.glsl +++ /dev/null @@ -1,17 +0,0 @@ -#version 310 es -precision mediump float; - -uniform highp sampler2DArray arg_0_arg_1; - -void textureSample_02aa9b() { - vec4 res = textureOffset(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), ivec2(0)); -} - -void fragment_main() { - textureSample_02aa9b(); -} - -void main() { - fragment_main(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureSample/02aa9b.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureSample/02aa9b.wgsl.expected.hlsl deleted file mode 100644 index b715586e9b..0000000000 --- a/test/tint/builtins/gen/literal/textureSample/02aa9b.wgsl.expected.hlsl +++ /dev/null @@ -1,11 +0,0 @@ -Texture2DArray arg_0 : register(t0, space1); -SamplerState arg_1 : register(s1, space1); - -void textureSample_02aa9b() { - float4 res = arg_0.Sample(arg_1, float3(0.0f, 0.0f, float(1)), (0).xx); -} - -void fragment_main() { - textureSample_02aa9b(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureSample/02aa9b.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSample/02aa9b.wgsl.expected.msl deleted file mode 100644 index 2a204941c2..0000000000 --- a/test/tint/builtins/gen/literal/textureSample/02aa9b.wgsl.expected.msl +++ /dev/null @@ -1,12 +0,0 @@ -#include - -using namespace metal; -void textureSample_02aa9b(texture2d_array tint_symbol, sampler tint_symbol_1) { - float4 res = tint_symbol.sample(tint_symbol_1, float2(0.0f), 1, int2(0)); -} - -fragment void fragment_main(texture2d_array tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { - textureSample_02aa9b(tint_symbol_2, tint_symbol_3); - return; -} - diff --git a/test/tint/builtins/gen/literal/textureSample/02aa9b.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSample/02aa9b.wgsl.expected.spvasm deleted file mode 100644 index 5a0148c52e..0000000000 --- a/test/tint/builtins/gen/literal/textureSample/02aa9b.wgsl.expected.spvasm +++ /dev/null @@ -1,54 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 32 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %fragment_main "fragment_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpName %arg_0 "arg_0" - OpName %arg_1 "arg_1" - OpName %textureSample_02aa9b "textureSample_02aa9b" - OpName %res "res" - OpName %fragment_main "fragment_main" - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - %float = OpTypeFloat 32 - %3 = OpTypeImage %float 2D 0 1 0 1 Unknown -%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 - %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant - %7 = OpTypeSampler -%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 - %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant - %void = OpTypeVoid - %8 = OpTypeFunction %void - %v4float = OpTypeVector %float 4 - %16 = OpTypeSampledImage %3 - %v3float = OpTypeVector %float 3 - %float_0 = OpConstant %float 0 - %int = OpTypeInt 32 1 - %int_1 = OpConstant %int 1 - %v2int = OpTypeVector %int 2 - %25 = OpConstantNull %v2int -%_ptr_Function_v4float = OpTypePointer Function %v4float - %28 = OpConstantNull %v4float -%textureSample_02aa9b = OpFunction %void None %8 - %11 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %28 - %14 = OpLoad %7 %arg_1 - %15 = OpLoad %3 %arg_0 - %17 = OpSampledImage %16 %15 %14 - %20 = OpConvertSToF %float %int_1 - %23 = OpCompositeConstruct %v3float %float_0 %float_0 %20 - %12 = OpImageSampleImplicitLod %v4float %17 %23 ConstOffset %25 - OpStore %res %12 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %8 - %30 = OpLabel - %31 = OpFunctionCall %void %textureSample_02aa9b - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureSample/02aa9b.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSample/02aa9b.wgsl.expected.wgsl deleted file mode 100644 index 855799167a..0000000000 --- a/test/tint/builtins/gen/literal/textureSample/02aa9b.wgsl.expected.wgsl +++ /dev/null @@ -1,12 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_2d_array; - -@group(1) @binding(1) var arg_1 : sampler; - -fn textureSample_02aa9b() { - var res : vec4 = textureSample(arg_0, arg_1, vec2(), 1, vec2()); -} - -@stage(fragment) -fn fragment_main() { - textureSample_02aa9b(); -} diff --git a/test/tint/builtins/gen/literal/textureSample/0dff6c.wgsl b/test/tint/builtins/gen/literal/textureSample/0dff6c.wgsl new file mode 100644 index 0000000000..f074717c04 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/0dff6c.wgsl @@ -0,0 +1,36 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSample(texture: texture_depth_2d, sampler: sampler, coords: vec2, @const offset: vec2) -> f32 +fn textureSample_0dff6c() { + var res: f32 = textureSample(arg_0, arg_1, vec2(), vec2()); +} + +@stage(fragment) +fn fragment_main() { + textureSample_0dff6c(); +} diff --git a/test/tint/builtins/gen/literal/textureSample/0dff6c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSample/0dff6c.wgsl.expected.glsl new file mode 100644 index 0000000000..f0907928f7 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/0dff6c.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es +precision mediump float; + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureSample_0dff6c() { + float res = textureOffset(arg_0_arg_1, vec3(0.0f, 0.0f, 0.0f), ivec2(0)); +} + +void fragment_main() { + textureSample_0dff6c(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSample/0dff6c.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureSample/0dff6c.wgsl.expected.hlsl new file mode 100644 index 0000000000..5e03f88519 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/0dff6c.wgsl.expected.hlsl @@ -0,0 +1,11 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_0dff6c() { + float res = arg_0.Sample(arg_1, (0.0f).xx, (0).xx).x; +} + +void fragment_main() { + textureSample_0dff6c(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSample/0dff6c.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSample/0dff6c.wgsl.expected.msl new file mode 100644 index 0000000000..ea808aeebb --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/0dff6c.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +void textureSample_0dff6c(depth2d tint_symbol, sampler tint_symbol_1) { + float res = tint_symbol.sample(tint_symbol_1, float2(0.0f), int2(0)); +} + +fragment void fragment_main(depth2d tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSample_0dff6c(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureSample/0dff6c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSample/0dff6c.wgsl.expected.spvasm new file mode 100644 index 0000000000..e5558437d4 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/0dff6c.wgsl.expected.spvasm @@ -0,0 +1,52 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 30 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSample_0dff6c "textureSample_0dff6c" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v4float = OpTypeVector %float 4 + %17 = OpTypeSampledImage %3 + %v2float = OpTypeVector %float 2 + %20 = OpConstantNull %v2float + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %23 = OpConstantNull %v2int +%_ptr_Function_float = OpTypePointer Function %float + %26 = OpConstantNull %float +%textureSample_0dff6c = OpFunction %void None %8 + %11 = OpLabel + %res = OpVariable %_ptr_Function_float Function %26 + %15 = OpLoad %7 %arg_1 + %16 = OpLoad %3 %arg_0 + %18 = OpSampledImage %17 %16 %15 + %13 = OpImageSampleImplicitLod %v4float %18 %20 ConstOffset %23 + %12 = OpCompositeExtract %float %13 0 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %28 = OpLabel + %29 = OpFunctionCall %void %textureSample_0dff6c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureSample/0dff6c.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSample/0dff6c.wgsl.expected.wgsl new file mode 100644 index 0000000000..a6ffe5c618 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/0dff6c.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSample_0dff6c() { + var res : f32 = textureSample(arg_0, arg_1, vec2(), vec2()); +} + +@stage(fragment) +fn fragment_main() { + textureSample_0dff6c(); +} diff --git a/test/tint/builtins/gen/literal/textureSample/100dc0.wgsl b/test/tint/builtins/gen/literal/textureSample/100dc0.wgsl deleted file mode 100644 index 6cc07aa270..0000000000 --- a/test/tint/builtins/gen/literal/textureSample/100dc0.wgsl +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/gen/gen.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_3d; -@group(1) @binding(1) var arg_1: sampler; - -// fn textureSample(texture: texture_3d, sampler: sampler, coords: vec3, offset: vec3) -> vec4 -fn textureSample_100dc0() { - var res: vec4 = textureSample(arg_0, arg_1, vec3(), vec3()); -} - -@stage(fragment) -fn fragment_main() { - textureSample_100dc0(); -} diff --git a/test/tint/builtins/gen/literal/textureSample/100dc0.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSample/100dc0.wgsl.expected.glsl deleted file mode 100644 index 1e3bd9fafc..0000000000 --- a/test/tint/builtins/gen/literal/textureSample/100dc0.wgsl.expected.glsl +++ /dev/null @@ -1,17 +0,0 @@ -#version 310 es -precision mediump float; - -uniform highp sampler3D arg_0_arg_1; - -void textureSample_100dc0() { - vec4 res = textureOffset(arg_0_arg_1, vec3(0.0f), ivec3(0)); -} - -void fragment_main() { - textureSample_100dc0(); -} - -void main() { - fragment_main(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureSample/100dc0.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureSample/100dc0.wgsl.expected.hlsl deleted file mode 100644 index 3b29d557d1..0000000000 --- a/test/tint/builtins/gen/literal/textureSample/100dc0.wgsl.expected.hlsl +++ /dev/null @@ -1,11 +0,0 @@ -Texture3D arg_0 : register(t0, space1); -SamplerState arg_1 : register(s1, space1); - -void textureSample_100dc0() { - float4 res = arg_0.Sample(arg_1, (0.0f).xxx, (0).xxx); -} - -void fragment_main() { - textureSample_100dc0(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureSample/100dc0.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSample/100dc0.wgsl.expected.msl deleted file mode 100644 index 26bfe5f405..0000000000 --- a/test/tint/builtins/gen/literal/textureSample/100dc0.wgsl.expected.msl +++ /dev/null @@ -1,12 +0,0 @@ -#include - -using namespace metal; -void textureSample_100dc0(texture3d tint_symbol, sampler tint_symbol_1) { - float4 res = tint_symbol.sample(tint_symbol_1, float3(0.0f), int3(0)); -} - -fragment void fragment_main(texture3d tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { - textureSample_100dc0(tint_symbol_2, tint_symbol_3); - return; -} - diff --git a/test/tint/builtins/gen/literal/textureSample/100dc0.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSample/100dc0.wgsl.expected.spvasm deleted file mode 100644 index 4639de28d3..0000000000 --- a/test/tint/builtins/gen/literal/textureSample/100dc0.wgsl.expected.spvasm +++ /dev/null @@ -1,51 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 29 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %fragment_main "fragment_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpName %arg_0 "arg_0" - OpName %arg_1 "arg_1" - OpName %textureSample_100dc0 "textureSample_100dc0" - OpName %res "res" - OpName %fragment_main "fragment_main" - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - %float = OpTypeFloat 32 - %3 = OpTypeImage %float 3D 0 0 0 1 Unknown -%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 - %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant - %7 = OpTypeSampler -%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 - %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant - %void = OpTypeVoid - %8 = OpTypeFunction %void - %v4float = OpTypeVector %float 4 - %16 = OpTypeSampledImage %3 - %v3float = OpTypeVector %float 3 - %19 = OpConstantNull %v3float - %int = OpTypeInt 32 1 - %v3int = OpTypeVector %int 3 - %22 = OpConstantNull %v3int -%_ptr_Function_v4float = OpTypePointer Function %v4float - %25 = OpConstantNull %v4float -%textureSample_100dc0 = OpFunction %void None %8 - %11 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %25 - %14 = OpLoad %7 %arg_1 - %15 = OpLoad %3 %arg_0 - %17 = OpSampledImage %16 %15 %14 - %12 = OpImageSampleImplicitLod %v4float %17 %19 ConstOffset %22 - OpStore %res %12 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %8 - %27 = OpLabel - %28 = OpFunctionCall %void %textureSample_100dc0 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureSample/100dc0.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSample/100dc0.wgsl.expected.wgsl deleted file mode 100644 index b972855ab8..0000000000 --- a/test/tint/builtins/gen/literal/textureSample/100dc0.wgsl.expected.wgsl +++ /dev/null @@ -1,12 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_3d; - -@group(1) @binding(1) var arg_1 : sampler; - -fn textureSample_100dc0() { - var res : vec4 = textureSample(arg_0, arg_1, vec3(), vec3()); -} - -@stage(fragment) -fn fragment_main() { - textureSample_100dc0(); -} diff --git a/test/tint/builtins/gen/literal/textureSample/17e988.wgsl b/test/tint/builtins/gen/literal/textureSample/17e988.wgsl new file mode 100644 index 0000000000..8f06bd89c1 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/17e988.wgsl @@ -0,0 +1,36 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSample(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, @const offset: vec2) -> vec4 +fn textureSample_17e988() { + var res: vec4 = textureSample(arg_0, arg_1, vec2(), 1, vec2()); +} + +@stage(fragment) +fn fragment_main() { + textureSample_17e988(); +} diff --git a/test/tint/builtins/gen/literal/textureSample/17e988.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSample/17e988.wgsl.expected.glsl new file mode 100644 index 0000000000..fdfe3c0022 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/17e988.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es +precision mediump float; + +uniform highp sampler2DArray arg_0_arg_1; + +void textureSample_17e988() { + vec4 res = textureOffset(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), ivec2(0)); +} + +void fragment_main() { + textureSample_17e988(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSample/17e988.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureSample/17e988.wgsl.expected.hlsl new file mode 100644 index 0000000000..fc8a980c3c --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/17e988.wgsl.expected.hlsl @@ -0,0 +1,11 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_17e988() { + float4 res = arg_0.Sample(arg_1, float3(0.0f, 0.0f, float(1)), (0).xx); +} + +void fragment_main() { + textureSample_17e988(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSample/17e988.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSample/17e988.wgsl.expected.msl new file mode 100644 index 0000000000..167ac7b683 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/17e988.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +void textureSample_17e988(texture2d_array tint_symbol, sampler tint_symbol_1) { + float4 res = tint_symbol.sample(tint_symbol_1, float2(0.0f), 1, int2(0)); +} + +fragment void fragment_main(texture2d_array tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSample_17e988(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureSample/17e988.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSample/17e988.wgsl.expected.spvasm new file mode 100644 index 0000000000..576ac755e6 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/17e988.wgsl.expected.spvasm @@ -0,0 +1,54 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSample_17e988 "textureSample_17e988" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v4float = OpTypeVector %float 4 + %16 = OpTypeSampledImage %3 + %v3float = OpTypeVector %float 3 + %float_0 = OpConstant %float 0 + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %v2int = OpTypeVector %int 2 + %25 = OpConstantNull %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %28 = OpConstantNull %v4float +%textureSample_17e988 = OpFunction %void None %8 + %11 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %28 + %14 = OpLoad %7 %arg_1 + %15 = OpLoad %3 %arg_0 + %17 = OpSampledImage %16 %15 %14 + %20 = OpConvertSToF %float %int_1 + %23 = OpCompositeConstruct %v3float %float_0 %float_0 %20 + %12 = OpImageSampleImplicitLod %v4float %17 %23 ConstOffset %25 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %30 = OpLabel + %31 = OpFunctionCall %void %textureSample_17e988 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureSample/17e988.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSample/17e988.wgsl.expected.wgsl new file mode 100644 index 0000000000..abdb55df2a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/17e988.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSample_17e988() { + var res : vec4 = textureSample(arg_0, arg_1, vec2(), 1, vec2()); +} + +@stage(fragment) +fn fragment_main() { + textureSample_17e988(); +} diff --git a/test/tint/builtins/gen/literal/textureSample/2149ec.wgsl b/test/tint/builtins/gen/literal/textureSample/2149ec.wgsl new file mode 100644 index 0000000000..82e82e2ae9 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/2149ec.wgsl @@ -0,0 +1,36 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_3d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSample(texture: texture_3d, sampler: sampler, coords: vec3, @const offset: vec3) -> vec4 +fn textureSample_2149ec() { + var res: vec4 = textureSample(arg_0, arg_1, vec3(), vec3()); +} + +@stage(fragment) +fn fragment_main() { + textureSample_2149ec(); +} diff --git a/test/tint/builtins/gen/literal/textureSample/2149ec.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSample/2149ec.wgsl.expected.glsl new file mode 100644 index 0000000000..2592c4f486 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/2149ec.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es +precision mediump float; + +uniform highp sampler3D arg_0_arg_1; + +void textureSample_2149ec() { + vec4 res = textureOffset(arg_0_arg_1, vec3(0.0f), ivec3(0)); +} + +void fragment_main() { + textureSample_2149ec(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSample/2149ec.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureSample/2149ec.wgsl.expected.hlsl new file mode 100644 index 0000000000..137a2ffde4 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/2149ec.wgsl.expected.hlsl @@ -0,0 +1,11 @@ +Texture3D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_2149ec() { + float4 res = arg_0.Sample(arg_1, (0.0f).xxx, (0).xxx); +} + +void fragment_main() { + textureSample_2149ec(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSample/2149ec.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSample/2149ec.wgsl.expected.msl new file mode 100644 index 0000000000..b6ec3094f7 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/2149ec.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +void textureSample_2149ec(texture3d tint_symbol, sampler tint_symbol_1) { + float4 res = tint_symbol.sample(tint_symbol_1, float3(0.0f), int3(0)); +} + +fragment void fragment_main(texture3d tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSample_2149ec(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureSample/2149ec.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSample/2149ec.wgsl.expected.spvasm new file mode 100644 index 0000000000..21ae9c0754 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/2149ec.wgsl.expected.spvasm @@ -0,0 +1,51 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 29 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSample_2149ec "textureSample_2149ec" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 3D 0 0 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v4float = OpTypeVector %float 4 + %16 = OpTypeSampledImage %3 + %v3float = OpTypeVector %float 3 + %19 = OpConstantNull %v3float + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %22 = OpConstantNull %v3int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %25 = OpConstantNull %v4float +%textureSample_2149ec = OpFunction %void None %8 + %11 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %25 + %14 = OpLoad %7 %arg_1 + %15 = OpLoad %3 %arg_0 + %17 = OpSampledImage %16 %15 %14 + %12 = OpImageSampleImplicitLod %v4float %17 %19 ConstOffset %22 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %27 = OpLabel + %28 = OpFunctionCall %void %textureSample_2149ec + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureSample/2149ec.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSample/2149ec.wgsl.expected.wgsl new file mode 100644 index 0000000000..27218fc29a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/2149ec.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +@group(1) @binding(0) var arg_0 : texture_3d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSample_2149ec() { + var res : vec4 = textureSample(arg_0, arg_1, vec3(), vec3()); +} + +@stage(fragment) +fn fragment_main() { + textureSample_2149ec(); +} diff --git a/test/tint/builtins/gen/literal/textureSample/60bf45.wgsl b/test/tint/builtins/gen/literal/textureSample/60bf45.wgsl new file mode 100644 index 0000000000..8aec7bf28b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/60bf45.wgsl @@ -0,0 +1,36 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d_array; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSample(texture: texture_depth_2d_array, sampler: sampler, coords: vec2, array_index: i32, @const offset: vec2) -> f32 +fn textureSample_60bf45() { + var res: f32 = textureSample(arg_0, arg_1, vec2(), 1, vec2()); +} + +@stage(fragment) +fn fragment_main() { + textureSample_60bf45(); +} diff --git a/test/tint/builtins/gen/literal/textureSample/60bf45.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSample/60bf45.wgsl.expected.glsl new file mode 100644 index 0000000000..ea3660f788 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/60bf45.wgsl.expected.glsl @@ -0,0 +1,26 @@ +SKIP: FAILED + +#version 310 es +precision mediump float; + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureSample_60bf45() { + float res = textureOffset(arg_0_arg_1, vec4(0.0f, 0.0f, float(1), 0.0f), ivec2(0)); +} + +void fragment_main() { + textureSample_60bf45(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:7: 'sampler' : TextureOffset does not support sampler2DArrayShadow : ES Profile +ERROR: 0:7: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureSample/60bf45.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureSample/60bf45.wgsl.expected.hlsl new file mode 100644 index 0000000000..0575d77871 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/60bf45.wgsl.expected.hlsl @@ -0,0 +1,11 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_60bf45() { + float res = arg_0.Sample(arg_1, float3(0.0f, 0.0f, float(1)), (0).xx).x; +} + +void fragment_main() { + textureSample_60bf45(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSample/60bf45.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSample/60bf45.wgsl.expected.msl new file mode 100644 index 0000000000..20593cef53 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/60bf45.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +void textureSample_60bf45(depth2d_array tint_symbol, sampler tint_symbol_1) { + float res = tint_symbol.sample(tint_symbol_1, float2(0.0f), 1, int2(0)); +} + +fragment void fragment_main(depth2d_array tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSample_60bf45(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureSample/60bf45.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSample/60bf45.wgsl.expected.spvasm new file mode 100644 index 0000000000..966d12da82 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/60bf45.wgsl.expected.spvasm @@ -0,0 +1,55 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSample_60bf45 "textureSample_60bf45" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v4float = OpTypeVector %float 4 + %17 = OpTypeSampledImage %3 + %v3float = OpTypeVector %float 3 + %float_0 = OpConstant %float 0 + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %v2int = OpTypeVector %int 2 + %26 = OpConstantNull %v2int +%_ptr_Function_float = OpTypePointer Function %float + %29 = OpConstantNull %float +%textureSample_60bf45 = OpFunction %void None %8 + %11 = OpLabel + %res = OpVariable %_ptr_Function_float Function %29 + %15 = OpLoad %7 %arg_1 + %16 = OpLoad %3 %arg_0 + %18 = OpSampledImage %17 %16 %15 + %21 = OpConvertSToF %float %int_1 + %24 = OpCompositeConstruct %v3float %float_0 %float_0 %21 + %13 = OpImageSampleImplicitLod %v4float %18 %24 ConstOffset %26 + %12 = OpCompositeExtract %float %13 0 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %31 = OpLabel + %32 = OpFunctionCall %void %textureSample_60bf45 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureSample/60bf45.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSample/60bf45.wgsl.expected.wgsl new file mode 100644 index 0000000000..9ed1c97fde --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/60bf45.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d_array; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSample_60bf45() { + var res : f32 = textureSample(arg_0, arg_1, vec2(), 1, vec2()); +} + +@stage(fragment) +fn fragment_main() { + textureSample_60bf45(); +} diff --git a/test/tint/builtins/gen/literal/textureSample/667d76.wgsl b/test/tint/builtins/gen/literal/textureSample/667d76.wgsl deleted file mode 100644 index d218e9dbdf..0000000000 --- a/test/tint/builtins/gen/literal/textureSample/667d76.wgsl +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/gen/gen.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_depth_2d; -@group(1) @binding(1) var arg_1: sampler; - -// fn textureSample(texture: texture_depth_2d, sampler: sampler, coords: vec2, offset: vec2) -> f32 -fn textureSample_667d76() { - var res: f32 = textureSample(arg_0, arg_1, vec2(), vec2()); -} - -@stage(fragment) -fn fragment_main() { - textureSample_667d76(); -} diff --git a/test/tint/builtins/gen/literal/textureSample/667d76.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSample/667d76.wgsl.expected.glsl deleted file mode 100644 index 789acf24e8..0000000000 --- a/test/tint/builtins/gen/literal/textureSample/667d76.wgsl.expected.glsl +++ /dev/null @@ -1,17 +0,0 @@ -#version 310 es -precision mediump float; - -uniform highp sampler2DShadow arg_0_arg_1; - -void textureSample_667d76() { - float res = textureOffset(arg_0_arg_1, vec3(0.0f, 0.0f, 0.0f), ivec2(0)); -} - -void fragment_main() { - textureSample_667d76(); -} - -void main() { - fragment_main(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureSample/667d76.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureSample/667d76.wgsl.expected.hlsl deleted file mode 100644 index 8742386930..0000000000 --- a/test/tint/builtins/gen/literal/textureSample/667d76.wgsl.expected.hlsl +++ /dev/null @@ -1,11 +0,0 @@ -Texture2D arg_0 : register(t0, space1); -SamplerState arg_1 : register(s1, space1); - -void textureSample_667d76() { - float res = arg_0.Sample(arg_1, (0.0f).xx, (0).xx).x; -} - -void fragment_main() { - textureSample_667d76(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureSample/667d76.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSample/667d76.wgsl.expected.msl deleted file mode 100644 index 79c7382bd8..0000000000 --- a/test/tint/builtins/gen/literal/textureSample/667d76.wgsl.expected.msl +++ /dev/null @@ -1,12 +0,0 @@ -#include - -using namespace metal; -void textureSample_667d76(depth2d tint_symbol, sampler tint_symbol_1) { - float res = tint_symbol.sample(tint_symbol_1, float2(0.0f), int2(0)); -} - -fragment void fragment_main(depth2d tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { - textureSample_667d76(tint_symbol_2, tint_symbol_3); - return; -} - diff --git a/test/tint/builtins/gen/literal/textureSample/667d76.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSample/667d76.wgsl.expected.spvasm deleted file mode 100644 index 51d8c51396..0000000000 --- a/test/tint/builtins/gen/literal/textureSample/667d76.wgsl.expected.spvasm +++ /dev/null @@ -1,52 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 30 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %fragment_main "fragment_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpName %arg_0 "arg_0" - OpName %arg_1 "arg_1" - OpName %textureSample_667d76 "textureSample_667d76" - OpName %res "res" - OpName %fragment_main "fragment_main" - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - %float = OpTypeFloat 32 - %3 = OpTypeImage %float 2D 0 0 0 1 Unknown -%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 - %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant - %7 = OpTypeSampler -%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 - %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant - %void = OpTypeVoid - %8 = OpTypeFunction %void - %v4float = OpTypeVector %float 4 - %17 = OpTypeSampledImage %3 - %v2float = OpTypeVector %float 2 - %20 = OpConstantNull %v2float - %int = OpTypeInt 32 1 - %v2int = OpTypeVector %int 2 - %23 = OpConstantNull %v2int -%_ptr_Function_float = OpTypePointer Function %float - %26 = OpConstantNull %float -%textureSample_667d76 = OpFunction %void None %8 - %11 = OpLabel - %res = OpVariable %_ptr_Function_float Function %26 - %15 = OpLoad %7 %arg_1 - %16 = OpLoad %3 %arg_0 - %18 = OpSampledImage %17 %16 %15 - %13 = OpImageSampleImplicitLod %v4float %18 %20 ConstOffset %23 - %12 = OpCompositeExtract %float %13 0 - OpStore %res %12 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %8 - %28 = OpLabel - %29 = OpFunctionCall %void %textureSample_667d76 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureSample/667d76.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSample/667d76.wgsl.expected.wgsl deleted file mode 100644 index d541431fc6..0000000000 --- a/test/tint/builtins/gen/literal/textureSample/667d76.wgsl.expected.wgsl +++ /dev/null @@ -1,12 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_depth_2d; - -@group(1) @binding(1) var arg_1 : sampler; - -fn textureSample_667d76() { - var res : f32 = textureSample(arg_0, arg_1, vec2(), vec2()); -} - -@stage(fragment) -fn fragment_main() { - textureSample_667d76(); -} diff --git a/test/tint/builtins/gen/literal/textureSample/7c3baa.wgsl b/test/tint/builtins/gen/literal/textureSample/7c3baa.wgsl deleted file mode 100644 index 534d9ab492..0000000000 --- a/test/tint/builtins/gen/literal/textureSample/7c3baa.wgsl +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/gen/gen.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_2d; -@group(1) @binding(1) var arg_1: sampler; - -// fn textureSample(texture: texture_2d, sampler: sampler, coords: vec2, offset: vec2) -> vec4 -fn textureSample_7c3baa() { - var res: vec4 = textureSample(arg_0, arg_1, vec2(), vec2()); -} - -@stage(fragment) -fn fragment_main() { - textureSample_7c3baa(); -} diff --git a/test/tint/builtins/gen/literal/textureSample/7c3baa.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSample/7c3baa.wgsl.expected.glsl deleted file mode 100644 index 0e307d3405..0000000000 --- a/test/tint/builtins/gen/literal/textureSample/7c3baa.wgsl.expected.glsl +++ /dev/null @@ -1,17 +0,0 @@ -#version 310 es -precision mediump float; - -uniform highp sampler2D arg_0_arg_1; - -void textureSample_7c3baa() { - vec4 res = textureOffset(arg_0_arg_1, vec2(0.0f), ivec2(0)); -} - -void fragment_main() { - textureSample_7c3baa(); -} - -void main() { - fragment_main(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureSample/7c3baa.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureSample/7c3baa.wgsl.expected.hlsl deleted file mode 100644 index 8a8cb37dd5..0000000000 --- a/test/tint/builtins/gen/literal/textureSample/7c3baa.wgsl.expected.hlsl +++ /dev/null @@ -1,11 +0,0 @@ -Texture2D arg_0 : register(t0, space1); -SamplerState arg_1 : register(s1, space1); - -void textureSample_7c3baa() { - float4 res = arg_0.Sample(arg_1, (0.0f).xx, (0).xx); -} - -void fragment_main() { - textureSample_7c3baa(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureSample/7c3baa.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSample/7c3baa.wgsl.expected.msl deleted file mode 100644 index a3b9549831..0000000000 --- a/test/tint/builtins/gen/literal/textureSample/7c3baa.wgsl.expected.msl +++ /dev/null @@ -1,12 +0,0 @@ -#include - -using namespace metal; -void textureSample_7c3baa(texture2d tint_symbol, sampler tint_symbol_1) { - float4 res = tint_symbol.sample(tint_symbol_1, float2(0.0f), int2(0)); -} - -fragment void fragment_main(texture2d tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { - textureSample_7c3baa(tint_symbol_2, tint_symbol_3); - return; -} - diff --git a/test/tint/builtins/gen/literal/textureSample/7c3baa.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSample/7c3baa.wgsl.expected.spvasm deleted file mode 100644 index fcc0c5194d..0000000000 --- a/test/tint/builtins/gen/literal/textureSample/7c3baa.wgsl.expected.spvasm +++ /dev/null @@ -1,51 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 29 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %fragment_main "fragment_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpName %arg_0 "arg_0" - OpName %arg_1 "arg_1" - OpName %textureSample_7c3baa "textureSample_7c3baa" - OpName %res "res" - OpName %fragment_main "fragment_main" - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - %float = OpTypeFloat 32 - %3 = OpTypeImage %float 2D 0 0 0 1 Unknown -%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 - %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant - %7 = OpTypeSampler -%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 - %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant - %void = OpTypeVoid - %8 = OpTypeFunction %void - %v4float = OpTypeVector %float 4 - %16 = OpTypeSampledImage %3 - %v2float = OpTypeVector %float 2 - %19 = OpConstantNull %v2float - %int = OpTypeInt 32 1 - %v2int = OpTypeVector %int 2 - %22 = OpConstantNull %v2int -%_ptr_Function_v4float = OpTypePointer Function %v4float - %25 = OpConstantNull %v4float -%textureSample_7c3baa = OpFunction %void None %8 - %11 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %25 - %14 = OpLoad %7 %arg_1 - %15 = OpLoad %3 %arg_0 - %17 = OpSampledImage %16 %15 %14 - %12 = OpImageSampleImplicitLod %v4float %17 %19 ConstOffset %22 - OpStore %res %12 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %8 - %27 = OpLabel - %28 = OpFunctionCall %void %textureSample_7c3baa - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureSample/7c3baa.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSample/7c3baa.wgsl.expected.wgsl deleted file mode 100644 index f4105d88d3..0000000000 --- a/test/tint/builtins/gen/literal/textureSample/7c3baa.wgsl.expected.wgsl +++ /dev/null @@ -1,12 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_2d; - -@group(1) @binding(1) var arg_1 : sampler; - -fn textureSample_7c3baa() { - var res : vec4 = textureSample(arg_0, arg_1, vec2(), vec2()); -} - -@stage(fragment) -fn fragment_main() { - textureSample_7c3baa(); -} diff --git a/test/tint/builtins/gen/literal/textureSample/8522e7.wgsl b/test/tint/builtins/gen/literal/textureSample/8522e7.wgsl deleted file mode 100644 index 8cad6933f6..0000000000 --- a/test/tint/builtins/gen/literal/textureSample/8522e7.wgsl +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/gen/gen.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_depth_2d_array; -@group(1) @binding(1) var arg_1: sampler; - -// fn textureSample(texture: texture_depth_2d_array, sampler: sampler, coords: vec2, array_index: i32, offset: vec2) -> f32 -fn textureSample_8522e7() { - var res: f32 = textureSample(arg_0, arg_1, vec2(), 1, vec2()); -} - -@stage(fragment) -fn fragment_main() { - textureSample_8522e7(); -} diff --git a/test/tint/builtins/gen/literal/textureSample/8522e7.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSample/8522e7.wgsl.expected.glsl deleted file mode 100644 index d0c988b4e1..0000000000 --- a/test/tint/builtins/gen/literal/textureSample/8522e7.wgsl.expected.glsl +++ /dev/null @@ -1,26 +0,0 @@ -SKIP: FAILED - -#version 310 es -precision mediump float; - -uniform highp sampler2DArrayShadow arg_0_arg_1; - -void textureSample_8522e7() { - float res = textureOffset(arg_0_arg_1, vec4(0.0f, 0.0f, float(1), 0.0f), ivec2(0)); -} - -void fragment_main() { - textureSample_8522e7(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:7: 'sampler' : TextureOffset does not support sampler2DArrayShadow : ES Profile -ERROR: 0:7: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/literal/textureSample/8522e7.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureSample/8522e7.wgsl.expected.hlsl deleted file mode 100644 index d5360c8638..0000000000 --- a/test/tint/builtins/gen/literal/textureSample/8522e7.wgsl.expected.hlsl +++ /dev/null @@ -1,11 +0,0 @@ -Texture2DArray arg_0 : register(t0, space1); -SamplerState arg_1 : register(s1, space1); - -void textureSample_8522e7() { - float res = arg_0.Sample(arg_1, float3(0.0f, 0.0f, float(1)), (0).xx).x; -} - -void fragment_main() { - textureSample_8522e7(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureSample/8522e7.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSample/8522e7.wgsl.expected.msl deleted file mode 100644 index f2d9eebf41..0000000000 --- a/test/tint/builtins/gen/literal/textureSample/8522e7.wgsl.expected.msl +++ /dev/null @@ -1,12 +0,0 @@ -#include - -using namespace metal; -void textureSample_8522e7(depth2d_array tint_symbol, sampler tint_symbol_1) { - float res = tint_symbol.sample(tint_symbol_1, float2(0.0f), 1, int2(0)); -} - -fragment void fragment_main(depth2d_array tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { - textureSample_8522e7(tint_symbol_2, tint_symbol_3); - return; -} - diff --git a/test/tint/builtins/gen/literal/textureSample/8522e7.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSample/8522e7.wgsl.expected.spvasm deleted file mode 100644 index 4a1400c1f4..0000000000 --- a/test/tint/builtins/gen/literal/textureSample/8522e7.wgsl.expected.spvasm +++ /dev/null @@ -1,55 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %fragment_main "fragment_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpName %arg_0 "arg_0" - OpName %arg_1 "arg_1" - OpName %textureSample_8522e7 "textureSample_8522e7" - OpName %res "res" - OpName %fragment_main "fragment_main" - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - %float = OpTypeFloat 32 - %3 = OpTypeImage %float 2D 0 1 0 1 Unknown -%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 - %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant - %7 = OpTypeSampler -%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 - %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant - %void = OpTypeVoid - %8 = OpTypeFunction %void - %v4float = OpTypeVector %float 4 - %17 = OpTypeSampledImage %3 - %v3float = OpTypeVector %float 3 - %float_0 = OpConstant %float 0 - %int = OpTypeInt 32 1 - %int_1 = OpConstant %int 1 - %v2int = OpTypeVector %int 2 - %26 = OpConstantNull %v2int -%_ptr_Function_float = OpTypePointer Function %float - %29 = OpConstantNull %float -%textureSample_8522e7 = OpFunction %void None %8 - %11 = OpLabel - %res = OpVariable %_ptr_Function_float Function %29 - %15 = OpLoad %7 %arg_1 - %16 = OpLoad %3 %arg_0 - %18 = OpSampledImage %17 %16 %15 - %21 = OpConvertSToF %float %int_1 - %24 = OpCompositeConstruct %v3float %float_0 %float_0 %21 - %13 = OpImageSampleImplicitLod %v4float %18 %24 ConstOffset %26 - %12 = OpCompositeExtract %float %13 0 - OpStore %res %12 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %8 - %31 = OpLabel - %32 = OpFunctionCall %void %textureSample_8522e7 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureSample/8522e7.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSample/8522e7.wgsl.expected.wgsl deleted file mode 100644 index a3d93c8f81..0000000000 --- a/test/tint/builtins/gen/literal/textureSample/8522e7.wgsl.expected.wgsl +++ /dev/null @@ -1,12 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_depth_2d_array; - -@group(1) @binding(1) var arg_1 : sampler; - -fn textureSample_8522e7() { - var res : f32 = textureSample(arg_0, arg_1, vec2(), 1, vec2()); -} - -@stage(fragment) -fn fragment_main() { - textureSample_8522e7(); -} diff --git a/test/tint/builtins/gen/literal/textureSample/85c4ba.wgsl b/test/tint/builtins/gen/literal/textureSample/85c4ba.wgsl new file mode 100644 index 0000000000..42d5c40636 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/85c4ba.wgsl @@ -0,0 +1,36 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSample(texture: texture_2d, sampler: sampler, coords: vec2, @const offset: vec2) -> vec4 +fn textureSample_85c4ba() { + var res: vec4 = textureSample(arg_0, arg_1, vec2(), vec2()); +} + +@stage(fragment) +fn fragment_main() { + textureSample_85c4ba(); +} diff --git a/test/tint/builtins/gen/literal/textureSample/85c4ba.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSample/85c4ba.wgsl.expected.glsl new file mode 100644 index 0000000000..9c7c7b3e46 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/85c4ba.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es +precision mediump float; + +uniform highp sampler2D arg_0_arg_1; + +void textureSample_85c4ba() { + vec4 res = textureOffset(arg_0_arg_1, vec2(0.0f), ivec2(0)); +} + +void fragment_main() { + textureSample_85c4ba(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSample/85c4ba.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureSample/85c4ba.wgsl.expected.hlsl new file mode 100644 index 0000000000..f43541cd7f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/85c4ba.wgsl.expected.hlsl @@ -0,0 +1,11 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_85c4ba() { + float4 res = arg_0.Sample(arg_1, (0.0f).xx, (0).xx); +} + +void fragment_main() { + textureSample_85c4ba(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSample/85c4ba.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSample/85c4ba.wgsl.expected.msl new file mode 100644 index 0000000000..50844e38bc --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/85c4ba.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +void textureSample_85c4ba(texture2d tint_symbol, sampler tint_symbol_1) { + float4 res = tint_symbol.sample(tint_symbol_1, float2(0.0f), int2(0)); +} + +fragment void fragment_main(texture2d tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSample_85c4ba(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureSample/85c4ba.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSample/85c4ba.wgsl.expected.spvasm new file mode 100644 index 0000000000..17a25fce30 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/85c4ba.wgsl.expected.spvasm @@ -0,0 +1,51 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 29 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSample_85c4ba "textureSample_85c4ba" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v4float = OpTypeVector %float 4 + %16 = OpTypeSampledImage %3 + %v2float = OpTypeVector %float 2 + %19 = OpConstantNull %v2float + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %22 = OpConstantNull %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %25 = OpConstantNull %v4float +%textureSample_85c4ba = OpFunction %void None %8 + %11 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %25 + %14 = OpLoad %7 %arg_1 + %15 = OpLoad %3 %arg_0 + %17 = OpSampledImage %16 %15 %14 + %12 = OpImageSampleImplicitLod %v4float %17 %19 ConstOffset %22 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %27 = OpLabel + %28 = OpFunctionCall %void %textureSample_85c4ba + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureSample/85c4ba.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSample/85c4ba.wgsl.expected.wgsl new file mode 100644 index 0000000000..976bb581ed --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/85c4ba.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +@group(1) @binding(0) var arg_0 : texture_2d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSample_85c4ba() { + var res : vec4 = textureSample(arg_0, arg_1, vec2(), vec2()); +} + +@stage(fragment) +fn fragment_main() { + textureSample_85c4ba(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleBias/594824.wgsl b/test/tint/builtins/gen/literal/textureSampleBias/594824.wgsl new file mode 100644 index 0000000000..b7d25eb8ee --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleBias/594824.wgsl @@ -0,0 +1,36 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_3d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleBias(texture: texture_3d, sampler: sampler, coords: vec3, bias: f32, @const offset: vec3) -> vec4 +fn textureSampleBias_594824() { + var res: vec4 = textureSampleBias(arg_0, arg_1, vec3(), 1.0, vec3()); +} + +@stage(fragment) +fn fragment_main() { + textureSampleBias_594824(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleBias/594824.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleBias/594824.wgsl.expected.glsl new file mode 100644 index 0000000000..e524a8d191 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleBias/594824.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es +precision mediump float; + +uniform highp sampler3D arg_0_arg_1; + +void textureSampleBias_594824() { + vec4 res = textureOffset(arg_0_arg_1, vec3(0.0f), ivec3(0), 1.0f); +} + +void fragment_main() { + textureSampleBias_594824(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleBias/594824.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureSampleBias/594824.wgsl.expected.hlsl new file mode 100644 index 0000000000..8ebc0016bd --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleBias/594824.wgsl.expected.hlsl @@ -0,0 +1,11 @@ +Texture3D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleBias_594824() { + float4 res = arg_0.SampleBias(arg_1, (0.0f).xxx, 1.0f, (0).xxx); +} + +void fragment_main() { + textureSampleBias_594824(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleBias/594824.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleBias/594824.wgsl.expected.msl new file mode 100644 index 0000000000..193009e0a6 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleBias/594824.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +void textureSampleBias_594824(texture3d tint_symbol, sampler tint_symbol_1) { + float4 res = tint_symbol.sample(tint_symbol_1, float3(0.0f), bias(1.0f), int3(0)); +} + +fragment void fragment_main(texture3d tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSampleBias_594824(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureSampleBias/594824.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleBias/594824.wgsl.expected.spvasm new file mode 100644 index 0000000000..4cc39b2a05 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleBias/594824.wgsl.expected.spvasm @@ -0,0 +1,52 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 30 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleBias_594824 "textureSampleBias_594824" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 3D 0 0 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v4float = OpTypeVector %float 4 + %16 = OpTypeSampledImage %3 + %v3float = OpTypeVector %float 3 + %19 = OpConstantNull %v3float + %float_1 = OpConstant %float 1 + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %23 = OpConstantNull %v3int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %26 = OpConstantNull %v4float +%textureSampleBias_594824 = OpFunction %void None %8 + %11 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %26 + %14 = OpLoad %7 %arg_1 + %15 = OpLoad %3 %arg_0 + %17 = OpSampledImage %16 %15 %14 + %12 = OpImageSampleImplicitLod %v4float %17 %19 Bias|ConstOffset %float_1 %23 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %28 = OpLabel + %29 = OpFunctionCall %void %textureSampleBias_594824 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureSampleBias/594824.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleBias/594824.wgsl.expected.wgsl new file mode 100644 index 0000000000..491105c20a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleBias/594824.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +@group(1) @binding(0) var arg_0 : texture_3d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleBias_594824() { + var res : vec4 = textureSampleBias(arg_0, arg_1, vec3(), 1.0, vec3()); +} + +@stage(fragment) +fn fragment_main() { + textureSampleBias_594824(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleBias/65ac50.wgsl b/test/tint/builtins/gen/literal/textureSampleBias/65ac50.wgsl deleted file mode 100644 index c4d3ee0561..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleBias/65ac50.wgsl +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/gen/gen.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_2d_array; -@group(1) @binding(1) var arg_1: sampler; - -// fn textureSampleBias(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, bias: f32, offset: vec2) -> vec4 -fn textureSampleBias_65ac50() { - var res: vec4 = textureSampleBias(arg_0, arg_1, vec2(), 1, 1.0, vec2()); -} - -@stage(fragment) -fn fragment_main() { - textureSampleBias_65ac50(); -} diff --git a/test/tint/builtins/gen/literal/textureSampleBias/65ac50.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleBias/65ac50.wgsl.expected.glsl deleted file mode 100644 index eea7a09f96..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleBias/65ac50.wgsl.expected.glsl +++ /dev/null @@ -1,17 +0,0 @@ -#version 310 es -precision mediump float; - -uniform highp sampler2DArray arg_0_arg_1; - -void textureSampleBias_65ac50() { - vec4 res = textureOffset(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), ivec2(0), 1.0f); -} - -void fragment_main() { - textureSampleBias_65ac50(); -} - -void main() { - fragment_main(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureSampleBias/65ac50.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureSampleBias/65ac50.wgsl.expected.hlsl deleted file mode 100644 index 801d763276..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleBias/65ac50.wgsl.expected.hlsl +++ /dev/null @@ -1,11 +0,0 @@ -Texture2DArray arg_0 : register(t0, space1); -SamplerState arg_1 : register(s1, space1); - -void textureSampleBias_65ac50() { - float4 res = arg_0.SampleBias(arg_1, float3(0.0f, 0.0f, float(1)), 1.0f, (0).xx); -} - -void fragment_main() { - textureSampleBias_65ac50(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureSampleBias/65ac50.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleBias/65ac50.wgsl.expected.msl deleted file mode 100644 index 34cf4c8526..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleBias/65ac50.wgsl.expected.msl +++ /dev/null @@ -1,12 +0,0 @@ -#include - -using namespace metal; -void textureSampleBias_65ac50(texture2d_array tint_symbol, sampler tint_symbol_1) { - float4 res = tint_symbol.sample(tint_symbol_1, float2(0.0f), 1, bias(1.0f), int2(0)); -} - -fragment void fragment_main(texture2d_array tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { - textureSampleBias_65ac50(tint_symbol_2, tint_symbol_3); - return; -} - diff --git a/test/tint/builtins/gen/literal/textureSampleBias/65ac50.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleBias/65ac50.wgsl.expected.spvasm deleted file mode 100644 index 9b83b1fa82..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleBias/65ac50.wgsl.expected.spvasm +++ /dev/null @@ -1,55 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %fragment_main "fragment_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpName %arg_0 "arg_0" - OpName %arg_1 "arg_1" - OpName %textureSampleBias_65ac50 "textureSampleBias_65ac50" - OpName %res "res" - OpName %fragment_main "fragment_main" - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - %float = OpTypeFloat 32 - %3 = OpTypeImage %float 2D 0 1 0 1 Unknown -%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 - %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant - %7 = OpTypeSampler -%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 - %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant - %void = OpTypeVoid - %8 = OpTypeFunction %void - %v4float = OpTypeVector %float 4 - %16 = OpTypeSampledImage %3 - %v3float = OpTypeVector %float 3 - %float_0 = OpConstant %float 0 - %int = OpTypeInt 32 1 - %int_1 = OpConstant %int 1 - %float_1 = OpConstant %float 1 - %v2int = OpTypeVector %int 2 - %26 = OpConstantNull %v2int -%_ptr_Function_v4float = OpTypePointer Function %v4float - %29 = OpConstantNull %v4float -%textureSampleBias_65ac50 = OpFunction %void None %8 - %11 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %29 - %14 = OpLoad %7 %arg_1 - %15 = OpLoad %3 %arg_0 - %17 = OpSampledImage %16 %15 %14 - %20 = OpConvertSToF %float %int_1 - %23 = OpCompositeConstruct %v3float %float_0 %float_0 %20 - %12 = OpImageSampleImplicitLod %v4float %17 %23 Bias|ConstOffset %float_1 %26 - OpStore %res %12 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %8 - %31 = OpLabel - %32 = OpFunctionCall %void %textureSampleBias_65ac50 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureSampleBias/65ac50.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleBias/65ac50.wgsl.expected.wgsl deleted file mode 100644 index ca8e190b66..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleBias/65ac50.wgsl.expected.wgsl +++ /dev/null @@ -1,12 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_2d_array; - -@group(1) @binding(1) var arg_1 : sampler; - -fn textureSampleBias_65ac50() { - var res : vec4 = textureSampleBias(arg_0, arg_1, vec2(), 1, 1.0, vec2()); -} - -@stage(fragment) -fn fragment_main() { - textureSampleBias_65ac50(); -} diff --git a/test/tint/builtins/gen/literal/textureSampleBias/81c19a.wgsl b/test/tint/builtins/gen/literal/textureSampleBias/81c19a.wgsl deleted file mode 100644 index 1e615ca56c..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleBias/81c19a.wgsl +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/gen/gen.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_2d; -@group(1) @binding(1) var arg_1: sampler; - -// fn textureSampleBias(texture: texture_2d, sampler: sampler, coords: vec2, bias: f32, offset: vec2) -> vec4 -fn textureSampleBias_81c19a() { - var res: vec4 = textureSampleBias(arg_0, arg_1, vec2(), 1.0, vec2()); -} - -@stage(fragment) -fn fragment_main() { - textureSampleBias_81c19a(); -} diff --git a/test/tint/builtins/gen/literal/textureSampleBias/81c19a.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleBias/81c19a.wgsl.expected.glsl deleted file mode 100644 index 00e0fe34d1..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleBias/81c19a.wgsl.expected.glsl +++ /dev/null @@ -1,17 +0,0 @@ -#version 310 es -precision mediump float; - -uniform highp sampler2D arg_0_arg_1; - -void textureSampleBias_81c19a() { - vec4 res = textureOffset(arg_0_arg_1, vec2(0.0f), ivec2(0), 1.0f); -} - -void fragment_main() { - textureSampleBias_81c19a(); -} - -void main() { - fragment_main(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureSampleBias/81c19a.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureSampleBias/81c19a.wgsl.expected.hlsl deleted file mode 100644 index d97b17a4dc..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleBias/81c19a.wgsl.expected.hlsl +++ /dev/null @@ -1,11 +0,0 @@ -Texture2D arg_0 : register(t0, space1); -SamplerState arg_1 : register(s1, space1); - -void textureSampleBias_81c19a() { - float4 res = arg_0.SampleBias(arg_1, (0.0f).xx, 1.0f, (0).xx); -} - -void fragment_main() { - textureSampleBias_81c19a(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureSampleBias/81c19a.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleBias/81c19a.wgsl.expected.msl deleted file mode 100644 index f51dcbfcb6..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleBias/81c19a.wgsl.expected.msl +++ /dev/null @@ -1,12 +0,0 @@ -#include - -using namespace metal; -void textureSampleBias_81c19a(texture2d tint_symbol, sampler tint_symbol_1) { - float4 res = tint_symbol.sample(tint_symbol_1, float2(0.0f), bias(1.0f), int2(0)); -} - -fragment void fragment_main(texture2d tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { - textureSampleBias_81c19a(tint_symbol_2, tint_symbol_3); - return; -} - diff --git a/test/tint/builtins/gen/literal/textureSampleBias/81c19a.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleBias/81c19a.wgsl.expected.spvasm deleted file mode 100644 index 84424e35ec..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleBias/81c19a.wgsl.expected.spvasm +++ /dev/null @@ -1,52 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 30 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %fragment_main "fragment_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpName %arg_0 "arg_0" - OpName %arg_1 "arg_1" - OpName %textureSampleBias_81c19a "textureSampleBias_81c19a" - OpName %res "res" - OpName %fragment_main "fragment_main" - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - %float = OpTypeFloat 32 - %3 = OpTypeImage %float 2D 0 0 0 1 Unknown -%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 - %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant - %7 = OpTypeSampler -%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 - %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant - %void = OpTypeVoid - %8 = OpTypeFunction %void - %v4float = OpTypeVector %float 4 - %16 = OpTypeSampledImage %3 - %v2float = OpTypeVector %float 2 - %19 = OpConstantNull %v2float - %float_1 = OpConstant %float 1 - %int = OpTypeInt 32 1 - %v2int = OpTypeVector %int 2 - %23 = OpConstantNull %v2int -%_ptr_Function_v4float = OpTypePointer Function %v4float - %26 = OpConstantNull %v4float -%textureSampleBias_81c19a = OpFunction %void None %8 - %11 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %26 - %14 = OpLoad %7 %arg_1 - %15 = OpLoad %3 %arg_0 - %17 = OpSampledImage %16 %15 %14 - %12 = OpImageSampleImplicitLod %v4float %17 %19 Bias|ConstOffset %float_1 %23 - OpStore %res %12 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %8 - %28 = OpLabel - %29 = OpFunctionCall %void %textureSampleBias_81c19a - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureSampleBias/81c19a.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleBias/81c19a.wgsl.expected.wgsl deleted file mode 100644 index 2719198c9e..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleBias/81c19a.wgsl.expected.wgsl +++ /dev/null @@ -1,12 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_2d; - -@group(1) @binding(1) var arg_1 : sampler; - -fn textureSampleBias_81c19a() { - var res : vec4 = textureSampleBias(arg_0, arg_1, vec2(), 1.0, vec2()); -} - -@stage(fragment) -fn fragment_main() { - textureSampleBias_81c19a(); -} diff --git a/test/tint/builtins/gen/literal/textureSampleBias/9dbb51.wgsl b/test/tint/builtins/gen/literal/textureSampleBias/9dbb51.wgsl new file mode 100644 index 0000000000..15bc1ca883 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleBias/9dbb51.wgsl @@ -0,0 +1,36 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleBias(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, bias: f32, @const offset: vec2) -> vec4 +fn textureSampleBias_9dbb51() { + var res: vec4 = textureSampleBias(arg_0, arg_1, vec2(), 1, 1.0, vec2()); +} + +@stage(fragment) +fn fragment_main() { + textureSampleBias_9dbb51(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleBias/9dbb51.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleBias/9dbb51.wgsl.expected.glsl new file mode 100644 index 0000000000..9f316abb23 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleBias/9dbb51.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es +precision mediump float; + +uniform highp sampler2DArray arg_0_arg_1; + +void textureSampleBias_9dbb51() { + vec4 res = textureOffset(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), ivec2(0), 1.0f); +} + +void fragment_main() { + textureSampleBias_9dbb51(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleBias/9dbb51.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureSampleBias/9dbb51.wgsl.expected.hlsl new file mode 100644 index 0000000000..bc8a5cd3d6 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleBias/9dbb51.wgsl.expected.hlsl @@ -0,0 +1,11 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleBias_9dbb51() { + float4 res = arg_0.SampleBias(arg_1, float3(0.0f, 0.0f, float(1)), 1.0f, (0).xx); +} + +void fragment_main() { + textureSampleBias_9dbb51(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleBias/9dbb51.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleBias/9dbb51.wgsl.expected.msl new file mode 100644 index 0000000000..9958fb10b2 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleBias/9dbb51.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +void textureSampleBias_9dbb51(texture2d_array tint_symbol, sampler tint_symbol_1) { + float4 res = tint_symbol.sample(tint_symbol_1, float2(0.0f), 1, bias(1.0f), int2(0)); +} + +fragment void fragment_main(texture2d_array tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSampleBias_9dbb51(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureSampleBias/9dbb51.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleBias/9dbb51.wgsl.expected.spvasm new file mode 100644 index 0000000000..f7bcac5432 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleBias/9dbb51.wgsl.expected.spvasm @@ -0,0 +1,55 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleBias_9dbb51 "textureSampleBias_9dbb51" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v4float = OpTypeVector %float 4 + %16 = OpTypeSampledImage %3 + %v3float = OpTypeVector %float 3 + %float_0 = OpConstant %float 0 + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %float_1 = OpConstant %float 1 + %v2int = OpTypeVector %int 2 + %26 = OpConstantNull %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %29 = OpConstantNull %v4float +%textureSampleBias_9dbb51 = OpFunction %void None %8 + %11 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %29 + %14 = OpLoad %7 %arg_1 + %15 = OpLoad %3 %arg_0 + %17 = OpSampledImage %16 %15 %14 + %20 = OpConvertSToF %float %int_1 + %23 = OpCompositeConstruct %v3float %float_0 %float_0 %20 + %12 = OpImageSampleImplicitLod %v4float %17 %23 Bias|ConstOffset %float_1 %26 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %31 = OpLabel + %32 = OpFunctionCall %void %textureSampleBias_9dbb51 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureSampleBias/9dbb51.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleBias/9dbb51.wgsl.expected.wgsl new file mode 100644 index 0000000000..aa1d40720f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleBias/9dbb51.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleBias_9dbb51() { + var res : vec4 = textureSampleBias(arg_0, arg_1, vec2(), 1, 1.0, vec2()); +} + +@stage(fragment) +fn fragment_main() { + textureSampleBias_9dbb51(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleBias/a161cf.wgsl b/test/tint/builtins/gen/literal/textureSampleBias/a161cf.wgsl new file mode 100644 index 0000000000..ae96a5a069 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleBias/a161cf.wgsl @@ -0,0 +1,36 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleBias(texture: texture_2d, sampler: sampler, coords: vec2, bias: f32, @const offset: vec2) -> vec4 +fn textureSampleBias_a161cf() { + var res: vec4 = textureSampleBias(arg_0, arg_1, vec2(), 1.0, vec2()); +} + +@stage(fragment) +fn fragment_main() { + textureSampleBias_a161cf(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleBias/a161cf.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleBias/a161cf.wgsl.expected.glsl new file mode 100644 index 0000000000..e819fcd78c --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleBias/a161cf.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es +precision mediump float; + +uniform highp sampler2D arg_0_arg_1; + +void textureSampleBias_a161cf() { + vec4 res = textureOffset(arg_0_arg_1, vec2(0.0f), ivec2(0), 1.0f); +} + +void fragment_main() { + textureSampleBias_a161cf(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleBias/a161cf.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureSampleBias/a161cf.wgsl.expected.hlsl new file mode 100644 index 0000000000..3d63e8ac7f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleBias/a161cf.wgsl.expected.hlsl @@ -0,0 +1,11 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleBias_a161cf() { + float4 res = arg_0.SampleBias(arg_1, (0.0f).xx, 1.0f, (0).xx); +} + +void fragment_main() { + textureSampleBias_a161cf(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleBias/a161cf.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleBias/a161cf.wgsl.expected.msl new file mode 100644 index 0000000000..87dac440f0 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleBias/a161cf.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +void textureSampleBias_a161cf(texture2d tint_symbol, sampler tint_symbol_1) { + float4 res = tint_symbol.sample(tint_symbol_1, float2(0.0f), bias(1.0f), int2(0)); +} + +fragment void fragment_main(texture2d tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSampleBias_a161cf(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureSampleBias/a161cf.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleBias/a161cf.wgsl.expected.spvasm new file mode 100644 index 0000000000..6b14f26539 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleBias/a161cf.wgsl.expected.spvasm @@ -0,0 +1,52 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 30 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleBias_a161cf "textureSampleBias_a161cf" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v4float = OpTypeVector %float 4 + %16 = OpTypeSampledImage %3 + %v2float = OpTypeVector %float 2 + %19 = OpConstantNull %v2float + %float_1 = OpConstant %float 1 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %23 = OpConstantNull %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %26 = OpConstantNull %v4float +%textureSampleBias_a161cf = OpFunction %void None %8 + %11 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %26 + %14 = OpLoad %7 %arg_1 + %15 = OpLoad %3 %arg_0 + %17 = OpSampledImage %16 %15 %14 + %12 = OpImageSampleImplicitLod %v4float %17 %19 Bias|ConstOffset %float_1 %23 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %28 = OpLabel + %29 = OpFunctionCall %void %textureSampleBias_a161cf + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureSampleBias/a161cf.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleBias/a161cf.wgsl.expected.wgsl new file mode 100644 index 0000000000..158537ee83 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleBias/a161cf.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +@group(1) @binding(0) var arg_0 : texture_2d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleBias_a161cf() { + var res : vec4 = textureSampleBias(arg_0, arg_1, vec2(), 1.0, vec2()); +} + +@stage(fragment) +fn fragment_main() { + textureSampleBias_a161cf(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleBias/df91bb.wgsl b/test/tint/builtins/gen/literal/textureSampleBias/df91bb.wgsl deleted file mode 100644 index 14282eeb10..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleBias/df91bb.wgsl +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/gen/gen.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_3d; -@group(1) @binding(1) var arg_1: sampler; - -// fn textureSampleBias(texture: texture_3d, sampler: sampler, coords: vec3, bias: f32, offset: vec3) -> vec4 -fn textureSampleBias_df91bb() { - var res: vec4 = textureSampleBias(arg_0, arg_1, vec3(), 1.0, vec3()); -} - -@stage(fragment) -fn fragment_main() { - textureSampleBias_df91bb(); -} diff --git a/test/tint/builtins/gen/literal/textureSampleBias/df91bb.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleBias/df91bb.wgsl.expected.glsl deleted file mode 100644 index c77767cc30..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleBias/df91bb.wgsl.expected.glsl +++ /dev/null @@ -1,17 +0,0 @@ -#version 310 es -precision mediump float; - -uniform highp sampler3D arg_0_arg_1; - -void textureSampleBias_df91bb() { - vec4 res = textureOffset(arg_0_arg_1, vec3(0.0f), ivec3(0), 1.0f); -} - -void fragment_main() { - textureSampleBias_df91bb(); -} - -void main() { - fragment_main(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureSampleBias/df91bb.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureSampleBias/df91bb.wgsl.expected.hlsl deleted file mode 100644 index fff7ac87c8..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleBias/df91bb.wgsl.expected.hlsl +++ /dev/null @@ -1,11 +0,0 @@ -Texture3D arg_0 : register(t0, space1); -SamplerState arg_1 : register(s1, space1); - -void textureSampleBias_df91bb() { - float4 res = arg_0.SampleBias(arg_1, (0.0f).xxx, 1.0f, (0).xxx); -} - -void fragment_main() { - textureSampleBias_df91bb(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureSampleBias/df91bb.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleBias/df91bb.wgsl.expected.msl deleted file mode 100644 index 020cab3584..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleBias/df91bb.wgsl.expected.msl +++ /dev/null @@ -1,12 +0,0 @@ -#include - -using namespace metal; -void textureSampleBias_df91bb(texture3d tint_symbol, sampler tint_symbol_1) { - float4 res = tint_symbol.sample(tint_symbol_1, float3(0.0f), bias(1.0f), int3(0)); -} - -fragment void fragment_main(texture3d tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { - textureSampleBias_df91bb(tint_symbol_2, tint_symbol_3); - return; -} - diff --git a/test/tint/builtins/gen/literal/textureSampleBias/df91bb.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleBias/df91bb.wgsl.expected.spvasm deleted file mode 100644 index 3b58d2d5b8..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleBias/df91bb.wgsl.expected.spvasm +++ /dev/null @@ -1,52 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 30 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %fragment_main "fragment_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpName %arg_0 "arg_0" - OpName %arg_1 "arg_1" - OpName %textureSampleBias_df91bb "textureSampleBias_df91bb" - OpName %res "res" - OpName %fragment_main "fragment_main" - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - %float = OpTypeFloat 32 - %3 = OpTypeImage %float 3D 0 0 0 1 Unknown -%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 - %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant - %7 = OpTypeSampler -%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 - %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant - %void = OpTypeVoid - %8 = OpTypeFunction %void - %v4float = OpTypeVector %float 4 - %16 = OpTypeSampledImage %3 - %v3float = OpTypeVector %float 3 - %19 = OpConstantNull %v3float - %float_1 = OpConstant %float 1 - %int = OpTypeInt 32 1 - %v3int = OpTypeVector %int 3 - %23 = OpConstantNull %v3int -%_ptr_Function_v4float = OpTypePointer Function %v4float - %26 = OpConstantNull %v4float -%textureSampleBias_df91bb = OpFunction %void None %8 - %11 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %26 - %14 = OpLoad %7 %arg_1 - %15 = OpLoad %3 %arg_0 - %17 = OpSampledImage %16 %15 %14 - %12 = OpImageSampleImplicitLod %v4float %17 %19 Bias|ConstOffset %float_1 %23 - OpStore %res %12 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %8 - %28 = OpLabel - %29 = OpFunctionCall %void %textureSampleBias_df91bb - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureSampleBias/df91bb.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleBias/df91bb.wgsl.expected.wgsl deleted file mode 100644 index 9f530da746..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleBias/df91bb.wgsl.expected.wgsl +++ /dev/null @@ -1,12 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_3d; - -@group(1) @binding(1) var arg_1 : sampler; - -fn textureSampleBias_df91bb() { - var res : vec4 = textureSampleBias(arg_0, arg_1, vec3(), 1.0, vec3()); -} - -@stage(fragment) -fn fragment_main() { - textureSampleBias_df91bb(); -} diff --git a/test/tint/builtins/gen/literal/textureSampleCompare/25fcd1.wgsl b/test/tint/builtins/gen/literal/textureSampleCompare/25fcd1.wgsl deleted file mode 100644 index d0e2376fb6..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleCompare/25fcd1.wgsl +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/gen/gen.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_depth_2d; -@group(1) @binding(1) var arg_1: sampler_comparison; - -// fn textureSampleCompare(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2, depth_ref: f32, offset: vec2) -> f32 -fn textureSampleCompare_25fcd1() { - var res: f32 = textureSampleCompare(arg_0, arg_1, vec2(), 1.0, vec2()); -} - -@stage(fragment) -fn fragment_main() { - textureSampleCompare_25fcd1(); -} diff --git a/test/tint/builtins/gen/literal/textureSampleCompare/25fcd1.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleCompare/25fcd1.wgsl.expected.glsl deleted file mode 100644 index 92770de02b..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleCompare/25fcd1.wgsl.expected.glsl +++ /dev/null @@ -1,17 +0,0 @@ -#version 310 es -precision mediump float; - -uniform highp sampler2DShadow arg_0_arg_1; - -void textureSampleCompare_25fcd1() { - float res = textureOffset(arg_0_arg_1, vec3(0.0f, 0.0f, 1.0f), ivec2(0)); -} - -void fragment_main() { - textureSampleCompare_25fcd1(); -} - -void main() { - fragment_main(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureSampleCompare/25fcd1.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureSampleCompare/25fcd1.wgsl.expected.hlsl deleted file mode 100644 index b8aa7d03a3..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleCompare/25fcd1.wgsl.expected.hlsl +++ /dev/null @@ -1,11 +0,0 @@ -Texture2D arg_0 : register(t0, space1); -SamplerComparisonState arg_1 : register(s1, space1); - -void textureSampleCompare_25fcd1() { - float res = arg_0.SampleCmp(arg_1, (0.0f).xx, 1.0f, (0).xx); -} - -void fragment_main() { - textureSampleCompare_25fcd1(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureSampleCompare/25fcd1.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleCompare/25fcd1.wgsl.expected.msl deleted file mode 100644 index 469a65ac3c..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleCompare/25fcd1.wgsl.expected.msl +++ /dev/null @@ -1,12 +0,0 @@ -#include - -using namespace metal; -void textureSampleCompare_25fcd1(depth2d tint_symbol, sampler tint_symbol_1) { - float res = tint_symbol.sample_compare(tint_symbol_1, float2(0.0f), 1.0f, int2(0)); -} - -fragment void fragment_main(depth2d tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { - textureSampleCompare_25fcd1(tint_symbol_2, tint_symbol_3); - return; -} - diff --git a/test/tint/builtins/gen/literal/textureSampleCompare/25fcd1.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleCompare/25fcd1.wgsl.expected.spvasm deleted file mode 100644 index 9fff619371..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleCompare/25fcd1.wgsl.expected.spvasm +++ /dev/null @@ -1,51 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 29 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %fragment_main "fragment_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpName %arg_0 "arg_0" - OpName %arg_1 "arg_1" - OpName %textureSampleCompare_25fcd1 "textureSampleCompare_25fcd1" - OpName %res "res" - OpName %fragment_main "fragment_main" - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - %float = OpTypeFloat 32 - %3 = OpTypeImage %float 2D 0 0 0 1 Unknown -%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 - %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant - %7 = OpTypeSampler -%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 - %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant - %void = OpTypeVoid - %8 = OpTypeFunction %void - %15 = OpTypeSampledImage %3 - %v2float = OpTypeVector %float 2 - %18 = OpConstantNull %v2float - %float_1 = OpConstant %float 1 - %int = OpTypeInt 32 1 - %v2int = OpTypeVector %int 2 - %22 = OpConstantNull %v2int -%_ptr_Function_float = OpTypePointer Function %float - %25 = OpConstantNull %float -%textureSampleCompare_25fcd1 = OpFunction %void None %8 - %11 = OpLabel - %res = OpVariable %_ptr_Function_float Function %25 - %13 = OpLoad %7 %arg_1 - %14 = OpLoad %3 %arg_0 - %16 = OpSampledImage %15 %14 %13 - %12 = OpImageSampleDrefImplicitLod %float %16 %18 %float_1 ConstOffset %22 - OpStore %res %12 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %8 - %27 = OpLabel - %28 = OpFunctionCall %void %textureSampleCompare_25fcd1 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureSampleCompare/25fcd1.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleCompare/25fcd1.wgsl.expected.wgsl deleted file mode 100644 index 532be33609..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleCompare/25fcd1.wgsl.expected.wgsl +++ /dev/null @@ -1,12 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_depth_2d; - -@group(1) @binding(1) var arg_1 : sampler_comparison; - -fn textureSampleCompare_25fcd1() { - var res : f32 = textureSampleCompare(arg_0, arg_1, vec2(), 1.0, vec2()); -} - -@stage(fragment) -fn fragment_main() { - textureSampleCompare_25fcd1(); -} diff --git a/test/tint/builtins/gen/literal/textureSampleCompare/98b85c.wgsl b/test/tint/builtins/gen/literal/textureSampleCompare/98b85c.wgsl deleted file mode 100644 index 8af7adc297..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleCompare/98b85c.wgsl +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/gen/gen.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_depth_2d_array; -@group(1) @binding(1) var arg_1: sampler_comparison; - -// fn textureSampleCompare(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2, array_index: i32, depth_ref: f32, offset: vec2) -> f32 -fn textureSampleCompare_98b85c() { - var res: f32 = textureSampleCompare(arg_0, arg_1, vec2(), 1, 1.0, vec2()); -} - -@stage(fragment) -fn fragment_main() { - textureSampleCompare_98b85c(); -} diff --git a/test/tint/builtins/gen/literal/textureSampleCompare/98b85c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleCompare/98b85c.wgsl.expected.glsl deleted file mode 100644 index 45aa450c51..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleCompare/98b85c.wgsl.expected.glsl +++ /dev/null @@ -1,26 +0,0 @@ -SKIP: FAILED - -#version 310 es -precision mediump float; - -uniform highp sampler2DArrayShadow arg_0_arg_1; - -void textureSampleCompare_98b85c() { - float res = textureOffset(arg_0_arg_1, vec4(0.0f, 0.0f, float(1), 1.0f), ivec2(0)); -} - -void fragment_main() { - textureSampleCompare_98b85c(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:7: 'sampler' : TextureOffset does not support sampler2DArrayShadow : ES Profile -ERROR: 0:7: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/literal/textureSampleCompare/98b85c.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureSampleCompare/98b85c.wgsl.expected.hlsl deleted file mode 100644 index a468836334..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleCompare/98b85c.wgsl.expected.hlsl +++ /dev/null @@ -1,11 +0,0 @@ -Texture2DArray arg_0 : register(t0, space1); -SamplerComparisonState arg_1 : register(s1, space1); - -void textureSampleCompare_98b85c() { - float res = arg_0.SampleCmp(arg_1, float3(0.0f, 0.0f, float(1)), 1.0f, (0).xx); -} - -void fragment_main() { - textureSampleCompare_98b85c(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureSampleCompare/98b85c.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleCompare/98b85c.wgsl.expected.msl deleted file mode 100644 index 6e4476f804..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleCompare/98b85c.wgsl.expected.msl +++ /dev/null @@ -1,12 +0,0 @@ -#include - -using namespace metal; -void textureSampleCompare_98b85c(depth2d_array tint_symbol, sampler tint_symbol_1) { - float res = tint_symbol.sample_compare(tint_symbol_1, float2(0.0f), 1, 1.0f, int2(0)); -} - -fragment void fragment_main(depth2d_array tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { - textureSampleCompare_98b85c(tint_symbol_2, tint_symbol_3); - return; -} - diff --git a/test/tint/builtins/gen/literal/textureSampleCompare/98b85c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleCompare/98b85c.wgsl.expected.spvasm deleted file mode 100644 index d0f924cf92..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleCompare/98b85c.wgsl.expected.spvasm +++ /dev/null @@ -1,54 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 32 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %fragment_main "fragment_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpName %arg_0 "arg_0" - OpName %arg_1 "arg_1" - OpName %textureSampleCompare_98b85c "textureSampleCompare_98b85c" - OpName %res "res" - OpName %fragment_main "fragment_main" - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - %float = OpTypeFloat 32 - %3 = OpTypeImage %float 2D 0 1 0 1 Unknown -%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 - %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant - %7 = OpTypeSampler -%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 - %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant - %void = OpTypeVoid - %8 = OpTypeFunction %void - %15 = OpTypeSampledImage %3 - %v3float = OpTypeVector %float 3 - %float_0 = OpConstant %float 0 - %int = OpTypeInt 32 1 - %int_1 = OpConstant %int 1 - %float_1 = OpConstant %float 1 - %v2int = OpTypeVector %int 2 - %25 = OpConstantNull %v2int -%_ptr_Function_float = OpTypePointer Function %float - %28 = OpConstantNull %float -%textureSampleCompare_98b85c = OpFunction %void None %8 - %11 = OpLabel - %res = OpVariable %_ptr_Function_float Function %28 - %13 = OpLoad %7 %arg_1 - %14 = OpLoad %3 %arg_0 - %16 = OpSampledImage %15 %14 %13 - %19 = OpConvertSToF %float %int_1 - %22 = OpCompositeConstruct %v3float %float_0 %float_0 %19 - %12 = OpImageSampleDrefImplicitLod %float %16 %22 %float_1 ConstOffset %25 - OpStore %res %12 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %8 - %30 = OpLabel - %31 = OpFunctionCall %void %textureSampleCompare_98b85c - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureSampleCompare/98b85c.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleCompare/98b85c.wgsl.expected.wgsl deleted file mode 100644 index de96847f64..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleCompare/98b85c.wgsl.expected.wgsl +++ /dev/null @@ -1,12 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_depth_2d_array; - -@group(1) @binding(1) var arg_1 : sampler_comparison; - -fn textureSampleCompare_98b85c() { - var res : f32 = textureSampleCompare(arg_0, arg_1, vec2(), 1, 1.0, vec2()); -} - -@stage(fragment) -fn fragment_main() { - textureSampleCompare_98b85c(); -} diff --git a/test/tint/builtins/gen/literal/textureSampleCompare/af1051.wgsl b/test/tint/builtins/gen/literal/textureSampleCompare/af1051.wgsl new file mode 100644 index 0000000000..ef76e35cf4 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompare/af1051.wgsl @@ -0,0 +1,36 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d_array; +@group(1) @binding(1) var arg_1: sampler_comparison; + +// fn textureSampleCompare(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2, array_index: i32, depth_ref: f32, @const offset: vec2) -> f32 +fn textureSampleCompare_af1051() { + var res: f32 = textureSampleCompare(arg_0, arg_1, vec2(), 1, 1.0, vec2()); +} + +@stage(fragment) +fn fragment_main() { + textureSampleCompare_af1051(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleCompare/af1051.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleCompare/af1051.wgsl.expected.glsl new file mode 100644 index 0000000000..e20d8bfe24 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompare/af1051.wgsl.expected.glsl @@ -0,0 +1,26 @@ +SKIP: FAILED + +#version 310 es +precision mediump float; + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureSampleCompare_af1051() { + float res = textureOffset(arg_0_arg_1, vec4(0.0f, 0.0f, float(1), 1.0f), ivec2(0)); +} + +void fragment_main() { + textureSampleCompare_af1051(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:7: 'sampler' : TextureOffset does not support sampler2DArrayShadow : ES Profile +ERROR: 0:7: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureSampleCompare/af1051.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureSampleCompare/af1051.wgsl.expected.hlsl new file mode 100644 index 0000000000..60ff0955b9 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompare/af1051.wgsl.expected.hlsl @@ -0,0 +1,11 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureSampleCompare_af1051() { + float res = arg_0.SampleCmp(arg_1, float3(0.0f, 0.0f, float(1)), 1.0f, (0).xx); +} + +void fragment_main() { + textureSampleCompare_af1051(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleCompare/af1051.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleCompare/af1051.wgsl.expected.msl new file mode 100644 index 0000000000..beb211766d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompare/af1051.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +void textureSampleCompare_af1051(depth2d_array tint_symbol, sampler tint_symbol_1) { + float res = tint_symbol.sample_compare(tint_symbol_1, float2(0.0f), 1, 1.0f, int2(0)); +} + +fragment void fragment_main(depth2d_array tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSampleCompare_af1051(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureSampleCompare/af1051.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleCompare/af1051.wgsl.expected.spvasm new file mode 100644 index 0000000000..4e66ca9c71 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompare/af1051.wgsl.expected.spvasm @@ -0,0 +1,54 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleCompare_af1051 "textureSampleCompare_af1051" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %15 = OpTypeSampledImage %3 + %v3float = OpTypeVector %float 3 + %float_0 = OpConstant %float 0 + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %float_1 = OpConstant %float 1 + %v2int = OpTypeVector %int 2 + %25 = OpConstantNull %v2int +%_ptr_Function_float = OpTypePointer Function %float + %28 = OpConstantNull %float +%textureSampleCompare_af1051 = OpFunction %void None %8 + %11 = OpLabel + %res = OpVariable %_ptr_Function_float Function %28 + %13 = OpLoad %7 %arg_1 + %14 = OpLoad %3 %arg_0 + %16 = OpSampledImage %15 %14 %13 + %19 = OpConvertSToF %float %int_1 + %22 = OpCompositeConstruct %v3float %float_0 %float_0 %19 + %12 = OpImageSampleDrefImplicitLod %float %16 %22 %float_1 ConstOffset %25 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %30 = OpLabel + %31 = OpFunctionCall %void %textureSampleCompare_af1051 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureSampleCompare/af1051.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleCompare/af1051.wgsl.expected.wgsl new file mode 100644 index 0000000000..3d8740fb19 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompare/af1051.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d_array; + +@group(1) @binding(1) var arg_1 : sampler_comparison; + +fn textureSampleCompare_af1051() { + var res : f32 = textureSampleCompare(arg_0, arg_1, vec2(), 1, 1.0, vec2()); +} + +@stage(fragment) +fn fragment_main() { + textureSampleCompare_af1051(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleCompare/dec064.wgsl b/test/tint/builtins/gen/literal/textureSampleCompare/dec064.wgsl new file mode 100644 index 0000000000..5a5a9906a9 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompare/dec064.wgsl @@ -0,0 +1,36 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d; +@group(1) @binding(1) var arg_1: sampler_comparison; + +// fn textureSampleCompare(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2, depth_ref: f32, @const offset: vec2) -> f32 +fn textureSampleCompare_dec064() { + var res: f32 = textureSampleCompare(arg_0, arg_1, vec2(), 1.0, vec2()); +} + +@stage(fragment) +fn fragment_main() { + textureSampleCompare_dec064(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleCompare/dec064.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleCompare/dec064.wgsl.expected.glsl new file mode 100644 index 0000000000..04d0da828e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompare/dec064.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es +precision mediump float; + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureSampleCompare_dec064() { + float res = textureOffset(arg_0_arg_1, vec3(0.0f, 0.0f, 1.0f), ivec2(0)); +} + +void fragment_main() { + textureSampleCompare_dec064(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleCompare/dec064.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureSampleCompare/dec064.wgsl.expected.hlsl new file mode 100644 index 0000000000..04d19157eb --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompare/dec064.wgsl.expected.hlsl @@ -0,0 +1,11 @@ +Texture2D arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureSampleCompare_dec064() { + float res = arg_0.SampleCmp(arg_1, (0.0f).xx, 1.0f, (0).xx); +} + +void fragment_main() { + textureSampleCompare_dec064(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleCompare/dec064.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleCompare/dec064.wgsl.expected.msl new file mode 100644 index 0000000000..87c9f9b0c5 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompare/dec064.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +void textureSampleCompare_dec064(depth2d tint_symbol, sampler tint_symbol_1) { + float res = tint_symbol.sample_compare(tint_symbol_1, float2(0.0f), 1.0f, int2(0)); +} + +fragment void fragment_main(depth2d tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSampleCompare_dec064(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureSampleCompare/dec064.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleCompare/dec064.wgsl.expected.spvasm new file mode 100644 index 0000000000..574e9c1d4d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompare/dec064.wgsl.expected.spvasm @@ -0,0 +1,51 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 29 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleCompare_dec064 "textureSampleCompare_dec064" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %15 = OpTypeSampledImage %3 + %v2float = OpTypeVector %float 2 + %18 = OpConstantNull %v2float + %float_1 = OpConstant %float 1 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %22 = OpConstantNull %v2int +%_ptr_Function_float = OpTypePointer Function %float + %25 = OpConstantNull %float +%textureSampleCompare_dec064 = OpFunction %void None %8 + %11 = OpLabel + %res = OpVariable %_ptr_Function_float Function %25 + %13 = OpLoad %7 %arg_1 + %14 = OpLoad %3 %arg_0 + %16 = OpSampledImage %15 %14 %13 + %12 = OpImageSampleDrefImplicitLod %float %16 %18 %float_1 ConstOffset %22 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %27 = OpLabel + %28 = OpFunctionCall %void %textureSampleCompare_dec064 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureSampleCompare/dec064.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleCompare/dec064.wgsl.expected.wgsl new file mode 100644 index 0000000000..30f4183d6a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompare/dec064.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d; + +@group(1) @binding(1) var arg_1 : sampler_comparison; + +fn textureSampleCompare_dec064() { + var res : f32 = textureSampleCompare(arg_0, arg_1, vec2(), 1.0, vec2()); +} + +@stage(fragment) +fn fragment_main() { + textureSampleCompare_dec064(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleCompareLevel/011a8f.wgsl b/test/tint/builtins/gen/literal/textureSampleCompareLevel/011a8f.wgsl deleted file mode 100644 index 4ebd76ce7d..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleCompareLevel/011a8f.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/gen/gen.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_depth_2d_array; -@group(1) @binding(1) var arg_1: sampler_comparison; - -// fn textureSampleCompareLevel(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2, array_index: i32, depth_ref: f32, offset: vec2) -> f32 -fn textureSampleCompareLevel_011a8f() { - var res: f32 = textureSampleCompareLevel(arg_0, arg_1, vec2(), 1, 1.0, vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleCompareLevel_011a8f(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleCompareLevel_011a8f(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleCompareLevel_011a8f(); -} diff --git a/test/tint/builtins/gen/literal/textureSampleCompareLevel/011a8f.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleCompareLevel/011a8f.wgsl.expected.glsl deleted file mode 100644 index ed8868c17c..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleCompareLevel/011a8f.wgsl.expected.glsl +++ /dev/null @@ -1,78 +0,0 @@ -SKIP: FAILED - -#version 310 es - -uniform highp sampler2DArrayShadow arg_0_arg_1; - -void textureSampleCompareLevel_011a8f() { - float res = textureOffset(arg_0_arg_1, vec4(0.0f, 0.0f, float(1), 1.0f), ivec2(0)); -} - -vec4 vertex_main() { - textureSampleCompareLevel_011a8f(); - return vec4(0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:6: 'sampler' : TextureOffset does not support sampler2DArrayShadow : ES Profile -ERROR: 0:6: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -uniform highp sampler2DArrayShadow arg_0_arg_1; - -void textureSampleCompareLevel_011a8f() { - float res = textureOffset(arg_0_arg_1, vec4(0.0f, 0.0f, float(1), 1.0f), ivec2(0)); -} - -void fragment_main() { - textureSampleCompareLevel_011a8f(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:7: 'sampler' : TextureOffset does not support sampler2DArrayShadow : ES Profile -ERROR: 0:7: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -uniform highp sampler2DArrayShadow arg_0_arg_1; - -void textureSampleCompareLevel_011a8f() { - float res = textureOffset(arg_0_arg_1, vec4(0.0f, 0.0f, float(1), 1.0f), ivec2(0)); -} - -void compute_main() { - textureSampleCompareLevel_011a8f(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:6: 'sampler' : TextureOffset does not support sampler2DArrayShadow : ES Profile -ERROR: 0:6: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/literal/textureSampleCompareLevel/011a8f.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureSampleCompareLevel/011a8f.wgsl.expected.hlsl deleted file mode 100644 index 7ffb3689c1..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleCompareLevel/011a8f.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -Texture2DArray arg_0 : register(t0, space1); -SamplerComparisonState arg_1 : register(s1, space1); - -void textureSampleCompareLevel_011a8f() { - float res = arg_0.SampleCmpLevelZero(arg_1, float3(0.0f, 0.0f, float(1)), 1.0f, (0).xx); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureSampleCompareLevel_011a8f(); - return (0.0f).xxxx; -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureSampleCompareLevel_011a8f(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureSampleCompareLevel_011a8f(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureSampleCompareLevel/011a8f.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleCompareLevel/011a8f.wgsl.expected.msl deleted file mode 100644 index e076c6e877..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleCompareLevel/011a8f.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureSampleCompareLevel_011a8f(depth2d_array tint_symbol_1, sampler tint_symbol_2) { - float res = tint_symbol_1.sample_compare(tint_symbol_2, float2(0.0f), 1, 1.0f, level(0), int2(0)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(depth2d_array tint_symbol_3, sampler tint_symbol_4) { - textureSampleCompareLevel_011a8f(tint_symbol_3, tint_symbol_4); - return float4(0.0f); -} - -vertex tint_symbol vertex_main(depth2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(depth2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureSampleCompareLevel_011a8f(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(depth2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureSampleCompareLevel_011a8f(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/literal/textureSampleCompareLevel/011a8f.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleCompareLevel/011a8f.wgsl.expected.spvasm deleted file mode 100644 index 47d942ccd0..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleCompareLevel/011a8f.wgsl.expected.spvasm +++ /dev/null @@ -1,88 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 48 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_0 "arg_0" - OpName %arg_1 "arg_1" - OpName %textureSampleCompareLevel_011a8f "textureSampleCompareLevel_011a8f" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %11 = OpTypeImage %float 2D 0 1 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %14 = OpTypeSampler -%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 - %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant - %void = OpTypeVoid - %15 = OpTypeFunction %void - %22 = OpTypeSampledImage %11 - %v3float = OpTypeVector %float 3 - %float_0 = OpConstant %float 0 - %int = OpTypeInt 32 1 - %int_1 = OpConstant %int 1 - %float_1 = OpConstant %float 1 - %v2int = OpTypeVector %int 2 - %32 = OpConstantNull %v2int -%_ptr_Function_float = OpTypePointer Function %float - %35 = OpTypeFunction %v4float -%textureSampleCompareLevel_011a8f = OpFunction %void None %15 - %18 = OpLabel - %res = OpVariable %_ptr_Function_float Function %8 - %20 = OpLoad %14 %arg_1 - %21 = OpLoad %11 %arg_0 - %23 = OpSampledImage %22 %21 %20 - %26 = OpConvertSToF %float %int_1 - %29 = OpCompositeConstruct %v3float %float_0 %float_0 %26 - %19 = OpImageSampleDrefExplicitLod %float %23 %29 %float_1 Lod|ConstOffset %float_0 %32 - OpStore %res %19 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %35 - %37 = OpLabel - %38 = OpFunctionCall %void %textureSampleCompareLevel_011a8f - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %15 - %40 = OpLabel - %41 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %41 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %15 - %43 = OpLabel - %44 = OpFunctionCall %void %textureSampleCompareLevel_011a8f - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %15 - %46 = OpLabel - %47 = OpFunctionCall %void %textureSampleCompareLevel_011a8f - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureSampleCompareLevel/011a8f.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleCompareLevel/011a8f.wgsl.expected.wgsl deleted file mode 100644 index d98d813b5d..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleCompareLevel/011a8f.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_depth_2d_array; - -@group(1) @binding(1) var arg_1 : sampler_comparison; - -fn textureSampleCompareLevel_011a8f() { - var res : f32 = textureSampleCompareLevel(arg_0, arg_1, vec2(), 1, 1.0, vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleCompareLevel_011a8f(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleCompareLevel_011a8f(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleCompareLevel_011a8f(); -} diff --git a/test/tint/builtins/gen/literal/textureSampleCompareLevel/7f2b9a.wgsl b/test/tint/builtins/gen/literal/textureSampleCompareLevel/7f2b9a.wgsl new file mode 100644 index 0000000000..c343fdf107 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompareLevel/7f2b9a.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d; +@group(1) @binding(1) var arg_1: sampler_comparison; + +// fn textureSampleCompareLevel(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2, depth_ref: f32, @const offset: vec2) -> f32 +fn textureSampleCompareLevel_7f2b9a() { + var res: f32 = textureSampleCompareLevel(arg_0, arg_1, vec2(), 1.0, vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleCompareLevel_7f2b9a(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleCompareLevel_7f2b9a(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleCompareLevel_7f2b9a(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleCompareLevel/7f2b9a.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleCompareLevel/7f2b9a.wgsl.expected.glsl new file mode 100644 index 0000000000..cec13f16cc --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompareLevel/7f2b9a.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureSampleCompareLevel_7f2b9a() { + float res = textureOffset(arg_0_arg_1, vec3(0.0f, 0.0f, 1.0f), ivec2(0)); +} + +vec4 vertex_main() { + textureSampleCompareLevel_7f2b9a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureSampleCompareLevel_7f2b9a() { + float res = textureOffset(arg_0_arg_1, vec3(0.0f, 0.0f, 1.0f), ivec2(0)); +} + +void fragment_main() { + textureSampleCompareLevel_7f2b9a(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureSampleCompareLevel_7f2b9a() { + float res = textureOffset(arg_0_arg_1, vec3(0.0f, 0.0f, 1.0f), ivec2(0)); +} + +void compute_main() { + textureSampleCompareLevel_7f2b9a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleCompareLevel/7f2b9a.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureSampleCompareLevel/7f2b9a.wgsl.expected.hlsl new file mode 100644 index 0000000000..772accae57 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompareLevel/7f2b9a.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +Texture2D arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureSampleCompareLevel_7f2b9a() { + float res = arg_0.SampleCmpLevelZero(arg_1, (0.0f).xx, 1.0f, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleCompareLevel_7f2b9a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleCompareLevel_7f2b9a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleCompareLevel_7f2b9a(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleCompareLevel/7f2b9a.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleCompareLevel/7f2b9a.wgsl.expected.msl new file mode 100644 index 0000000000..dbd5a686d1 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompareLevel/7f2b9a.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureSampleCompareLevel_7f2b9a(depth2d tint_symbol_1, sampler tint_symbol_2) { + float res = tint_symbol_1.sample_compare(tint_symbol_2, float2(0.0f), 1.0f, level(0), int2(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d tint_symbol_3, sampler tint_symbol_4) { + textureSampleCompareLevel_7f2b9a(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleCompareLevel_7f2b9a(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depth2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleCompareLevel_7f2b9a(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureSampleCompareLevel/7f2b9a.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleCompareLevel/7f2b9a.wgsl.expected.spvasm new file mode 100644 index 0000000000..98e9d4708b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompareLevel/7f2b9a.wgsl.expected.spvasm @@ -0,0 +1,86 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 46 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleCompareLevel_7f2b9a "textureSampleCompareLevel_7f2b9a" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %22 = OpTypeSampledImage %11 + %v2float = OpTypeVector %float 2 + %25 = OpConstantNull %v2float + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %30 = OpConstantNull %v2int +%_ptr_Function_float = OpTypePointer Function %float + %33 = OpTypeFunction %v4float +%textureSampleCompareLevel_7f2b9a = OpFunction %void None %15 + %18 = OpLabel + %res = OpVariable %_ptr_Function_float Function %8 + %20 = OpLoad %14 %arg_1 + %21 = OpLoad %11 %arg_0 + %23 = OpSampledImage %22 %21 %20 + %19 = OpImageSampleDrefExplicitLod %float %23 %25 %float_1 Lod|ConstOffset %float_0 %30 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %33 + %35 = OpLabel + %36 = OpFunctionCall %void %textureSampleCompareLevel_7f2b9a + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %38 = OpLabel + %39 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %39 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %41 = OpLabel + %42 = OpFunctionCall %void %textureSampleCompareLevel_7f2b9a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %44 = OpLabel + %45 = OpFunctionCall %void %textureSampleCompareLevel_7f2b9a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureSampleCompareLevel/7f2b9a.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleCompareLevel/7f2b9a.wgsl.expected.wgsl new file mode 100644 index 0000000000..e057037232 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompareLevel/7f2b9a.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d; + +@group(1) @binding(1) var arg_1 : sampler_comparison; + +fn textureSampleCompareLevel_7f2b9a() { + var res : f32 = textureSampleCompareLevel(arg_0, arg_1, vec2(), 1.0, vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleCompareLevel_7f2b9a(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleCompareLevel_7f2b9a(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleCompareLevel_7f2b9a(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleCompareLevel/b6e47c.wgsl b/test/tint/builtins/gen/literal/textureSampleCompareLevel/b6e47c.wgsl new file mode 100644 index 0000000000..9a6d3511d0 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompareLevel/b6e47c.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d_array; +@group(1) @binding(1) var arg_1: sampler_comparison; + +// fn textureSampleCompareLevel(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2, array_index: i32, depth_ref: f32, @const offset: vec2) -> f32 +fn textureSampleCompareLevel_b6e47c() { + var res: f32 = textureSampleCompareLevel(arg_0, arg_1, vec2(), 1, 1.0, vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleCompareLevel_b6e47c(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleCompareLevel_b6e47c(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleCompareLevel_b6e47c(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleCompareLevel/b6e47c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleCompareLevel/b6e47c.wgsl.expected.glsl new file mode 100644 index 0000000000..04915fc22b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompareLevel/b6e47c.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureSampleCompareLevel_b6e47c() { + float res = textureOffset(arg_0_arg_1, vec4(0.0f, 0.0f, float(1), 1.0f), ivec2(0)); +} + +vec4 vertex_main() { + textureSampleCompareLevel_b6e47c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:6: 'sampler' : TextureOffset does not support sampler2DArrayShadow : ES Profile +ERROR: 0:6: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureSampleCompareLevel_b6e47c() { + float res = textureOffset(arg_0_arg_1, vec4(0.0f, 0.0f, float(1), 1.0f), ivec2(0)); +} + +void fragment_main() { + textureSampleCompareLevel_b6e47c(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:7: 'sampler' : TextureOffset does not support sampler2DArrayShadow : ES Profile +ERROR: 0:7: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureSampleCompareLevel_b6e47c() { + float res = textureOffset(arg_0_arg_1, vec4(0.0f, 0.0f, float(1), 1.0f), ivec2(0)); +} + +void compute_main() { + textureSampleCompareLevel_b6e47c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:6: 'sampler' : TextureOffset does not support sampler2DArrayShadow : ES Profile +ERROR: 0:6: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureSampleCompareLevel/b6e47c.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureSampleCompareLevel/b6e47c.wgsl.expected.hlsl new file mode 100644 index 0000000000..536d764095 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompareLevel/b6e47c.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureSampleCompareLevel_b6e47c() { + float res = arg_0.SampleCmpLevelZero(arg_1, float3(0.0f, 0.0f, float(1)), 1.0f, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleCompareLevel_b6e47c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleCompareLevel_b6e47c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleCompareLevel_b6e47c(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleCompareLevel/b6e47c.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleCompareLevel/b6e47c.wgsl.expected.msl new file mode 100644 index 0000000000..44343c716b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompareLevel/b6e47c.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureSampleCompareLevel_b6e47c(depth2d_array tint_symbol_1, sampler tint_symbol_2) { + float res = tint_symbol_1.sample_compare(tint_symbol_2, float2(0.0f), 1, 1.0f, level(0), int2(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d_array tint_symbol_3, sampler tint_symbol_4) { + textureSampleCompareLevel_b6e47c(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleCompareLevel_b6e47c(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depth2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleCompareLevel_b6e47c(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureSampleCompareLevel/b6e47c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleCompareLevel/b6e47c.wgsl.expected.spvasm new file mode 100644 index 0000000000..4194b1aa10 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompareLevel/b6e47c.wgsl.expected.spvasm @@ -0,0 +1,88 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 48 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleCompareLevel_b6e47c "textureSampleCompareLevel_b6e47c" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %22 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 + %float_0 = OpConstant %float 0 + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %float_1 = OpConstant %float 1 + %v2int = OpTypeVector %int 2 + %32 = OpConstantNull %v2int +%_ptr_Function_float = OpTypePointer Function %float + %35 = OpTypeFunction %v4float +%textureSampleCompareLevel_b6e47c = OpFunction %void None %15 + %18 = OpLabel + %res = OpVariable %_ptr_Function_float Function %8 + %20 = OpLoad %14 %arg_1 + %21 = OpLoad %11 %arg_0 + %23 = OpSampledImage %22 %21 %20 + %26 = OpConvertSToF %float %int_1 + %29 = OpCompositeConstruct %v3float %float_0 %float_0 %26 + %19 = OpImageSampleDrefExplicitLod %float %23 %29 %float_1 Lod|ConstOffset %float_0 %32 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %35 + %37 = OpLabel + %38 = OpFunctionCall %void %textureSampleCompareLevel_b6e47c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %40 = OpLabel + %41 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %41 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %43 = OpLabel + %44 = OpFunctionCall %void %textureSampleCompareLevel_b6e47c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %46 = OpLabel + %47 = OpFunctionCall %void %textureSampleCompareLevel_b6e47c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureSampleCompareLevel/b6e47c.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleCompareLevel/b6e47c.wgsl.expected.wgsl new file mode 100644 index 0000000000..8819ad2343 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompareLevel/b6e47c.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d_array; + +@group(1) @binding(1) var arg_1 : sampler_comparison; + +fn textureSampleCompareLevel_b6e47c() { + var res : f32 = textureSampleCompareLevel(arg_0, arg_1, vec2(), 1, 1.0, vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleCompareLevel_b6e47c(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleCompareLevel_b6e47c(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleCompareLevel_b6e47c(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleCompareLevel/f8121c.wgsl b/test/tint/builtins/gen/literal/textureSampleCompareLevel/f8121c.wgsl deleted file mode 100644 index 51e2027f38..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleCompareLevel/f8121c.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/gen/gen.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_depth_2d; -@group(1) @binding(1) var arg_1: sampler_comparison; - -// fn textureSampleCompareLevel(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2, depth_ref: f32, offset: vec2) -> f32 -fn textureSampleCompareLevel_f8121c() { - var res: f32 = textureSampleCompareLevel(arg_0, arg_1, vec2(), 1.0, vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleCompareLevel_f8121c(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleCompareLevel_f8121c(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleCompareLevel_f8121c(); -} diff --git a/test/tint/builtins/gen/literal/textureSampleCompareLevel/f8121c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleCompareLevel/f8121c.wgsl.expected.glsl deleted file mode 100644 index 9c295ebc30..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleCompareLevel/f8121c.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp sampler2DShadow arg_0_arg_1; - -void textureSampleCompareLevel_f8121c() { - float res = textureOffset(arg_0_arg_1, vec3(0.0f, 0.0f, 1.0f), ivec2(0)); -} - -vec4 vertex_main() { - textureSampleCompareLevel_f8121c(); - return vec4(0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp sampler2DShadow arg_0_arg_1; - -void textureSampleCompareLevel_f8121c() { - float res = textureOffset(arg_0_arg_1, vec3(0.0f, 0.0f, 1.0f), ivec2(0)); -} - -void fragment_main() { - textureSampleCompareLevel_f8121c(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp sampler2DShadow arg_0_arg_1; - -void textureSampleCompareLevel_f8121c() { - float res = textureOffset(arg_0_arg_1, vec3(0.0f, 0.0f, 1.0f), ivec2(0)); -} - -void compute_main() { - textureSampleCompareLevel_f8121c(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureSampleCompareLevel/f8121c.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureSampleCompareLevel/f8121c.wgsl.expected.hlsl deleted file mode 100644 index 54ff22bb78..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleCompareLevel/f8121c.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -Texture2D arg_0 : register(t0, space1); -SamplerComparisonState arg_1 : register(s1, space1); - -void textureSampleCompareLevel_f8121c() { - float res = arg_0.SampleCmpLevelZero(arg_1, (0.0f).xx, 1.0f, (0).xx); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureSampleCompareLevel_f8121c(); - return (0.0f).xxxx; -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureSampleCompareLevel_f8121c(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureSampleCompareLevel_f8121c(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureSampleCompareLevel/f8121c.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleCompareLevel/f8121c.wgsl.expected.msl deleted file mode 100644 index d63940c9b0..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleCompareLevel/f8121c.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureSampleCompareLevel_f8121c(depth2d tint_symbol_1, sampler tint_symbol_2) { - float res = tint_symbol_1.sample_compare(tint_symbol_2, float2(0.0f), 1.0f, level(0), int2(0)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(depth2d tint_symbol_3, sampler tint_symbol_4) { - textureSampleCompareLevel_f8121c(tint_symbol_3, tint_symbol_4); - return float4(0.0f); -} - -vertex tint_symbol vertex_main(depth2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(depth2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureSampleCompareLevel_f8121c(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(depth2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureSampleCompareLevel_f8121c(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/literal/textureSampleCompareLevel/f8121c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleCompareLevel/f8121c.wgsl.expected.spvasm deleted file mode 100644 index e74be2ed1d..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleCompareLevel/f8121c.wgsl.expected.spvasm +++ /dev/null @@ -1,86 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 46 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_0 "arg_0" - OpName %arg_1 "arg_1" - OpName %textureSampleCompareLevel_f8121c "textureSampleCompareLevel_f8121c" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %11 = OpTypeImage %float 2D 0 0 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %14 = OpTypeSampler -%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 - %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant - %void = OpTypeVoid - %15 = OpTypeFunction %void - %22 = OpTypeSampledImage %11 - %v2float = OpTypeVector %float 2 - %25 = OpConstantNull %v2float - %float_1 = OpConstant %float 1 - %float_0 = OpConstant %float 0 - %int = OpTypeInt 32 1 - %v2int = OpTypeVector %int 2 - %30 = OpConstantNull %v2int -%_ptr_Function_float = OpTypePointer Function %float - %33 = OpTypeFunction %v4float -%textureSampleCompareLevel_f8121c = OpFunction %void None %15 - %18 = OpLabel - %res = OpVariable %_ptr_Function_float Function %8 - %20 = OpLoad %14 %arg_1 - %21 = OpLoad %11 %arg_0 - %23 = OpSampledImage %22 %21 %20 - %19 = OpImageSampleDrefExplicitLod %float %23 %25 %float_1 Lod|ConstOffset %float_0 %30 - OpStore %res %19 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %33 - %35 = OpLabel - %36 = OpFunctionCall %void %textureSampleCompareLevel_f8121c - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %15 - %38 = OpLabel - %39 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %39 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %15 - %41 = OpLabel - %42 = OpFunctionCall %void %textureSampleCompareLevel_f8121c - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %15 - %44 = OpLabel - %45 = OpFunctionCall %void %textureSampleCompareLevel_f8121c - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureSampleCompareLevel/f8121c.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleCompareLevel/f8121c.wgsl.expected.wgsl deleted file mode 100644 index a63e6b36cf..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleCompareLevel/f8121c.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_depth_2d; - -@group(1) @binding(1) var arg_1 : sampler_comparison; - -fn textureSampleCompareLevel_f8121c() { - var res : f32 = textureSampleCompareLevel(arg_0, arg_1, vec2(), 1.0, vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleCompareLevel_f8121c(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleCompareLevel_f8121c(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleCompareLevel_f8121c(); -} diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/468f88.wgsl b/test/tint/builtins/gen/literal/textureSampleGrad/468f88.wgsl deleted file mode 100644 index 63d4fed537..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleGrad/468f88.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/gen/gen.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_2d; -@group(1) @binding(1) var arg_1: sampler; - -// fn textureSampleGrad(texture: texture_2d, sampler: sampler, coords: vec2, ddx: vec2, ddy: vec2, offset: vec2) -> vec4 -fn textureSampleGrad_468f88() { - var res: vec4 = textureSampleGrad(arg_0, arg_1, vec2(), vec2(), vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleGrad_468f88(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleGrad_468f88(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleGrad_468f88(); -} diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/468f88.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleGrad/468f88.wgsl.expected.glsl deleted file mode 100644 index 3182672349..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleGrad/468f88.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp sampler2D arg_0_arg_1; - -void textureSampleGrad_468f88() { - vec4 res = textureGradOffset(arg_0_arg_1, vec2(0.0f), vec2(0.0f), vec2(0.0f), ivec2(0)); -} - -vec4 vertex_main() { - textureSampleGrad_468f88(); - return vec4(0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp sampler2D arg_0_arg_1; - -void textureSampleGrad_468f88() { - vec4 res = textureGradOffset(arg_0_arg_1, vec2(0.0f), vec2(0.0f), vec2(0.0f), ivec2(0)); -} - -void fragment_main() { - textureSampleGrad_468f88(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp sampler2D arg_0_arg_1; - -void textureSampleGrad_468f88() { - vec4 res = textureGradOffset(arg_0_arg_1, vec2(0.0f), vec2(0.0f), vec2(0.0f), ivec2(0)); -} - -void compute_main() { - textureSampleGrad_468f88(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/468f88.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureSampleGrad/468f88.wgsl.expected.hlsl deleted file mode 100644 index ecf93eff86..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleGrad/468f88.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -Texture2D arg_0 : register(t0, space1); -SamplerState arg_1 : register(s1, space1); - -void textureSampleGrad_468f88() { - float4 res = arg_0.SampleGrad(arg_1, (0.0f).xx, (0.0f).xx, (0.0f).xx, (0).xx); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureSampleGrad_468f88(); - return (0.0f).xxxx; -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureSampleGrad_468f88(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureSampleGrad_468f88(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/468f88.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleGrad/468f88.wgsl.expected.msl deleted file mode 100644 index 1676dd3a8f..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleGrad/468f88.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureSampleGrad_468f88(texture2d tint_symbol_1, sampler tint_symbol_2) { - float4 res = tint_symbol_1.sample(tint_symbol_2, float2(0.0f), gradient2d(float2(0.0f), float2(0.0f)), int2(0)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d tint_symbol_3, sampler tint_symbol_4) { - textureSampleGrad_468f88(tint_symbol_3, tint_symbol_4); - return float4(0.0f); -} - -vertex tint_symbol vertex_main(texture2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureSampleGrad_468f88(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(texture2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureSampleGrad_468f88(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/468f88.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleGrad/468f88.wgsl.expected.spvasm deleted file mode 100644 index 9caa2c3a11..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleGrad/468f88.wgsl.expected.spvasm +++ /dev/null @@ -1,85 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 45 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_0 "arg_0" - OpName %arg_1 "arg_1" - OpName %textureSampleGrad_468f88 "textureSampleGrad_468f88" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %11 = OpTypeImage %float 2D 0 0 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %14 = OpTypeSampler -%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 - %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant - %void = OpTypeVoid - %15 = OpTypeFunction %void - %22 = OpTypeSampledImage %11 - %v2float = OpTypeVector %float 2 - %25 = OpConstantNull %v2float - %int = OpTypeInt 32 1 - %v2int = OpTypeVector %int 2 - %28 = OpConstantNull %v2int -%_ptr_Function_v4float = OpTypePointer Function %v4float - %31 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureSampleGrad_468f88 = OpFunction %void None %15 - %18 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %20 = OpLoad %14 %arg_1 - %21 = OpLoad %11 %arg_0 - %23 = OpSampledImage %22 %21 %20 - %19 = OpImageSampleExplicitLod %v4float %23 %25 Grad|ConstOffset %25 %25 %28 - OpStore %res %19 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %31 - %33 = OpLabel - %34 = OpFunctionCall %void %textureSampleGrad_468f88 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %15 - %36 = OpLabel - %37 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %37 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %15 - %40 = OpLabel - %41 = OpFunctionCall %void %textureSampleGrad_468f88 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %15 - %43 = OpLabel - %44 = OpFunctionCall %void %textureSampleGrad_468f88 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/468f88.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleGrad/468f88.wgsl.expected.wgsl deleted file mode 100644 index fc63b372a9..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleGrad/468f88.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_2d; - -@group(1) @binding(1) var arg_1 : sampler; - -fn textureSampleGrad_468f88() { - var res : vec4 = textureSampleGrad(arg_0, arg_1, vec2(), vec2(), vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleGrad_468f88(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleGrad_468f88(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleGrad_468f88(); -} diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/5884dd.wgsl b/test/tint/builtins/gen/literal/textureSampleGrad/5884dd.wgsl new file mode 100644 index 0000000000..d3565f365f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleGrad/5884dd.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_3d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleGrad(texture: texture_3d, sampler: sampler, coords: vec3, ddx: vec3, ddy: vec3, @const offset: vec3) -> vec4 +fn textureSampleGrad_5884dd() { + var res: vec4 = textureSampleGrad(arg_0, arg_1, vec3(), vec3(), vec3(), vec3()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleGrad_5884dd(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleGrad_5884dd(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleGrad_5884dd(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/5884dd.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleGrad/5884dd.wgsl.expected.glsl new file mode 100644 index 0000000000..f5d0ae8afa --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleGrad/5884dd.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp sampler3D arg_0_arg_1; + +void textureSampleGrad_5884dd() { + vec4 res = textureGradOffset(arg_0_arg_1, vec3(0.0f), vec3(0.0f), vec3(0.0f), ivec3(0)); +} + +vec4 vertex_main() { + textureSampleGrad_5884dd(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler3D arg_0_arg_1; + +void textureSampleGrad_5884dd() { + vec4 res = textureGradOffset(arg_0_arg_1, vec3(0.0f), vec3(0.0f), vec3(0.0f), ivec3(0)); +} + +void fragment_main() { + textureSampleGrad_5884dd(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler3D arg_0_arg_1; + +void textureSampleGrad_5884dd() { + vec4 res = textureGradOffset(arg_0_arg_1, vec3(0.0f), vec3(0.0f), vec3(0.0f), ivec3(0)); +} + +void compute_main() { + textureSampleGrad_5884dd(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/5884dd.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureSampleGrad/5884dd.wgsl.expected.hlsl new file mode 100644 index 0000000000..56c120b251 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleGrad/5884dd.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +Texture3D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleGrad_5884dd() { + float4 res = arg_0.SampleGrad(arg_1, (0.0f).xxx, (0.0f).xxx, (0.0f).xxx, (0).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleGrad_5884dd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleGrad_5884dd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleGrad_5884dd(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/5884dd.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleGrad/5884dd.wgsl.expected.msl new file mode 100644 index 0000000000..7a7fc53aa5 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleGrad/5884dd.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureSampleGrad_5884dd(texture3d tint_symbol_1, sampler tint_symbol_2) { + float4 res = tint_symbol_1.sample(tint_symbol_2, float3(0.0f), gradient3d(float3(0.0f), float3(0.0f)), int3(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_3, sampler tint_symbol_4) { + textureSampleGrad_5884dd(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleGrad_5884dd(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture3d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleGrad_5884dd(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/5884dd.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleGrad/5884dd.wgsl.expected.spvasm new file mode 100644 index 0000000000..2ca064c4fd --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleGrad/5884dd.wgsl.expected.spvasm @@ -0,0 +1,85 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleGrad_5884dd "textureSampleGrad_5884dd" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 3D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %22 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 + %25 = OpConstantNull %v3float + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %28 = OpConstantNull %v3int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %31 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureSampleGrad_5884dd = OpFunction %void None %15 + %18 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %20 = OpLoad %14 %arg_1 + %21 = OpLoad %11 %arg_0 + %23 = OpSampledImage %22 %21 %20 + %19 = OpImageSampleExplicitLod %v4float %23 %25 Grad|ConstOffset %25 %25 %28 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %31 + %33 = OpLabel + %34 = OpFunctionCall %void %textureSampleGrad_5884dd + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %36 = OpLabel + %37 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %37 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %40 = OpLabel + %41 = OpFunctionCall %void %textureSampleGrad_5884dd + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %43 = OpLabel + %44 = OpFunctionCall %void %textureSampleGrad_5884dd + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/5884dd.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleGrad/5884dd.wgsl.expected.wgsl new file mode 100644 index 0000000000..3fdb4d589e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleGrad/5884dd.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_3d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleGrad_5884dd() { + var res : vec4 = textureSampleGrad(arg_0, arg_1, vec3(), vec3(), vec3(), vec3()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleGrad_5884dd(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleGrad_5884dd(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleGrad_5884dd(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/872f00.wgsl b/test/tint/builtins/gen/literal/textureSampleGrad/872f00.wgsl deleted file mode 100644 index 4037fe2589..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleGrad/872f00.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/gen/gen.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_2d_array; -@group(1) @binding(1) var arg_1: sampler; - -// fn textureSampleGrad(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, ddx: vec2, ddy: vec2, offset: vec2) -> vec4 -fn textureSampleGrad_872f00() { - var res: vec4 = textureSampleGrad(arg_0, arg_1, vec2(), 1, vec2(), vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleGrad_872f00(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleGrad_872f00(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleGrad_872f00(); -} diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/872f00.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleGrad/872f00.wgsl.expected.glsl deleted file mode 100644 index 383371ad86..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleGrad/872f00.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp sampler2DArray arg_0_arg_1; - -void textureSampleGrad_872f00() { - vec4 res = textureGradOffset(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), vec2(0.0f), vec2(0.0f), ivec2(0)); -} - -vec4 vertex_main() { - textureSampleGrad_872f00(); - return vec4(0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp sampler2DArray arg_0_arg_1; - -void textureSampleGrad_872f00() { - vec4 res = textureGradOffset(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), vec2(0.0f), vec2(0.0f), ivec2(0)); -} - -void fragment_main() { - textureSampleGrad_872f00(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp sampler2DArray arg_0_arg_1; - -void textureSampleGrad_872f00() { - vec4 res = textureGradOffset(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), vec2(0.0f), vec2(0.0f), ivec2(0)); -} - -void compute_main() { - textureSampleGrad_872f00(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/872f00.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureSampleGrad/872f00.wgsl.expected.hlsl deleted file mode 100644 index 682fc5da37..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleGrad/872f00.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -Texture2DArray arg_0 : register(t0, space1); -SamplerState arg_1 : register(s1, space1); - -void textureSampleGrad_872f00() { - float4 res = arg_0.SampleGrad(arg_1, float3(0.0f, 0.0f, float(1)), (0.0f).xx, (0.0f).xx, (0).xx); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureSampleGrad_872f00(); - return (0.0f).xxxx; -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureSampleGrad_872f00(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureSampleGrad_872f00(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/872f00.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleGrad/872f00.wgsl.expected.msl deleted file mode 100644 index 6c57c11760..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleGrad/872f00.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureSampleGrad_872f00(texture2d_array tint_symbol_1, sampler tint_symbol_2) { - float4 res = tint_symbol_1.sample(tint_symbol_2, float2(0.0f), 1, gradient2d(float2(0.0f), float2(0.0f)), int2(0)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_3, sampler tint_symbol_4) { - textureSampleGrad_872f00(tint_symbol_3, tint_symbol_4); - return float4(0.0f); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureSampleGrad_872f00(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureSampleGrad_872f00(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/872f00.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleGrad/872f00.wgsl.expected.spvasm deleted file mode 100644 index 8fb8f21b34..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleGrad/872f00.wgsl.expected.spvasm +++ /dev/null @@ -1,90 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 50 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_0 "arg_0" - OpName %arg_1 "arg_1" - OpName %textureSampleGrad_872f00 "textureSampleGrad_872f00" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %11 = OpTypeImage %float 2D 0 1 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %14 = OpTypeSampler -%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 - %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant - %void = OpTypeVoid - %15 = OpTypeFunction %void - %22 = OpTypeSampledImage %11 - %v3float = OpTypeVector %float 3 - %float_0 = OpConstant %float 0 - %int = OpTypeInt 32 1 - %int_1 = OpConstant %int 1 - %v2float = OpTypeVector %float 2 - %31 = OpConstantNull %v2float - %v2int = OpTypeVector %int 2 - %33 = OpConstantNull %v2int -%_ptr_Function_v4float = OpTypePointer Function %v4float - %36 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureSampleGrad_872f00 = OpFunction %void None %15 - %18 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %20 = OpLoad %14 %arg_1 - %21 = OpLoad %11 %arg_0 - %23 = OpSampledImage %22 %21 %20 - %26 = OpConvertSToF %float %int_1 - %29 = OpCompositeConstruct %v3float %float_0 %float_0 %26 - %19 = OpImageSampleExplicitLod %v4float %23 %29 Grad|ConstOffset %31 %31 %33 - OpStore %res %19 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %36 - %38 = OpLabel - %39 = OpFunctionCall %void %textureSampleGrad_872f00 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %15 - %41 = OpLabel - %42 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %42 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %15 - %45 = OpLabel - %46 = OpFunctionCall %void %textureSampleGrad_872f00 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %15 - %48 = OpLabel - %49 = OpFunctionCall %void %textureSampleGrad_872f00 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/872f00.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleGrad/872f00.wgsl.expected.wgsl deleted file mode 100644 index 095fe4fb4b..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleGrad/872f00.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_2d_array; - -@group(1) @binding(1) var arg_1 : sampler; - -fn textureSampleGrad_872f00() { - var res : vec4 = textureSampleGrad(arg_0, arg_1, vec2(), 1, vec2(), vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleGrad_872f00(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleGrad_872f00(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleGrad_872f00(); -} diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/d4e3c5.wgsl b/test/tint/builtins/gen/literal/textureSampleGrad/d4e3c5.wgsl new file mode 100644 index 0000000000..c82a14ff1f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleGrad/d4e3c5.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleGrad(texture: texture_2d, sampler: sampler, coords: vec2, ddx: vec2, ddy: vec2, @const offset: vec2) -> vec4 +fn textureSampleGrad_d4e3c5() { + var res: vec4 = textureSampleGrad(arg_0, arg_1, vec2(), vec2(), vec2(), vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleGrad_d4e3c5(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleGrad_d4e3c5(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleGrad_d4e3c5(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/d4e3c5.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleGrad/d4e3c5.wgsl.expected.glsl new file mode 100644 index 0000000000..21f3947b20 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleGrad/d4e3c5.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp sampler2D arg_0_arg_1; + +void textureSampleGrad_d4e3c5() { + vec4 res = textureGradOffset(arg_0_arg_1, vec2(0.0f), vec2(0.0f), vec2(0.0f), ivec2(0)); +} + +vec4 vertex_main() { + textureSampleGrad_d4e3c5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2D arg_0_arg_1; + +void textureSampleGrad_d4e3c5() { + vec4 res = textureGradOffset(arg_0_arg_1, vec2(0.0f), vec2(0.0f), vec2(0.0f), ivec2(0)); +} + +void fragment_main() { + textureSampleGrad_d4e3c5(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2D arg_0_arg_1; + +void textureSampleGrad_d4e3c5() { + vec4 res = textureGradOffset(arg_0_arg_1, vec2(0.0f), vec2(0.0f), vec2(0.0f), ivec2(0)); +} + +void compute_main() { + textureSampleGrad_d4e3c5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/d4e3c5.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureSampleGrad/d4e3c5.wgsl.expected.hlsl new file mode 100644 index 0000000000..6ec5b46654 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleGrad/d4e3c5.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleGrad_d4e3c5() { + float4 res = arg_0.SampleGrad(arg_1, (0.0f).xx, (0.0f).xx, (0.0f).xx, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleGrad_d4e3c5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleGrad_d4e3c5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleGrad_d4e3c5(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/d4e3c5.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleGrad/d4e3c5.wgsl.expected.msl new file mode 100644 index 0000000000..7b6d2955df --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleGrad/d4e3c5.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureSampleGrad_d4e3c5(texture2d tint_symbol_1, sampler tint_symbol_2) { + float4 res = tint_symbol_1.sample(tint_symbol_2, float2(0.0f), gradient2d(float2(0.0f), float2(0.0f)), int2(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_3, sampler tint_symbol_4) { + textureSampleGrad_d4e3c5(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleGrad_d4e3c5(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleGrad_d4e3c5(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/d4e3c5.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleGrad/d4e3c5.wgsl.expected.spvasm new file mode 100644 index 0000000000..cdcaae1234 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleGrad/d4e3c5.wgsl.expected.spvasm @@ -0,0 +1,85 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleGrad_d4e3c5 "textureSampleGrad_d4e3c5" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %22 = OpTypeSampledImage %11 + %v2float = OpTypeVector %float 2 + %25 = OpConstantNull %v2float + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %28 = OpConstantNull %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %31 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureSampleGrad_d4e3c5 = OpFunction %void None %15 + %18 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %20 = OpLoad %14 %arg_1 + %21 = OpLoad %11 %arg_0 + %23 = OpSampledImage %22 %21 %20 + %19 = OpImageSampleExplicitLod %v4float %23 %25 Grad|ConstOffset %25 %25 %28 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %31 + %33 = OpLabel + %34 = OpFunctionCall %void %textureSampleGrad_d4e3c5 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %36 = OpLabel + %37 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %37 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %40 = OpLabel + %41 = OpFunctionCall %void %textureSampleGrad_d4e3c5 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %43 = OpLabel + %44 = OpFunctionCall %void %textureSampleGrad_d4e3c5 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/d4e3c5.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleGrad/d4e3c5.wgsl.expected.wgsl new file mode 100644 index 0000000000..d36cb59483 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleGrad/d4e3c5.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_2d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleGrad_d4e3c5() { + var res : vec4 = textureSampleGrad(arg_0, arg_1, vec2(), vec2(), vec2(), vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleGrad_d4e3c5(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleGrad_d4e3c5(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleGrad_d4e3c5(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/d65515.wgsl b/test/tint/builtins/gen/literal/textureSampleGrad/d65515.wgsl new file mode 100644 index 0000000000..3614908384 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleGrad/d65515.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleGrad(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, ddx: vec2, ddy: vec2, @const offset: vec2) -> vec4 +fn textureSampleGrad_d65515() { + var res: vec4 = textureSampleGrad(arg_0, arg_1, vec2(), 1, vec2(), vec2(), vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleGrad_d65515(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleGrad_d65515(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleGrad_d65515(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/d65515.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleGrad/d65515.wgsl.expected.glsl new file mode 100644 index 0000000000..3857b5751a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleGrad/d65515.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp sampler2DArray arg_0_arg_1; + +void textureSampleGrad_d65515() { + vec4 res = textureGradOffset(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), vec2(0.0f), vec2(0.0f), ivec2(0)); +} + +vec4 vertex_main() { + textureSampleGrad_d65515(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DArray arg_0_arg_1; + +void textureSampleGrad_d65515() { + vec4 res = textureGradOffset(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), vec2(0.0f), vec2(0.0f), ivec2(0)); +} + +void fragment_main() { + textureSampleGrad_d65515(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DArray arg_0_arg_1; + +void textureSampleGrad_d65515() { + vec4 res = textureGradOffset(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), vec2(0.0f), vec2(0.0f), ivec2(0)); +} + +void compute_main() { + textureSampleGrad_d65515(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/d65515.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureSampleGrad/d65515.wgsl.expected.hlsl new file mode 100644 index 0000000000..6a31475ce9 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleGrad/d65515.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleGrad_d65515() { + float4 res = arg_0.SampleGrad(arg_1, float3(0.0f, 0.0f, float(1)), (0.0f).xx, (0.0f).xx, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleGrad_d65515(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleGrad_d65515(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleGrad_d65515(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/d65515.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleGrad/d65515.wgsl.expected.msl new file mode 100644 index 0000000000..84f4c0c7b1 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleGrad/d65515.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureSampleGrad_d65515(texture2d_array tint_symbol_1, sampler tint_symbol_2) { + float4 res = tint_symbol_1.sample(tint_symbol_2, float2(0.0f), 1, gradient2d(float2(0.0f), float2(0.0f)), int2(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_3, sampler tint_symbol_4) { + textureSampleGrad_d65515(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleGrad_d65515(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleGrad_d65515(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/d65515.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleGrad/d65515.wgsl.expected.spvasm new file mode 100644 index 0000000000..70acbbc0f7 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleGrad/d65515.wgsl.expected.spvasm @@ -0,0 +1,90 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 50 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleGrad_d65515 "textureSampleGrad_d65515" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %22 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 + %float_0 = OpConstant %float 0 + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %v2float = OpTypeVector %float 2 + %31 = OpConstantNull %v2float + %v2int = OpTypeVector %int 2 + %33 = OpConstantNull %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %36 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureSampleGrad_d65515 = OpFunction %void None %15 + %18 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %20 = OpLoad %14 %arg_1 + %21 = OpLoad %11 %arg_0 + %23 = OpSampledImage %22 %21 %20 + %26 = OpConvertSToF %float %int_1 + %29 = OpCompositeConstruct %v3float %float_0 %float_0 %26 + %19 = OpImageSampleExplicitLod %v4float %23 %29 Grad|ConstOffset %31 %31 %33 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %36 + %38 = OpLabel + %39 = OpFunctionCall %void %textureSampleGrad_d65515 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %41 = OpLabel + %42 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %42 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %45 = OpLabel + %46 = OpFunctionCall %void %textureSampleGrad_d65515 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %48 = OpLabel + %49 = OpFunctionCall %void %textureSampleGrad_d65515 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/d65515.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleGrad/d65515.wgsl.expected.wgsl new file mode 100644 index 0000000000..ee0bf52341 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleGrad/d65515.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleGrad_d65515() { + var res : vec4 = textureSampleGrad(arg_0, arg_1, vec2(), 1, vec2(), vec2(), vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleGrad_d65515(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleGrad_d65515(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleGrad_d65515(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/e9a2f7.wgsl b/test/tint/builtins/gen/literal/textureSampleGrad/e9a2f7.wgsl deleted file mode 100644 index d833ed4c99..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleGrad/e9a2f7.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/gen/gen.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_3d; -@group(1) @binding(1) var arg_1: sampler; - -// fn textureSampleGrad(texture: texture_3d, sampler: sampler, coords: vec3, ddx: vec3, ddy: vec3, offset: vec3) -> vec4 -fn textureSampleGrad_e9a2f7() { - var res: vec4 = textureSampleGrad(arg_0, arg_1, vec3(), vec3(), vec3(), vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleGrad_e9a2f7(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleGrad_e9a2f7(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleGrad_e9a2f7(); -} diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/e9a2f7.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleGrad/e9a2f7.wgsl.expected.glsl deleted file mode 100644 index 51c4551634..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleGrad/e9a2f7.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp sampler3D arg_0_arg_1; - -void textureSampleGrad_e9a2f7() { - vec4 res = textureGradOffset(arg_0_arg_1, vec3(0.0f), vec3(0.0f), vec3(0.0f), ivec3(0)); -} - -vec4 vertex_main() { - textureSampleGrad_e9a2f7(); - return vec4(0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp sampler3D arg_0_arg_1; - -void textureSampleGrad_e9a2f7() { - vec4 res = textureGradOffset(arg_0_arg_1, vec3(0.0f), vec3(0.0f), vec3(0.0f), ivec3(0)); -} - -void fragment_main() { - textureSampleGrad_e9a2f7(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp sampler3D arg_0_arg_1; - -void textureSampleGrad_e9a2f7() { - vec4 res = textureGradOffset(arg_0_arg_1, vec3(0.0f), vec3(0.0f), vec3(0.0f), ivec3(0)); -} - -void compute_main() { - textureSampleGrad_e9a2f7(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/e9a2f7.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureSampleGrad/e9a2f7.wgsl.expected.hlsl deleted file mode 100644 index 5ef518923a..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleGrad/e9a2f7.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -Texture3D arg_0 : register(t0, space1); -SamplerState arg_1 : register(s1, space1); - -void textureSampleGrad_e9a2f7() { - float4 res = arg_0.SampleGrad(arg_1, (0.0f).xxx, (0.0f).xxx, (0.0f).xxx, (0).xxx); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureSampleGrad_e9a2f7(); - return (0.0f).xxxx; -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureSampleGrad_e9a2f7(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureSampleGrad_e9a2f7(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/e9a2f7.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleGrad/e9a2f7.wgsl.expected.msl deleted file mode 100644 index 4b6c3aa43c..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleGrad/e9a2f7.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureSampleGrad_e9a2f7(texture3d tint_symbol_1, sampler tint_symbol_2) { - float4 res = tint_symbol_1.sample(tint_symbol_2, float3(0.0f), gradient3d(float3(0.0f), float3(0.0f)), int3(0)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture3d tint_symbol_3, sampler tint_symbol_4) { - textureSampleGrad_e9a2f7(tint_symbol_3, tint_symbol_4); - return float4(0.0f); -} - -vertex tint_symbol vertex_main(texture3d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture3d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureSampleGrad_e9a2f7(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(texture3d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureSampleGrad_e9a2f7(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/e9a2f7.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleGrad/e9a2f7.wgsl.expected.spvasm deleted file mode 100644 index a54c398690..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleGrad/e9a2f7.wgsl.expected.spvasm +++ /dev/null @@ -1,85 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 45 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_0 "arg_0" - OpName %arg_1 "arg_1" - OpName %textureSampleGrad_e9a2f7 "textureSampleGrad_e9a2f7" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %11 = OpTypeImage %float 3D 0 0 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %14 = OpTypeSampler -%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 - %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant - %void = OpTypeVoid - %15 = OpTypeFunction %void - %22 = OpTypeSampledImage %11 - %v3float = OpTypeVector %float 3 - %25 = OpConstantNull %v3float - %int = OpTypeInt 32 1 - %v3int = OpTypeVector %int 3 - %28 = OpConstantNull %v3int -%_ptr_Function_v4float = OpTypePointer Function %v4float - %31 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureSampleGrad_e9a2f7 = OpFunction %void None %15 - %18 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %20 = OpLoad %14 %arg_1 - %21 = OpLoad %11 %arg_0 - %23 = OpSampledImage %22 %21 %20 - %19 = OpImageSampleExplicitLod %v4float %23 %25 Grad|ConstOffset %25 %25 %28 - OpStore %res %19 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %31 - %33 = OpLabel - %34 = OpFunctionCall %void %textureSampleGrad_e9a2f7 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %15 - %36 = OpLabel - %37 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %37 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %15 - %40 = OpLabel - %41 = OpFunctionCall %void %textureSampleGrad_e9a2f7 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %15 - %43 = OpLabel - %44 = OpFunctionCall %void %textureSampleGrad_e9a2f7 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/e9a2f7.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleGrad/e9a2f7.wgsl.expected.wgsl deleted file mode 100644 index 4336d026ac..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleGrad/e9a2f7.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_3d; - -@group(1) @binding(1) var arg_1 : sampler; - -fn textureSampleGrad_e9a2f7() { - var res : vec4 = textureSampleGrad(arg_0, arg_1, vec3(), vec3(), vec3(), vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleGrad_e9a2f7(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleGrad_e9a2f7(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleGrad_e9a2f7(); -} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/0b0a1b.wgsl b/test/tint/builtins/gen/literal/textureSampleLevel/0b0a1b.wgsl new file mode 100644 index 0000000000..77fd0c9d4a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/0b0a1b.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleLevel(texture: texture_2d, sampler: sampler, coords: vec2, level: f32, @const offset: vec2) -> vec4 +fn textureSampleLevel_0b0a1b() { + var res: vec4 = textureSampleLevel(arg_0, arg_1, vec2(), 1.0, vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_0b0a1b(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleLevel_0b0a1b(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleLevel_0b0a1b(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/0b0a1b.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleLevel/0b0a1b.wgsl.expected.glsl new file mode 100644 index 0000000000..ef80252f31 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/0b0a1b.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp sampler2D arg_0_arg_1; + +void textureSampleLevel_0b0a1b() { + vec4 res = textureLodOffset(arg_0_arg_1, vec2(0.0f), 1.0f, ivec2(0)); +} + +vec4 vertex_main() { + textureSampleLevel_0b0a1b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2D arg_0_arg_1; + +void textureSampleLevel_0b0a1b() { + vec4 res = textureLodOffset(arg_0_arg_1, vec2(0.0f), 1.0f, ivec2(0)); +} + +void fragment_main() { + textureSampleLevel_0b0a1b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2D arg_0_arg_1; + +void textureSampleLevel_0b0a1b() { + vec4 res = textureLodOffset(arg_0_arg_1, vec2(0.0f), 1.0f, ivec2(0)); +} + +void compute_main() { + textureSampleLevel_0b0a1b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/0b0a1b.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureSampleLevel/0b0a1b.wgsl.expected.hlsl new file mode 100644 index 0000000000..aee4c233d2 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/0b0a1b.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_0b0a1b() { + float4 res = arg_0.SampleLevel(arg_1, (0.0f).xx, 1.0f, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_0b0a1b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_0b0a1b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_0b0a1b(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/0b0a1b.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleLevel/0b0a1b.wgsl.expected.msl new file mode 100644 index 0000000000..506a971caa --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/0b0a1b.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureSampleLevel_0b0a1b(texture2d tint_symbol_1, sampler tint_symbol_2) { + float4 res = tint_symbol_1.sample(tint_symbol_2, float2(0.0f), level(1.0f), int2(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_3, sampler tint_symbol_4) { + textureSampleLevel_0b0a1b(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleLevel_0b0a1b(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleLevel_0b0a1b(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/0b0a1b.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleLevel/0b0a1b.wgsl.expected.spvasm new file mode 100644 index 0000000000..fd46b38f9f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/0b0a1b.wgsl.expected.spvasm @@ -0,0 +1,85 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleLevel_0b0a1b "textureSampleLevel_0b0a1b" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %22 = OpTypeSampledImage %11 + %v2float = OpTypeVector %float 2 + %25 = OpConstantNull %v2float + %float_1 = OpConstant %float 1 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %29 = OpConstantNull %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %32 = OpTypeFunction %v4float +%textureSampleLevel_0b0a1b = OpFunction %void None %15 + %18 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %20 = OpLoad %14 %arg_1 + %21 = OpLoad %11 %arg_0 + %23 = OpSampledImage %22 %21 %20 + %19 = OpImageSampleExplicitLod %v4float %23 %25 Lod|ConstOffset %float_1 %29 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %32 + %34 = OpLabel + %35 = OpFunctionCall %void %textureSampleLevel_0b0a1b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %37 = OpLabel + %38 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %38 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %40 = OpLabel + %41 = OpFunctionCall %void %textureSampleLevel_0b0a1b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %43 = OpLabel + %44 = OpFunctionCall %void %textureSampleLevel_0b0a1b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/0b0a1b.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleLevel/0b0a1b.wgsl.expected.wgsl new file mode 100644 index 0000000000..2520fdb01e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/0b0a1b.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_2d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleLevel_0b0a1b() { + var res : vec4 = textureSampleLevel(arg_0, arg_1, vec2(), 1.0, vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_0b0a1b(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleLevel_0b0a1b(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleLevel_0b0a1b(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/36780e.wgsl b/test/tint/builtins/gen/literal/textureSampleLevel/36780e.wgsl new file mode 100644 index 0000000000..c44741a6b9 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/36780e.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d_array; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleLevel(texture: texture_depth_2d_array, sampler: sampler, coords: vec2, array_index: i32, level: i32, @const offset: vec2) -> f32 +fn textureSampleLevel_36780e() { + var res: f32 = textureSampleLevel(arg_0, arg_1, vec2(), 1, 0, vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_36780e(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleLevel_36780e(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleLevel_36780e(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/36780e.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleLevel/36780e.wgsl.expected.glsl new file mode 100644 index 0000000000..39c836fa62 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/36780e.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureSampleLevel_36780e() { + float res = textureLodOffset(arg_0_arg_1, vec4(0.0f, 0.0f, float(1), 0.0f), float(0), ivec2(0)); +} + +vec4 vertex_main() { + textureSampleLevel_36780e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:6: 'textureLodOffset' : no matching overloaded function found +ERROR: 0:6: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureSampleLevel_36780e() { + float res = textureLodOffset(arg_0_arg_1, vec4(0.0f, 0.0f, float(1), 0.0f), float(0), ivec2(0)); +} + +void fragment_main() { + textureSampleLevel_36780e(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:7: 'textureLodOffset' : no matching overloaded function found +ERROR: 0:7: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureSampleLevel_36780e() { + float res = textureLodOffset(arg_0_arg_1, vec4(0.0f, 0.0f, float(1), 0.0f), float(0), ivec2(0)); +} + +void compute_main() { + textureSampleLevel_36780e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:6: 'textureLodOffset' : no matching overloaded function found +ERROR: 0:6: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/36780e.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureSampleLevel/36780e.wgsl.expected.hlsl new file mode 100644 index 0000000000..960a0a4fcb --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/36780e.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_36780e() { + float res = arg_0.SampleLevel(arg_1, float3(0.0f, 0.0f, float(1)), 0, (0).xx).x; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_36780e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_36780e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_36780e(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/36780e.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleLevel/36780e.wgsl.expected.msl new file mode 100644 index 0000000000..cac62ab95b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/36780e.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureSampleLevel_36780e(depth2d_array tint_symbol_1, sampler tint_symbol_2) { + float res = tint_symbol_1.sample(tint_symbol_2, float2(0.0f), 1, level(0), int2(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d_array tint_symbol_3, sampler tint_symbol_4) { + textureSampleLevel_36780e(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleLevel_36780e(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depth2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleLevel_36780e(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/36780e.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleLevel/36780e.wgsl.expected.spvasm new file mode 100644 index 0000000000..9f3edb6735 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/36780e.wgsl.expected.spvasm @@ -0,0 +1,91 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 51 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleLevel_36780e "textureSampleLevel_36780e" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %23 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 + %float_0 = OpConstant %float 0 + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %32 = OpConstantNull %int + %v2int = OpTypeVector %int 2 + %34 = OpConstantNull %v2int +%_ptr_Function_float = OpTypePointer Function %float + %37 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureSampleLevel_36780e = OpFunction %void None %15 + %18 = OpLabel + %res = OpVariable %_ptr_Function_float Function %8 + %21 = OpLoad %14 %arg_1 + %22 = OpLoad %11 %arg_0 + %24 = OpSampledImage %23 %22 %21 + %27 = OpConvertSToF %float %int_1 + %30 = OpCompositeConstruct %v3float %float_0 %float_0 %27 + %31 = OpConvertSToF %float %32 + %20 = OpImageSampleExplicitLod %v4float %24 %30 Lod|ConstOffset %31 %34 + %19 = OpCompositeExtract %float %20 0 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %37 + %39 = OpLabel + %40 = OpFunctionCall %void %textureSampleLevel_36780e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %42 = OpLabel + %43 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %43 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %46 = OpLabel + %47 = OpFunctionCall %void %textureSampleLevel_36780e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %49 = OpLabel + %50 = OpFunctionCall %void %textureSampleLevel_36780e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/36780e.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleLevel/36780e.wgsl.expected.wgsl new file mode 100644 index 0000000000..01d1245e98 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/36780e.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d_array; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleLevel_36780e() { + var res : f32 = textureSampleLevel(arg_0, arg_1, vec2(), 1, 0, vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_36780e(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleLevel_36780e(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleLevel_36780e(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/47daa4.wgsl b/test/tint/builtins/gen/literal/textureSampleLevel/47daa4.wgsl deleted file mode 100644 index 80138d3211..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleLevel/47daa4.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/gen/gen.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_depth_2d; -@group(1) @binding(1) var arg_1: sampler; - -// fn textureSampleLevel(texture: texture_depth_2d, sampler: sampler, coords: vec2, level: i32, offset: vec2) -> f32 -fn textureSampleLevel_47daa4() { - var res: f32 = textureSampleLevel(arg_0, arg_1, vec2(), 0, vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleLevel_47daa4(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleLevel_47daa4(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleLevel_47daa4(); -} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/47daa4.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleLevel/47daa4.wgsl.expected.glsl deleted file mode 100644 index 9ae6c0024a..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleLevel/47daa4.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp sampler2DShadow arg_0_arg_1; - -void textureSampleLevel_47daa4() { - float res = textureLodOffset(arg_0_arg_1, vec3(0.0f, 0.0f, 0.0f), float(0), ivec2(0)); -} - -vec4 vertex_main() { - textureSampleLevel_47daa4(); - return vec4(0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp sampler2DShadow arg_0_arg_1; - -void textureSampleLevel_47daa4() { - float res = textureLodOffset(arg_0_arg_1, vec3(0.0f, 0.0f, 0.0f), float(0), ivec2(0)); -} - -void fragment_main() { - textureSampleLevel_47daa4(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp sampler2DShadow arg_0_arg_1; - -void textureSampleLevel_47daa4() { - float res = textureLodOffset(arg_0_arg_1, vec3(0.0f, 0.0f, 0.0f), float(0), ivec2(0)); -} - -void compute_main() { - textureSampleLevel_47daa4(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/47daa4.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureSampleLevel/47daa4.wgsl.expected.hlsl deleted file mode 100644 index faf0772cfb..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleLevel/47daa4.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -Texture2D arg_0 : register(t0, space1); -SamplerState arg_1 : register(s1, space1); - -void textureSampleLevel_47daa4() { - float res = arg_0.SampleLevel(arg_1, (0.0f).xx, 0, (0).xx).x; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureSampleLevel_47daa4(); - return (0.0f).xxxx; -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureSampleLevel_47daa4(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureSampleLevel_47daa4(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/47daa4.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleLevel/47daa4.wgsl.expected.msl deleted file mode 100644 index aad3dda42c..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleLevel/47daa4.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureSampleLevel_47daa4(depth2d tint_symbol_1, sampler tint_symbol_2) { - float res = tint_symbol_1.sample(tint_symbol_2, float2(0.0f), level(0), int2(0)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(depth2d tint_symbol_3, sampler tint_symbol_4) { - textureSampleLevel_47daa4(tint_symbol_3, tint_symbol_4); - return float4(0.0f); -} - -vertex tint_symbol vertex_main(depth2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(depth2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureSampleLevel_47daa4(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(depth2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureSampleLevel_47daa4(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/47daa4.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleLevel/47daa4.wgsl.expected.spvasm deleted file mode 100644 index 6ec86741da..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleLevel/47daa4.wgsl.expected.spvasm +++ /dev/null @@ -1,88 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 48 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_0 "arg_0" - OpName %arg_1 "arg_1" - OpName %textureSampleLevel_47daa4 "textureSampleLevel_47daa4" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %11 = OpTypeImage %float 2D 0 0 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %14 = OpTypeSampler -%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 - %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant - %void = OpTypeVoid - %15 = OpTypeFunction %void - %23 = OpTypeSampledImage %11 - %v2float = OpTypeVector %float 2 - %26 = OpConstantNull %v2float - %int = OpTypeInt 32 1 - %29 = OpConstantNull %int - %v2int = OpTypeVector %int 2 - %31 = OpConstantNull %v2int -%_ptr_Function_float = OpTypePointer Function %float - %34 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureSampleLevel_47daa4 = OpFunction %void None %15 - %18 = OpLabel - %res = OpVariable %_ptr_Function_float Function %8 - %21 = OpLoad %14 %arg_1 - %22 = OpLoad %11 %arg_0 - %24 = OpSampledImage %23 %22 %21 - %27 = OpConvertSToF %float %29 - %20 = OpImageSampleExplicitLod %v4float %24 %26 Lod|ConstOffset %27 %31 - %19 = OpCompositeExtract %float %20 0 - OpStore %res %19 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %34 - %36 = OpLabel - %37 = OpFunctionCall %void %textureSampleLevel_47daa4 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %15 - %39 = OpLabel - %40 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %40 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %15 - %43 = OpLabel - %44 = OpFunctionCall %void %textureSampleLevel_47daa4 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %15 - %46 = OpLabel - %47 = OpFunctionCall %void %textureSampleLevel_47daa4 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/47daa4.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleLevel/47daa4.wgsl.expected.wgsl deleted file mode 100644 index 28ee9080ea..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleLevel/47daa4.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_depth_2d; - -@group(1) @binding(1) var arg_1 : sampler; - -fn textureSampleLevel_47daa4() { - var res : f32 = textureSampleLevel(arg_0, arg_1, vec2(), 0, vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleLevel_47daa4(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleLevel_47daa4(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleLevel_47daa4(); -} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/690d95.wgsl b/test/tint/builtins/gen/literal/textureSampleLevel/690d95.wgsl deleted file mode 100644 index eee0171efb..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleLevel/690d95.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/gen/gen.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_2d; -@group(1) @binding(1) var arg_1: sampler; - -// fn textureSampleLevel(texture: texture_2d, sampler: sampler, coords: vec2, level: f32, offset: vec2) -> vec4 -fn textureSampleLevel_690d95() { - var res: vec4 = textureSampleLevel(arg_0, arg_1, vec2(), 1.0, vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleLevel_690d95(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleLevel_690d95(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleLevel_690d95(); -} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/690d95.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleLevel/690d95.wgsl.expected.glsl deleted file mode 100644 index 03b78b6ffa..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleLevel/690d95.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp sampler2D arg_0_arg_1; - -void textureSampleLevel_690d95() { - vec4 res = textureLodOffset(arg_0_arg_1, vec2(0.0f), 1.0f, ivec2(0)); -} - -vec4 vertex_main() { - textureSampleLevel_690d95(); - return vec4(0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp sampler2D arg_0_arg_1; - -void textureSampleLevel_690d95() { - vec4 res = textureLodOffset(arg_0_arg_1, vec2(0.0f), 1.0f, ivec2(0)); -} - -void fragment_main() { - textureSampleLevel_690d95(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp sampler2D arg_0_arg_1; - -void textureSampleLevel_690d95() { - vec4 res = textureLodOffset(arg_0_arg_1, vec2(0.0f), 1.0f, ivec2(0)); -} - -void compute_main() { - textureSampleLevel_690d95(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/690d95.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureSampleLevel/690d95.wgsl.expected.hlsl deleted file mode 100644 index cc0110426b..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleLevel/690d95.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -Texture2D arg_0 : register(t0, space1); -SamplerState arg_1 : register(s1, space1); - -void textureSampleLevel_690d95() { - float4 res = arg_0.SampleLevel(arg_1, (0.0f).xx, 1.0f, (0).xx); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureSampleLevel_690d95(); - return (0.0f).xxxx; -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureSampleLevel_690d95(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureSampleLevel_690d95(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/690d95.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleLevel/690d95.wgsl.expected.msl deleted file mode 100644 index ef3cb4c0ef..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleLevel/690d95.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureSampleLevel_690d95(texture2d tint_symbol_1, sampler tint_symbol_2) { - float4 res = tint_symbol_1.sample(tint_symbol_2, float2(0.0f), level(1.0f), int2(0)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d tint_symbol_3, sampler tint_symbol_4) { - textureSampleLevel_690d95(tint_symbol_3, tint_symbol_4); - return float4(0.0f); -} - -vertex tint_symbol vertex_main(texture2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureSampleLevel_690d95(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(texture2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureSampleLevel_690d95(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/690d95.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleLevel/690d95.wgsl.expected.spvasm deleted file mode 100644 index 50a4990458..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleLevel/690d95.wgsl.expected.spvasm +++ /dev/null @@ -1,85 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 45 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_0 "arg_0" - OpName %arg_1 "arg_1" - OpName %textureSampleLevel_690d95 "textureSampleLevel_690d95" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %11 = OpTypeImage %float 2D 0 0 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %14 = OpTypeSampler -%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 - %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant - %void = OpTypeVoid - %15 = OpTypeFunction %void - %22 = OpTypeSampledImage %11 - %v2float = OpTypeVector %float 2 - %25 = OpConstantNull %v2float - %float_1 = OpConstant %float 1 - %int = OpTypeInt 32 1 - %v2int = OpTypeVector %int 2 - %29 = OpConstantNull %v2int -%_ptr_Function_v4float = OpTypePointer Function %v4float - %32 = OpTypeFunction %v4float -%textureSampleLevel_690d95 = OpFunction %void None %15 - %18 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %20 = OpLoad %14 %arg_1 - %21 = OpLoad %11 %arg_0 - %23 = OpSampledImage %22 %21 %20 - %19 = OpImageSampleExplicitLod %v4float %23 %25 Lod|ConstOffset %float_1 %29 - OpStore %res %19 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %32 - %34 = OpLabel - %35 = OpFunctionCall %void %textureSampleLevel_690d95 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %15 - %37 = OpLabel - %38 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %38 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %15 - %40 = OpLabel - %41 = OpFunctionCall %void %textureSampleLevel_690d95 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %15 - %43 = OpLabel - %44 = OpFunctionCall %void %textureSampleLevel_690d95 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/690d95.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleLevel/690d95.wgsl.expected.wgsl deleted file mode 100644 index 6584e4654b..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleLevel/690d95.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_2d; - -@group(1) @binding(1) var arg_1 : sampler; - -fn textureSampleLevel_690d95() { - var res : vec4 = textureSampleLevel(arg_0, arg_1, vec2(), 1.0, vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleLevel_690d95(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleLevel_690d95(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleLevel_690d95(); -} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/749baf.wgsl b/test/tint/builtins/gen/literal/textureSampleLevel/749baf.wgsl new file mode 100644 index 0000000000..d043c1b8ff --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/749baf.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleLevel(texture: texture_depth_2d, sampler: sampler, coords: vec2, level: i32, @const offset: vec2) -> f32 +fn textureSampleLevel_749baf() { + var res: f32 = textureSampleLevel(arg_0, arg_1, vec2(), 0, vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_749baf(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleLevel_749baf(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleLevel_749baf(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/749baf.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleLevel/749baf.wgsl.expected.glsl new file mode 100644 index 0000000000..6d73eaaf5a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/749baf.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureSampleLevel_749baf() { + float res = textureLodOffset(arg_0_arg_1, vec3(0.0f, 0.0f, 0.0f), float(0), ivec2(0)); +} + +vec4 vertex_main() { + textureSampleLevel_749baf(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureSampleLevel_749baf() { + float res = textureLodOffset(arg_0_arg_1, vec3(0.0f, 0.0f, 0.0f), float(0), ivec2(0)); +} + +void fragment_main() { + textureSampleLevel_749baf(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureSampleLevel_749baf() { + float res = textureLodOffset(arg_0_arg_1, vec3(0.0f, 0.0f, 0.0f), float(0), ivec2(0)); +} + +void compute_main() { + textureSampleLevel_749baf(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/749baf.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureSampleLevel/749baf.wgsl.expected.hlsl new file mode 100644 index 0000000000..a05a17b724 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/749baf.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_749baf() { + float res = arg_0.SampleLevel(arg_1, (0.0f).xx, 0, (0).xx).x; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_749baf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_749baf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_749baf(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/749baf.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleLevel/749baf.wgsl.expected.msl new file mode 100644 index 0000000000..360b8569c0 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/749baf.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureSampleLevel_749baf(depth2d tint_symbol_1, sampler tint_symbol_2) { + float res = tint_symbol_1.sample(tint_symbol_2, float2(0.0f), level(0), int2(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d tint_symbol_3, sampler tint_symbol_4) { + textureSampleLevel_749baf(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleLevel_749baf(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depth2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleLevel_749baf(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/749baf.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleLevel/749baf.wgsl.expected.spvasm new file mode 100644 index 0000000000..e2b0e1f79a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/749baf.wgsl.expected.spvasm @@ -0,0 +1,88 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 48 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleLevel_749baf "textureSampleLevel_749baf" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %23 = OpTypeSampledImage %11 + %v2float = OpTypeVector %float 2 + %26 = OpConstantNull %v2float + %int = OpTypeInt 32 1 + %29 = OpConstantNull %int + %v2int = OpTypeVector %int 2 + %31 = OpConstantNull %v2int +%_ptr_Function_float = OpTypePointer Function %float + %34 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureSampleLevel_749baf = OpFunction %void None %15 + %18 = OpLabel + %res = OpVariable %_ptr_Function_float Function %8 + %21 = OpLoad %14 %arg_1 + %22 = OpLoad %11 %arg_0 + %24 = OpSampledImage %23 %22 %21 + %27 = OpConvertSToF %float %29 + %20 = OpImageSampleExplicitLod %v4float %24 %26 Lod|ConstOffset %27 %31 + %19 = OpCompositeExtract %float %20 0 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %34 + %36 = OpLabel + %37 = OpFunctionCall %void %textureSampleLevel_749baf + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %39 = OpLabel + %40 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %40 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %43 = OpLabel + %44 = OpFunctionCall %void %textureSampleLevel_749baf + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %46 = OpLabel + %47 = OpFunctionCall %void %textureSampleLevel_749baf + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/749baf.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleLevel/749baf.wgsl.expected.wgsl new file mode 100644 index 0000000000..01d93a0fbe --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/749baf.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleLevel_749baf() { + var res : f32 = textureSampleLevel(arg_0, arg_1, vec2(), 0, vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_749baf(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleLevel_749baf(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleLevel_749baf(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/9bd37b.wgsl b/test/tint/builtins/gen/literal/textureSampleLevel/9bd37b.wgsl deleted file mode 100644 index a49142f143..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleLevel/9bd37b.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/gen/gen.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_3d; -@group(1) @binding(1) var arg_1: sampler; - -// fn textureSampleLevel(texture: texture_3d, sampler: sampler, coords: vec3, level: f32, offset: vec3) -> vec4 -fn textureSampleLevel_9bd37b() { - var res: vec4 = textureSampleLevel(arg_0, arg_1, vec3(), 1.0, vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleLevel_9bd37b(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleLevel_9bd37b(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleLevel_9bd37b(); -} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/9bd37b.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleLevel/9bd37b.wgsl.expected.glsl deleted file mode 100644 index c2f30d11e1..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleLevel/9bd37b.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp sampler3D arg_0_arg_1; - -void textureSampleLevel_9bd37b() { - vec4 res = textureLodOffset(arg_0_arg_1, vec3(0.0f), 1.0f, ivec3(0)); -} - -vec4 vertex_main() { - textureSampleLevel_9bd37b(); - return vec4(0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp sampler3D arg_0_arg_1; - -void textureSampleLevel_9bd37b() { - vec4 res = textureLodOffset(arg_0_arg_1, vec3(0.0f), 1.0f, ivec3(0)); -} - -void fragment_main() { - textureSampleLevel_9bd37b(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp sampler3D arg_0_arg_1; - -void textureSampleLevel_9bd37b() { - vec4 res = textureLodOffset(arg_0_arg_1, vec3(0.0f), 1.0f, ivec3(0)); -} - -void compute_main() { - textureSampleLevel_9bd37b(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/9bd37b.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureSampleLevel/9bd37b.wgsl.expected.hlsl deleted file mode 100644 index 66d65781b6..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleLevel/9bd37b.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -Texture3D arg_0 : register(t0, space1); -SamplerState arg_1 : register(s1, space1); - -void textureSampleLevel_9bd37b() { - float4 res = arg_0.SampleLevel(arg_1, (0.0f).xxx, 1.0f, (0).xxx); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureSampleLevel_9bd37b(); - return (0.0f).xxxx; -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureSampleLevel_9bd37b(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureSampleLevel_9bd37b(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/9bd37b.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleLevel/9bd37b.wgsl.expected.msl deleted file mode 100644 index 6559dc0d5c..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleLevel/9bd37b.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureSampleLevel_9bd37b(texture3d tint_symbol_1, sampler tint_symbol_2) { - float4 res = tint_symbol_1.sample(tint_symbol_2, float3(0.0f), level(1.0f), int3(0)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture3d tint_symbol_3, sampler tint_symbol_4) { - textureSampleLevel_9bd37b(tint_symbol_3, tint_symbol_4); - return float4(0.0f); -} - -vertex tint_symbol vertex_main(texture3d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture3d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureSampleLevel_9bd37b(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(texture3d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureSampleLevel_9bd37b(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/9bd37b.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleLevel/9bd37b.wgsl.expected.spvasm deleted file mode 100644 index 661813303a..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleLevel/9bd37b.wgsl.expected.spvasm +++ /dev/null @@ -1,85 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 45 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_0 "arg_0" - OpName %arg_1 "arg_1" - OpName %textureSampleLevel_9bd37b "textureSampleLevel_9bd37b" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %11 = OpTypeImage %float 3D 0 0 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %14 = OpTypeSampler -%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 - %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant - %void = OpTypeVoid - %15 = OpTypeFunction %void - %22 = OpTypeSampledImage %11 - %v3float = OpTypeVector %float 3 - %25 = OpConstantNull %v3float - %float_1 = OpConstant %float 1 - %int = OpTypeInt 32 1 - %v3int = OpTypeVector %int 3 - %29 = OpConstantNull %v3int -%_ptr_Function_v4float = OpTypePointer Function %v4float - %32 = OpTypeFunction %v4float -%textureSampleLevel_9bd37b = OpFunction %void None %15 - %18 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %20 = OpLoad %14 %arg_1 - %21 = OpLoad %11 %arg_0 - %23 = OpSampledImage %22 %21 %20 - %19 = OpImageSampleExplicitLod %v4float %23 %25 Lod|ConstOffset %float_1 %29 - OpStore %res %19 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %32 - %34 = OpLabel - %35 = OpFunctionCall %void %textureSampleLevel_9bd37b - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %15 - %37 = OpLabel - %38 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %38 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %15 - %40 = OpLabel - %41 = OpFunctionCall %void %textureSampleLevel_9bd37b - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %15 - %43 = OpLabel - %44 = OpFunctionCall %void %textureSampleLevel_9bd37b - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/9bd37b.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleLevel/9bd37b.wgsl.expected.wgsl deleted file mode 100644 index 081f0c3acc..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleLevel/9bd37b.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_3d; - -@group(1) @binding(1) var arg_1 : sampler; - -fn textureSampleLevel_9bd37b() { - var res : vec4 = textureSampleLevel(arg_0, arg_1, vec3(), 1.0, vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleLevel_9bd37b(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleLevel_9bd37b(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleLevel_9bd37b(); -} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/a4af26.wgsl b/test/tint/builtins/gen/literal/textureSampleLevel/a4af26.wgsl deleted file mode 100644 index fee26c2b02..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleLevel/a4af26.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/gen/gen.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_2d_array; -@group(1) @binding(1) var arg_1: sampler; - -// fn textureSampleLevel(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, level: f32, offset: vec2) -> vec4 -fn textureSampleLevel_a4af26() { - var res: vec4 = textureSampleLevel(arg_0, arg_1, vec2(), 1, 1.0, vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleLevel_a4af26(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleLevel_a4af26(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleLevel_a4af26(); -} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/a4af26.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleLevel/a4af26.wgsl.expected.glsl deleted file mode 100644 index 3d7746cc98..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleLevel/a4af26.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp sampler2DArray arg_0_arg_1; - -void textureSampleLevel_a4af26() { - vec4 res = textureLodOffset(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), 1.0f, ivec2(0)); -} - -vec4 vertex_main() { - textureSampleLevel_a4af26(); - return vec4(0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp sampler2DArray arg_0_arg_1; - -void textureSampleLevel_a4af26() { - vec4 res = textureLodOffset(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), 1.0f, ivec2(0)); -} - -void fragment_main() { - textureSampleLevel_a4af26(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp sampler2DArray arg_0_arg_1; - -void textureSampleLevel_a4af26() { - vec4 res = textureLodOffset(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), 1.0f, ivec2(0)); -} - -void compute_main() { - textureSampleLevel_a4af26(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/a4af26.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureSampleLevel/a4af26.wgsl.expected.hlsl deleted file mode 100644 index d6bb7d63c7..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleLevel/a4af26.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -Texture2DArray arg_0 : register(t0, space1); -SamplerState arg_1 : register(s1, space1); - -void textureSampleLevel_a4af26() { - float4 res = arg_0.SampleLevel(arg_1, float3(0.0f, 0.0f, float(1)), 1.0f, (0).xx); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureSampleLevel_a4af26(); - return (0.0f).xxxx; -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureSampleLevel_a4af26(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureSampleLevel_a4af26(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/a4af26.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleLevel/a4af26.wgsl.expected.msl deleted file mode 100644 index f81889a5dd..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleLevel/a4af26.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureSampleLevel_a4af26(texture2d_array tint_symbol_1, sampler tint_symbol_2) { - float4 res = tint_symbol_1.sample(tint_symbol_2, float2(0.0f), 1, level(1.0f), int2(0)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_3, sampler tint_symbol_4) { - textureSampleLevel_a4af26(tint_symbol_3, tint_symbol_4); - return float4(0.0f); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureSampleLevel_a4af26(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureSampleLevel_a4af26(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/a4af26.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleLevel/a4af26.wgsl.expected.spvasm deleted file mode 100644 index ddb13a5fdf..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleLevel/a4af26.wgsl.expected.spvasm +++ /dev/null @@ -1,88 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 48 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_0 "arg_0" - OpName %arg_1 "arg_1" - OpName %textureSampleLevel_a4af26 "textureSampleLevel_a4af26" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %11 = OpTypeImage %float 2D 0 1 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %14 = OpTypeSampler -%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 - %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant - %void = OpTypeVoid - %15 = OpTypeFunction %void - %22 = OpTypeSampledImage %11 - %v3float = OpTypeVector %float 3 - %float_0 = OpConstant %float 0 - %int = OpTypeInt 32 1 - %int_1 = OpConstant %int 1 - %float_1 = OpConstant %float 1 - %v2int = OpTypeVector %int 2 - %32 = OpConstantNull %v2int -%_ptr_Function_v4float = OpTypePointer Function %v4float - %35 = OpTypeFunction %v4float -%textureSampleLevel_a4af26 = OpFunction %void None %15 - %18 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %20 = OpLoad %14 %arg_1 - %21 = OpLoad %11 %arg_0 - %23 = OpSampledImage %22 %21 %20 - %26 = OpConvertSToF %float %int_1 - %29 = OpCompositeConstruct %v3float %float_0 %float_0 %26 - %19 = OpImageSampleExplicitLod %v4float %23 %29 Lod|ConstOffset %float_1 %32 - OpStore %res %19 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %35 - %37 = OpLabel - %38 = OpFunctionCall %void %textureSampleLevel_a4af26 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %15 - %40 = OpLabel - %41 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %41 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %15 - %43 = OpLabel - %44 = OpFunctionCall %void %textureSampleLevel_a4af26 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %15 - %46 = OpLabel - %47 = OpFunctionCall %void %textureSampleLevel_a4af26 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/a4af26.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleLevel/a4af26.wgsl.expected.wgsl deleted file mode 100644 index 69f8f800dc..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleLevel/a4af26.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_2d_array; - -@group(1) @binding(1) var arg_1 : sampler; - -fn textureSampleLevel_a4af26() { - var res : vec4 = textureSampleLevel(arg_0, arg_1, vec2(), 1, 1.0, vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleLevel_a4af26(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleLevel_a4af26(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleLevel_a4af26(); -} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/b7c55c.wgsl b/test/tint/builtins/gen/literal/textureSampleLevel/b7c55c.wgsl new file mode 100644 index 0000000000..2a2cf1f5b2 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/b7c55c.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleLevel(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, level: f32, @const offset: vec2) -> vec4 +fn textureSampleLevel_b7c55c() { + var res: vec4 = textureSampleLevel(arg_0, arg_1, vec2(), 1, 1.0, vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_b7c55c(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleLevel_b7c55c(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleLevel_b7c55c(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/b7c55c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleLevel/b7c55c.wgsl.expected.glsl new file mode 100644 index 0000000000..31e57047bc --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/b7c55c.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp sampler2DArray arg_0_arg_1; + +void textureSampleLevel_b7c55c() { + vec4 res = textureLodOffset(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), 1.0f, ivec2(0)); +} + +vec4 vertex_main() { + textureSampleLevel_b7c55c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DArray arg_0_arg_1; + +void textureSampleLevel_b7c55c() { + vec4 res = textureLodOffset(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), 1.0f, ivec2(0)); +} + +void fragment_main() { + textureSampleLevel_b7c55c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DArray arg_0_arg_1; + +void textureSampleLevel_b7c55c() { + vec4 res = textureLodOffset(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), 1.0f, ivec2(0)); +} + +void compute_main() { + textureSampleLevel_b7c55c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/b7c55c.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureSampleLevel/b7c55c.wgsl.expected.hlsl new file mode 100644 index 0000000000..2f3441f975 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/b7c55c.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_b7c55c() { + float4 res = arg_0.SampleLevel(arg_1, float3(0.0f, 0.0f, float(1)), 1.0f, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_b7c55c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_b7c55c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_b7c55c(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/b7c55c.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleLevel/b7c55c.wgsl.expected.msl new file mode 100644 index 0000000000..8847f18bb0 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/b7c55c.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureSampleLevel_b7c55c(texture2d_array tint_symbol_1, sampler tint_symbol_2) { + float4 res = tint_symbol_1.sample(tint_symbol_2, float2(0.0f), 1, level(1.0f), int2(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_3, sampler tint_symbol_4) { + textureSampleLevel_b7c55c(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleLevel_b7c55c(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleLevel_b7c55c(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/b7c55c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleLevel/b7c55c.wgsl.expected.spvasm new file mode 100644 index 0000000000..2f007230a5 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/b7c55c.wgsl.expected.spvasm @@ -0,0 +1,88 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 48 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleLevel_b7c55c "textureSampleLevel_b7c55c" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %22 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 + %float_0 = OpConstant %float 0 + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %float_1 = OpConstant %float 1 + %v2int = OpTypeVector %int 2 + %32 = OpConstantNull %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %35 = OpTypeFunction %v4float +%textureSampleLevel_b7c55c = OpFunction %void None %15 + %18 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %20 = OpLoad %14 %arg_1 + %21 = OpLoad %11 %arg_0 + %23 = OpSampledImage %22 %21 %20 + %26 = OpConvertSToF %float %int_1 + %29 = OpCompositeConstruct %v3float %float_0 %float_0 %26 + %19 = OpImageSampleExplicitLod %v4float %23 %29 Lod|ConstOffset %float_1 %32 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %35 + %37 = OpLabel + %38 = OpFunctionCall %void %textureSampleLevel_b7c55c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %40 = OpLabel + %41 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %41 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %43 = OpLabel + %44 = OpFunctionCall %void %textureSampleLevel_b7c55c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %46 = OpLabel + %47 = OpFunctionCall %void %textureSampleLevel_b7c55c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/b7c55c.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleLevel/b7c55c.wgsl.expected.wgsl new file mode 100644 index 0000000000..5f310cbc86 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/b7c55c.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleLevel_b7c55c() { + var res : vec4 = textureSampleLevel(arg_0, arg_1, vec2(), 1, 1.0, vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_b7c55c(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleLevel_b7c55c(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleLevel_b7c55c(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/ba93b3.wgsl b/test/tint/builtins/gen/literal/textureSampleLevel/ba93b3.wgsl deleted file mode 100644 index d7b2a68020..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleLevel/ba93b3.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/gen/gen.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_depth_2d_array; -@group(1) @binding(1) var arg_1: sampler; - -// fn textureSampleLevel(texture: texture_depth_2d_array, sampler: sampler, coords: vec2, array_index: i32, level: i32, offset: vec2) -> f32 -fn textureSampleLevel_ba93b3() { - var res: f32 = textureSampleLevel(arg_0, arg_1, vec2(), 1, 0, vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleLevel_ba93b3(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleLevel_ba93b3(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleLevel_ba93b3(); -} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/ba93b3.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleLevel/ba93b3.wgsl.expected.glsl deleted file mode 100644 index 033a46add8..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleLevel/ba93b3.wgsl.expected.glsl +++ /dev/null @@ -1,78 +0,0 @@ -SKIP: FAILED - -#version 310 es - -uniform highp sampler2DArrayShadow arg_0_arg_1; - -void textureSampleLevel_ba93b3() { - float res = textureLodOffset(arg_0_arg_1, vec4(0.0f, 0.0f, float(1), 0.0f), float(0), ivec2(0)); -} - -vec4 vertex_main() { - textureSampleLevel_ba93b3(); - return vec4(0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:6: 'textureLodOffset' : no matching overloaded function found -ERROR: 0:6: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -uniform highp sampler2DArrayShadow arg_0_arg_1; - -void textureSampleLevel_ba93b3() { - float res = textureLodOffset(arg_0_arg_1, vec4(0.0f, 0.0f, float(1), 0.0f), float(0), ivec2(0)); -} - -void fragment_main() { - textureSampleLevel_ba93b3(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:7: 'textureLodOffset' : no matching overloaded function found -ERROR: 0:7: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -uniform highp sampler2DArrayShadow arg_0_arg_1; - -void textureSampleLevel_ba93b3() { - float res = textureLodOffset(arg_0_arg_1, vec4(0.0f, 0.0f, float(1), 0.0f), float(0), ivec2(0)); -} - -void compute_main() { - textureSampleLevel_ba93b3(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:6: 'textureLodOffset' : no matching overloaded function found -ERROR: 0:6: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/ba93b3.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureSampleLevel/ba93b3.wgsl.expected.hlsl deleted file mode 100644 index 9ba7d7881c..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleLevel/ba93b3.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -Texture2DArray arg_0 : register(t0, space1); -SamplerState arg_1 : register(s1, space1); - -void textureSampleLevel_ba93b3() { - float res = arg_0.SampleLevel(arg_1, float3(0.0f, 0.0f, float(1)), 0, (0).xx).x; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureSampleLevel_ba93b3(); - return (0.0f).xxxx; -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureSampleLevel_ba93b3(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureSampleLevel_ba93b3(); - return; -} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/ba93b3.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleLevel/ba93b3.wgsl.expected.msl deleted file mode 100644 index 3bf4756242..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleLevel/ba93b3.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureSampleLevel_ba93b3(depth2d_array tint_symbol_1, sampler tint_symbol_2) { - float res = tint_symbol_1.sample(tint_symbol_2, float2(0.0f), 1, level(0), int2(0)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(depth2d_array tint_symbol_3, sampler tint_symbol_4) { - textureSampleLevel_ba93b3(tint_symbol_3, tint_symbol_4); - return float4(0.0f); -} - -vertex tint_symbol vertex_main(depth2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(depth2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureSampleLevel_ba93b3(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(depth2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureSampleLevel_ba93b3(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/ba93b3.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleLevel/ba93b3.wgsl.expected.spvasm deleted file mode 100644 index 4737eca809..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleLevel/ba93b3.wgsl.expected.spvasm +++ /dev/null @@ -1,91 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 51 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_0 "arg_0" - OpName %arg_1 "arg_1" - OpName %textureSampleLevel_ba93b3 "textureSampleLevel_ba93b3" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %11 = OpTypeImage %float 2D 0 1 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %14 = OpTypeSampler -%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 - %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant - %void = OpTypeVoid - %15 = OpTypeFunction %void - %23 = OpTypeSampledImage %11 - %v3float = OpTypeVector %float 3 - %float_0 = OpConstant %float 0 - %int = OpTypeInt 32 1 - %int_1 = OpConstant %int 1 - %32 = OpConstantNull %int - %v2int = OpTypeVector %int 2 - %34 = OpConstantNull %v2int -%_ptr_Function_float = OpTypePointer Function %float - %37 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureSampleLevel_ba93b3 = OpFunction %void None %15 - %18 = OpLabel - %res = OpVariable %_ptr_Function_float Function %8 - %21 = OpLoad %14 %arg_1 - %22 = OpLoad %11 %arg_0 - %24 = OpSampledImage %23 %22 %21 - %27 = OpConvertSToF %float %int_1 - %30 = OpCompositeConstruct %v3float %float_0 %float_0 %27 - %31 = OpConvertSToF %float %32 - %20 = OpImageSampleExplicitLod %v4float %24 %30 Lod|ConstOffset %31 %34 - %19 = OpCompositeExtract %float %20 0 - OpStore %res %19 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %37 - %39 = OpLabel - %40 = OpFunctionCall %void %textureSampleLevel_ba93b3 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %15 - %42 = OpLabel - %43 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %43 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %15 - %46 = OpLabel - %47 = OpFunctionCall %void %textureSampleLevel_ba93b3 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %15 - %49 = OpLabel - %50 = OpFunctionCall %void %textureSampleLevel_ba93b3 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/ba93b3.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleLevel/ba93b3.wgsl.expected.wgsl deleted file mode 100644 index 954891cb37..0000000000 --- a/test/tint/builtins/gen/literal/textureSampleLevel/ba93b3.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_depth_2d_array; - -@group(1) @binding(1) var arg_1 : sampler; - -fn textureSampleLevel_ba93b3() { - var res : f32 = textureSampleLevel(arg_0, arg_1, vec2(), 1, 0, vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleLevel_ba93b3(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleLevel_ba93b3(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleLevel_ba93b3(); -} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/dcbecb.wgsl b/test/tint/builtins/gen/literal/textureSampleLevel/dcbecb.wgsl new file mode 100644 index 0000000000..53846b4a37 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/dcbecb.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_3d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleLevel(texture: texture_3d, sampler: sampler, coords: vec3, level: f32, @const offset: vec3) -> vec4 +fn textureSampleLevel_dcbecb() { + var res: vec4 = textureSampleLevel(arg_0, arg_1, vec3(), 1.0, vec3()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_dcbecb(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleLevel_dcbecb(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleLevel_dcbecb(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/dcbecb.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleLevel/dcbecb.wgsl.expected.glsl new file mode 100644 index 0000000000..6b2a1816de --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/dcbecb.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp sampler3D arg_0_arg_1; + +void textureSampleLevel_dcbecb() { + vec4 res = textureLodOffset(arg_0_arg_1, vec3(0.0f), 1.0f, ivec3(0)); +} + +vec4 vertex_main() { + textureSampleLevel_dcbecb(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler3D arg_0_arg_1; + +void textureSampleLevel_dcbecb() { + vec4 res = textureLodOffset(arg_0_arg_1, vec3(0.0f), 1.0f, ivec3(0)); +} + +void fragment_main() { + textureSampleLevel_dcbecb(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler3D arg_0_arg_1; + +void textureSampleLevel_dcbecb() { + vec4 res = textureLodOffset(arg_0_arg_1, vec3(0.0f), 1.0f, ivec3(0)); +} + +void compute_main() { + textureSampleLevel_dcbecb(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/dcbecb.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureSampleLevel/dcbecb.wgsl.expected.hlsl new file mode 100644 index 0000000000..806a05fd03 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/dcbecb.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +Texture3D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_dcbecb() { + float4 res = arg_0.SampleLevel(arg_1, (0.0f).xxx, 1.0f, (0).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_dcbecb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_dcbecb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_dcbecb(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/dcbecb.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleLevel/dcbecb.wgsl.expected.msl new file mode 100644 index 0000000000..2eaac72baf --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/dcbecb.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureSampleLevel_dcbecb(texture3d tint_symbol_1, sampler tint_symbol_2) { + float4 res = tint_symbol_1.sample(tint_symbol_2, float3(0.0f), level(1.0f), int3(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_3, sampler tint_symbol_4) { + textureSampleLevel_dcbecb(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleLevel_dcbecb(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture3d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleLevel_dcbecb(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/dcbecb.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleLevel/dcbecb.wgsl.expected.spvasm new file mode 100644 index 0000000000..6b3a57e311 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/dcbecb.wgsl.expected.spvasm @@ -0,0 +1,85 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleLevel_dcbecb "textureSampleLevel_dcbecb" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 3D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %22 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 + %25 = OpConstantNull %v3float + %float_1 = OpConstant %float 1 + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %29 = OpConstantNull %v3int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %32 = OpTypeFunction %v4float +%textureSampleLevel_dcbecb = OpFunction %void None %15 + %18 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %20 = OpLoad %14 %arg_1 + %21 = OpLoad %11 %arg_0 + %23 = OpSampledImage %22 %21 %20 + %19 = OpImageSampleExplicitLod %v4float %23 %25 Lod|ConstOffset %float_1 %29 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %32 + %34 = OpLabel + %35 = OpFunctionCall %void %textureSampleLevel_dcbecb + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %37 = OpLabel + %38 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %38 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %40 = OpLabel + %41 = OpFunctionCall %void %textureSampleLevel_dcbecb + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %43 = OpLabel + %44 = OpFunctionCall %void %textureSampleLevel_dcbecb + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/dcbecb.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleLevel/dcbecb.wgsl.expected.wgsl new file mode 100644 index 0000000000..e49b2b0b01 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/dcbecb.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_3d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleLevel_dcbecb() { + var res : vec4 = textureSampleLevel(arg_0, arg_1, vec3(), 1.0, vec3()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_dcbecb(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleLevel_dcbecb(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleLevel_dcbecb(); +} diff --git a/test/tint/builtins/gen/var/abs/002533.wgsl b/test/tint/builtins/gen/var/abs/002533.wgsl new file mode 100644 index 0000000000..edf0d3e6d8 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/002533.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn abs(vec<4, f32>) -> vec<4, f32> +fn abs_002533() { + var arg_0 = vec4(); + var res: vec4 = abs(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + abs_002533(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + abs_002533(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + abs_002533(); +} diff --git a/test/tint/builtins/gen/var/abs/002533.wgsl.expected.glsl b/test/tint/builtins/gen/var/abs/002533.wgsl.expected.glsl new file mode 100644 index 0000000000..cf3797759f --- /dev/null +++ b/test/tint/builtins/gen/var/abs/002533.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void abs_002533() { + vec4 arg_0 = vec4(0.0f); + vec4 res = abs(arg_0); +} + +vec4 vertex_main() { + abs_002533(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void abs_002533() { + vec4 arg_0 = vec4(0.0f); + vec4 res = abs(arg_0); +} + +void fragment_main() { + abs_002533(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void abs_002533() { + vec4 arg_0 = vec4(0.0f); + vec4 res = abs(arg_0); +} + +void compute_main() { + abs_002533(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/002533.wgsl.expected.hlsl b/test/tint/builtins/gen/var/abs/002533.wgsl.expected.hlsl new file mode 100644 index 0000000000..42104ccb56 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/002533.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void abs_002533() { + float4 arg_0 = (0.0f).xxxx; + float4 res = abs(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_002533(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_002533(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_002533(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/002533.wgsl.expected.msl b/test/tint/builtins/gen/var/abs/002533.wgsl.expected.msl new file mode 100644 index 0000000000..ffe76fb042 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/002533.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void abs_002533() { + float4 arg_0 = float4(0.0f); + float4 res = fabs(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + abs_002533(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + abs_002533(); + return; +} + +kernel void compute_main() { + abs_002533(); + return; +} + diff --git a/test/tint/builtins/gen/var/abs/002533.wgsl.expected.spvasm b/test/tint/builtins/gen/var/abs/002533.wgsl.expected.spvasm new file mode 100644 index 0000000000..e420cb9706 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/002533.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %abs_002533 "abs_002533" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %abs_002533 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %5 + %17 = OpLoad %v4float %arg_0 + %15 = OpExtInst %v4float %16 FAbs %17 + OpStore %res %15 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %abs_002533 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %abs_002533 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %abs_002533 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/abs/002533.wgsl.expected.wgsl b/test/tint/builtins/gen/var/abs/002533.wgsl.expected.wgsl new file mode 100644 index 0000000000..d62346e859 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/002533.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn abs_002533() { + var arg_0 = vec4(); + var res : vec4 = abs(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + abs_002533(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + abs_002533(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + abs_002533(); +} diff --git a/test/tint/builtins/gen/var/abs/005174.wgsl b/test/tint/builtins/gen/var/abs/005174.wgsl new file mode 100644 index 0000000000..88d62cf564 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/005174.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn abs(vec<3, f32>) -> vec<3, f32> +fn abs_005174() { + var arg_0 = vec3(); + var res: vec3 = abs(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + abs_005174(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + abs_005174(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + abs_005174(); +} diff --git a/test/tint/builtins/gen/var/abs/005174.wgsl.expected.glsl b/test/tint/builtins/gen/var/abs/005174.wgsl.expected.glsl new file mode 100644 index 0000000000..bc996cc85b --- /dev/null +++ b/test/tint/builtins/gen/var/abs/005174.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void abs_005174() { + vec3 arg_0 = vec3(0.0f); + vec3 res = abs(arg_0); +} + +vec4 vertex_main() { + abs_005174(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void abs_005174() { + vec3 arg_0 = vec3(0.0f); + vec3 res = abs(arg_0); +} + +void fragment_main() { + abs_005174(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void abs_005174() { + vec3 arg_0 = vec3(0.0f); + vec3 res = abs(arg_0); +} + +void compute_main() { + abs_005174(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/005174.wgsl.expected.hlsl b/test/tint/builtins/gen/var/abs/005174.wgsl.expected.hlsl new file mode 100644 index 0000000000..679d38c223 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/005174.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void abs_005174() { + float3 arg_0 = (0.0f).xxx; + float3 res = abs(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_005174(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_005174(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_005174(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/005174.wgsl.expected.msl b/test/tint/builtins/gen/var/abs/005174.wgsl.expected.msl new file mode 100644 index 0000000000..db44af8804 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/005174.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void abs_005174() { + float3 arg_0 = float3(0.0f); + float3 res = fabs(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + abs_005174(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + abs_005174(); + return; +} + +kernel void compute_main() { + abs_005174(); + return; +} + diff --git a/test/tint/builtins/gen/var/abs/005174.wgsl.expected.spvasm b/test/tint/builtins/gen/var/abs/005174.wgsl.expected.spvasm new file mode 100644 index 0000000000..8e0efabd57 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/005174.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %abs_005174 "abs_005174" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %14 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %abs_005174 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %14 + %res = OpVariable %_ptr_Function_v3float Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %v3float %arg_0 + %17 = OpExtInst %v3float %18 FAbs %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %abs_005174 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %abs_005174 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %abs_005174 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/abs/005174.wgsl.expected.wgsl b/test/tint/builtins/gen/var/abs/005174.wgsl.expected.wgsl new file mode 100644 index 0000000000..43910f8ebe --- /dev/null +++ b/test/tint/builtins/gen/var/abs/005174.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn abs_005174() { + var arg_0 = vec3(); + var res : vec3 = abs(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + abs_005174(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + abs_005174(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + abs_005174(); +} diff --git a/test/tint/builtins/gen/var/abs/1ce782.wgsl b/test/tint/builtins/gen/var/abs/1ce782.wgsl new file mode 100644 index 0000000000..d1a59e8b6e --- /dev/null +++ b/test/tint/builtins/gen/var/abs/1ce782.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn abs(vec<4, u32>) -> vec<4, u32> +fn abs_1ce782() { + var arg_0 = vec4(); + var res: vec4 = abs(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + abs_1ce782(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + abs_1ce782(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + abs_1ce782(); +} diff --git a/test/tint/builtins/gen/var/abs/1ce782.wgsl.expected.glsl b/test/tint/builtins/gen/var/abs/1ce782.wgsl.expected.glsl new file mode 100644 index 0000000000..05ce517d39 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/1ce782.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void abs_1ce782() { + uvec4 arg_0 = uvec4(0u); + uvec4 res = arg_0; +} + +vec4 vertex_main() { + abs_1ce782(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void abs_1ce782() { + uvec4 arg_0 = uvec4(0u); + uvec4 res = arg_0; +} + +void fragment_main() { + abs_1ce782(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void abs_1ce782() { + uvec4 arg_0 = uvec4(0u); + uvec4 res = arg_0; +} + +void compute_main() { + abs_1ce782(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/1ce782.wgsl.expected.hlsl b/test/tint/builtins/gen/var/abs/1ce782.wgsl.expected.hlsl new file mode 100644 index 0000000000..3ddb4039cb --- /dev/null +++ b/test/tint/builtins/gen/var/abs/1ce782.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void abs_1ce782() { + uint4 arg_0 = (0u).xxxx; + uint4 res = abs(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_1ce782(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_1ce782(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_1ce782(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/1ce782.wgsl.expected.msl b/test/tint/builtins/gen/var/abs/1ce782.wgsl.expected.msl new file mode 100644 index 0000000000..22dc5ae8aa --- /dev/null +++ b/test/tint/builtins/gen/var/abs/1ce782.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void abs_1ce782() { + uint4 arg_0 = uint4(0u); + uint4 res = abs(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + abs_1ce782(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + abs_1ce782(); + return; +} + +kernel void compute_main() { + abs_1ce782(); + return; +} + diff --git a/test/tint/builtins/gen/var/abs/1ce782.wgsl.expected.spvasm b/test/tint/builtins/gen/var/abs/1ce782.wgsl.expected.spvasm new file mode 100644 index 0000000000..3128b60edc --- /dev/null +++ b/test/tint/builtins/gen/var/abs/1ce782.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %abs_1ce782 "abs_1ce782" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + %15 = OpConstantNull %v4uint +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %abs_1ce782 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4uint Function %15 + %res = OpVariable %_ptr_Function_v4uint Function %15 + OpStore %arg_0 %15 + %19 = OpLoad %v4uint %arg_0 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %abs_1ce782 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %abs_1ce782 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %abs_1ce782 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/abs/1ce782.wgsl.expected.wgsl b/test/tint/builtins/gen/var/abs/1ce782.wgsl.expected.wgsl new file mode 100644 index 0000000000..74c2441e2b --- /dev/null +++ b/test/tint/builtins/gen/var/abs/1ce782.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn abs_1ce782() { + var arg_0 = vec4(); + var res : vec4 = abs(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + abs_1ce782(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + abs_1ce782(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + abs_1ce782(); +} diff --git a/test/tint/builtins/gen/var/abs/1e9d53.wgsl b/test/tint/builtins/gen/var/abs/1e9d53.wgsl new file mode 100644 index 0000000000..b8c68d4488 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/1e9d53.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn abs(vec<2, f32>) -> vec<2, f32> +fn abs_1e9d53() { + var arg_0 = vec2(); + var res: vec2 = abs(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + abs_1e9d53(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + abs_1e9d53(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + abs_1e9d53(); +} diff --git a/test/tint/builtins/gen/var/abs/1e9d53.wgsl.expected.glsl b/test/tint/builtins/gen/var/abs/1e9d53.wgsl.expected.glsl new file mode 100644 index 0000000000..907f07bd81 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/1e9d53.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void abs_1e9d53() { + vec2 arg_0 = vec2(0.0f); + vec2 res = abs(arg_0); +} + +vec4 vertex_main() { + abs_1e9d53(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void abs_1e9d53() { + vec2 arg_0 = vec2(0.0f); + vec2 res = abs(arg_0); +} + +void fragment_main() { + abs_1e9d53(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void abs_1e9d53() { + vec2 arg_0 = vec2(0.0f); + vec2 res = abs(arg_0); +} + +void compute_main() { + abs_1e9d53(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/1e9d53.wgsl.expected.hlsl b/test/tint/builtins/gen/var/abs/1e9d53.wgsl.expected.hlsl new file mode 100644 index 0000000000..aff322d2e4 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/1e9d53.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void abs_1e9d53() { + float2 arg_0 = (0.0f).xx; + float2 res = abs(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_1e9d53(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_1e9d53(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_1e9d53(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/1e9d53.wgsl.expected.msl b/test/tint/builtins/gen/var/abs/1e9d53.wgsl.expected.msl new file mode 100644 index 0000000000..87cd8bce16 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/1e9d53.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void abs_1e9d53() { + float2 arg_0 = float2(0.0f); + float2 res = fabs(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + abs_1e9d53(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + abs_1e9d53(); + return; +} + +kernel void compute_main() { + abs_1e9d53(); + return; +} + diff --git a/test/tint/builtins/gen/var/abs/1e9d53.wgsl.expected.spvasm b/test/tint/builtins/gen/var/abs/1e9d53.wgsl.expected.spvasm new file mode 100644 index 0000000000..9f60fa4468 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/1e9d53.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %abs_1e9d53 "abs_1e9d53" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %14 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %abs_1e9d53 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %14 + %res = OpVariable %_ptr_Function_v2float Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %v2float %arg_0 + %17 = OpExtInst %v2float %18 FAbs %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %abs_1e9d53 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %abs_1e9d53 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %abs_1e9d53 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/abs/1e9d53.wgsl.expected.wgsl b/test/tint/builtins/gen/var/abs/1e9d53.wgsl.expected.wgsl new file mode 100644 index 0000000000..c2ff64d658 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/1e9d53.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn abs_1e9d53() { + var arg_0 = vec2(); + var res : vec2 = abs(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + abs_1e9d53(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + abs_1e9d53(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + abs_1e9d53(); +} diff --git a/test/tint/builtins/gen/var/abs/467cd1.wgsl b/test/tint/builtins/gen/var/abs/467cd1.wgsl new file mode 100644 index 0000000000..cbc465a7fb --- /dev/null +++ b/test/tint/builtins/gen/var/abs/467cd1.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn abs(u32) -> u32 +fn abs_467cd1() { + var arg_0 = 1u; + var res: u32 = abs(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + abs_467cd1(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + abs_467cd1(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + abs_467cd1(); +} diff --git a/test/tint/builtins/gen/var/abs/467cd1.wgsl.expected.glsl b/test/tint/builtins/gen/var/abs/467cd1.wgsl.expected.glsl new file mode 100644 index 0000000000..14629ec8fc --- /dev/null +++ b/test/tint/builtins/gen/var/abs/467cd1.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void abs_467cd1() { + uint arg_0 = 1u; + uint res = arg_0; +} + +vec4 vertex_main() { + abs_467cd1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void abs_467cd1() { + uint arg_0 = 1u; + uint res = arg_0; +} + +void fragment_main() { + abs_467cd1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void abs_467cd1() { + uint arg_0 = 1u; + uint res = arg_0; +} + +void compute_main() { + abs_467cd1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/467cd1.wgsl.expected.hlsl b/test/tint/builtins/gen/var/abs/467cd1.wgsl.expected.hlsl new file mode 100644 index 0000000000..1843affb8e --- /dev/null +++ b/test/tint/builtins/gen/var/abs/467cd1.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void abs_467cd1() { + uint arg_0 = 1u; + uint res = abs(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_467cd1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_467cd1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_467cd1(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/467cd1.wgsl.expected.msl b/test/tint/builtins/gen/var/abs/467cd1.wgsl.expected.msl new file mode 100644 index 0000000000..2185834a8d --- /dev/null +++ b/test/tint/builtins/gen/var/abs/467cd1.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void abs_467cd1() { + uint arg_0 = 1u; + uint res = abs(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + abs_467cd1(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + abs_467cd1(); + return; +} + +kernel void compute_main() { + abs_467cd1(); + return; +} + diff --git a/test/tint/builtins/gen/var/abs/467cd1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/abs/467cd1.wgsl.expected.spvasm new file mode 100644 index 0000000000..0c22f425c0 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/467cd1.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %abs_467cd1 "abs_467cd1" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %17 = OpConstantNull %uint + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %abs_467cd1 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_uint Function %17 + %res = OpVariable %_ptr_Function_uint Function %17 + OpStore %arg_0 %uint_1 + %19 = OpLoad %uint %arg_0 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %abs_467cd1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %abs_467cd1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %abs_467cd1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/abs/467cd1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/abs/467cd1.wgsl.expected.wgsl new file mode 100644 index 0000000000..47ad192403 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/467cd1.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn abs_467cd1() { + var arg_0 = 1u; + var res : u32 = abs(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + abs_467cd1(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + abs_467cd1(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + abs_467cd1(); +} diff --git a/test/tint/builtins/gen/var/abs/4ad288.wgsl b/test/tint/builtins/gen/var/abs/4ad288.wgsl new file mode 100644 index 0000000000..46aeeef061 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/4ad288.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn abs(i32) -> i32 +fn abs_4ad288() { + var arg_0 = 1; + var res: i32 = abs(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + abs_4ad288(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + abs_4ad288(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + abs_4ad288(); +} diff --git a/test/tint/builtins/gen/var/abs/4ad288.wgsl.expected.glsl b/test/tint/builtins/gen/var/abs/4ad288.wgsl.expected.glsl new file mode 100644 index 0000000000..cf24591ba9 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/4ad288.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void abs_4ad288() { + int arg_0 = 1; + int res = abs(arg_0); +} + +vec4 vertex_main() { + abs_4ad288(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void abs_4ad288() { + int arg_0 = 1; + int res = abs(arg_0); +} + +void fragment_main() { + abs_4ad288(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void abs_4ad288() { + int arg_0 = 1; + int res = abs(arg_0); +} + +void compute_main() { + abs_4ad288(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/4ad288.wgsl.expected.hlsl b/test/tint/builtins/gen/var/abs/4ad288.wgsl.expected.hlsl new file mode 100644 index 0000000000..4b755468c3 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/4ad288.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void abs_4ad288() { + int arg_0 = 1; + int res = abs(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_4ad288(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_4ad288(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_4ad288(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/4ad288.wgsl.expected.msl b/test/tint/builtins/gen/var/abs/4ad288.wgsl.expected.msl new file mode 100644 index 0000000000..a721e9122e --- /dev/null +++ b/test/tint/builtins/gen/var/abs/4ad288.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void abs_4ad288() { + int arg_0 = 1; + int res = abs(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + abs_4ad288(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + abs_4ad288(); + return; +} + +kernel void compute_main() { + abs_4ad288(); + return; +} + diff --git a/test/tint/builtins/gen/var/abs/4ad288.wgsl.expected.spvasm b/test/tint/builtins/gen/var/abs/4ad288.wgsl.expected.spvasm new file mode 100644 index 0000000000..2de82a8ceb --- /dev/null +++ b/test/tint/builtins/gen/var/abs/4ad288.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %abs_4ad288 "abs_4ad288" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %17 = OpConstantNull %int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %abs_4ad288 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_int Function %17 + %res = OpVariable %_ptr_Function_int Function %17 + OpStore %arg_0 %int_1 + %20 = OpLoad %int %arg_0 + %18 = OpExtInst %int %19 SAbs %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %abs_4ad288 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %abs_4ad288 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %abs_4ad288 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/abs/4ad288.wgsl.expected.wgsl b/test/tint/builtins/gen/var/abs/4ad288.wgsl.expected.wgsl new file mode 100644 index 0000000000..261ea6d88d --- /dev/null +++ b/test/tint/builtins/gen/var/abs/4ad288.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn abs_4ad288() { + var arg_0 = 1; + var res : i32 = abs(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + abs_4ad288(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + abs_4ad288(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + abs_4ad288(); +} diff --git a/test/tint/builtins/gen/var/abs/5ad50a.wgsl b/test/tint/builtins/gen/var/abs/5ad50a.wgsl new file mode 100644 index 0000000000..0d0385e33c --- /dev/null +++ b/test/tint/builtins/gen/var/abs/5ad50a.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn abs(vec<3, i32>) -> vec<3, i32> +fn abs_5ad50a() { + var arg_0 = vec3(); + var res: vec3 = abs(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + abs_5ad50a(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + abs_5ad50a(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + abs_5ad50a(); +} diff --git a/test/tint/builtins/gen/var/abs/5ad50a.wgsl.expected.glsl b/test/tint/builtins/gen/var/abs/5ad50a.wgsl.expected.glsl new file mode 100644 index 0000000000..c3ccd6f3b8 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/5ad50a.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void abs_5ad50a() { + ivec3 arg_0 = ivec3(0); + ivec3 res = abs(arg_0); +} + +vec4 vertex_main() { + abs_5ad50a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void abs_5ad50a() { + ivec3 arg_0 = ivec3(0); + ivec3 res = abs(arg_0); +} + +void fragment_main() { + abs_5ad50a(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void abs_5ad50a() { + ivec3 arg_0 = ivec3(0); + ivec3 res = abs(arg_0); +} + +void compute_main() { + abs_5ad50a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/5ad50a.wgsl.expected.hlsl b/test/tint/builtins/gen/var/abs/5ad50a.wgsl.expected.hlsl new file mode 100644 index 0000000000..3e97613be3 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/5ad50a.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void abs_5ad50a() { + int3 arg_0 = (0).xxx; + int3 res = abs(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_5ad50a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_5ad50a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_5ad50a(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/5ad50a.wgsl.expected.msl b/test/tint/builtins/gen/var/abs/5ad50a.wgsl.expected.msl new file mode 100644 index 0000000000..98f9bbd906 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/5ad50a.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void abs_5ad50a() { + int3 arg_0 = int3(0); + int3 res = abs(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + abs_5ad50a(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + abs_5ad50a(); + return; +} + +kernel void compute_main() { + abs_5ad50a(); + return; +} + diff --git a/test/tint/builtins/gen/var/abs/5ad50a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/abs/5ad50a.wgsl.expected.spvasm new file mode 100644 index 0000000000..7cb5399115 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/5ad50a.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %abs_5ad50a "abs_5ad50a" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %15 = OpConstantNull %v3int +%_ptr_Function_v3int = OpTypePointer Function %v3int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %abs_5ad50a = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3int Function %15 + %res = OpVariable %_ptr_Function_v3int Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v3int %arg_0 + %18 = OpExtInst %v3int %19 SAbs %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %abs_5ad50a + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %abs_5ad50a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %abs_5ad50a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/abs/5ad50a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/abs/5ad50a.wgsl.expected.wgsl new file mode 100644 index 0000000000..c26a8c0b9a --- /dev/null +++ b/test/tint/builtins/gen/var/abs/5ad50a.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn abs_5ad50a() { + var arg_0 = vec3(); + var res : vec3 = abs(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + abs_5ad50a(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + abs_5ad50a(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + abs_5ad50a(); +} diff --git a/test/tint/builtins/gen/var/abs/7326de.wgsl b/test/tint/builtins/gen/var/abs/7326de.wgsl new file mode 100644 index 0000000000..3bbe715597 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/7326de.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn abs(vec<3, u32>) -> vec<3, u32> +fn abs_7326de() { + var arg_0 = vec3(); + var res: vec3 = abs(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + abs_7326de(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + abs_7326de(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + abs_7326de(); +} diff --git a/test/tint/builtins/gen/var/abs/7326de.wgsl.expected.glsl b/test/tint/builtins/gen/var/abs/7326de.wgsl.expected.glsl new file mode 100644 index 0000000000..ffb4efb52e --- /dev/null +++ b/test/tint/builtins/gen/var/abs/7326de.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void abs_7326de() { + uvec3 arg_0 = uvec3(0u); + uvec3 res = arg_0; +} + +vec4 vertex_main() { + abs_7326de(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void abs_7326de() { + uvec3 arg_0 = uvec3(0u); + uvec3 res = arg_0; +} + +void fragment_main() { + abs_7326de(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void abs_7326de() { + uvec3 arg_0 = uvec3(0u); + uvec3 res = arg_0; +} + +void compute_main() { + abs_7326de(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/7326de.wgsl.expected.hlsl b/test/tint/builtins/gen/var/abs/7326de.wgsl.expected.hlsl new file mode 100644 index 0000000000..493215017e --- /dev/null +++ b/test/tint/builtins/gen/var/abs/7326de.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void abs_7326de() { + uint3 arg_0 = (0u).xxx; + uint3 res = abs(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_7326de(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_7326de(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_7326de(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/7326de.wgsl.expected.msl b/test/tint/builtins/gen/var/abs/7326de.wgsl.expected.msl new file mode 100644 index 0000000000..216fa2195d --- /dev/null +++ b/test/tint/builtins/gen/var/abs/7326de.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void abs_7326de() { + uint3 arg_0 = uint3(0u); + uint3 res = abs(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + abs_7326de(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + abs_7326de(); + return; +} + +kernel void compute_main() { + abs_7326de(); + return; +} + diff --git a/test/tint/builtins/gen/var/abs/7326de.wgsl.expected.spvasm b/test/tint/builtins/gen/var/abs/7326de.wgsl.expected.spvasm new file mode 100644 index 0000000000..5944ba3ad6 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/7326de.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %abs_7326de "abs_7326de" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %15 = OpConstantNull %v3uint +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %abs_7326de = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3uint Function %15 + %res = OpVariable %_ptr_Function_v3uint Function %15 + OpStore %arg_0 %15 + %19 = OpLoad %v3uint %arg_0 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %abs_7326de + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %abs_7326de + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %abs_7326de + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/abs/7326de.wgsl.expected.wgsl b/test/tint/builtins/gen/var/abs/7326de.wgsl.expected.wgsl new file mode 100644 index 0000000000..312eaa1c98 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/7326de.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn abs_7326de() { + var arg_0 = vec3(); + var res : vec3 = abs(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + abs_7326de(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + abs_7326de(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + abs_7326de(); +} diff --git a/test/tint/builtins/gen/var/abs/7f28e6.wgsl b/test/tint/builtins/gen/var/abs/7f28e6.wgsl new file mode 100644 index 0000000000..1768ce98bf --- /dev/null +++ b/test/tint/builtins/gen/var/abs/7f28e6.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn abs(vec<2, u32>) -> vec<2, u32> +fn abs_7f28e6() { + var arg_0 = vec2(); + var res: vec2 = abs(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + abs_7f28e6(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + abs_7f28e6(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + abs_7f28e6(); +} diff --git a/test/tint/builtins/gen/var/abs/7f28e6.wgsl.expected.glsl b/test/tint/builtins/gen/var/abs/7f28e6.wgsl.expected.glsl new file mode 100644 index 0000000000..731a483a94 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/7f28e6.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void abs_7f28e6() { + uvec2 arg_0 = uvec2(0u); + uvec2 res = arg_0; +} + +vec4 vertex_main() { + abs_7f28e6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void abs_7f28e6() { + uvec2 arg_0 = uvec2(0u); + uvec2 res = arg_0; +} + +void fragment_main() { + abs_7f28e6(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void abs_7f28e6() { + uvec2 arg_0 = uvec2(0u); + uvec2 res = arg_0; +} + +void compute_main() { + abs_7f28e6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/7f28e6.wgsl.expected.hlsl b/test/tint/builtins/gen/var/abs/7f28e6.wgsl.expected.hlsl new file mode 100644 index 0000000000..cc4964e10e --- /dev/null +++ b/test/tint/builtins/gen/var/abs/7f28e6.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void abs_7f28e6() { + uint2 arg_0 = (0u).xx; + uint2 res = abs(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_7f28e6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_7f28e6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_7f28e6(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/7f28e6.wgsl.expected.msl b/test/tint/builtins/gen/var/abs/7f28e6.wgsl.expected.msl new file mode 100644 index 0000000000..a3ea2530ef --- /dev/null +++ b/test/tint/builtins/gen/var/abs/7f28e6.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void abs_7f28e6() { + uint2 arg_0 = uint2(0u); + uint2 res = abs(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + abs_7f28e6(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + abs_7f28e6(); + return; +} + +kernel void compute_main() { + abs_7f28e6(); + return; +} + diff --git a/test/tint/builtins/gen/var/abs/7f28e6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/abs/7f28e6.wgsl.expected.spvasm new file mode 100644 index 0000000000..fe29c4651b --- /dev/null +++ b/test/tint/builtins/gen/var/abs/7f28e6.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %abs_7f28e6 "abs_7f28e6" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %15 = OpConstantNull %v2uint +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %abs_7f28e6 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2uint Function %15 + %res = OpVariable %_ptr_Function_v2uint Function %15 + OpStore %arg_0 %15 + %19 = OpLoad %v2uint %arg_0 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %abs_7f28e6 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %abs_7f28e6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %abs_7f28e6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/abs/7f28e6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/abs/7f28e6.wgsl.expected.wgsl new file mode 100644 index 0000000000..3d202950bc --- /dev/null +++ b/test/tint/builtins/gen/var/abs/7f28e6.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn abs_7f28e6() { + var arg_0 = vec2(); + var res : vec2 = abs(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + abs_7f28e6(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + abs_7f28e6(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + abs_7f28e6(); +} diff --git a/test/tint/builtins/gen/var/abs/7faa9e.wgsl b/test/tint/builtins/gen/var/abs/7faa9e.wgsl new file mode 100644 index 0000000000..49c451cd09 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/7faa9e.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn abs(vec<2, i32>) -> vec<2, i32> +fn abs_7faa9e() { + var arg_0 = vec2(); + var res: vec2 = abs(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + abs_7faa9e(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + abs_7faa9e(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + abs_7faa9e(); +} diff --git a/test/tint/builtins/gen/var/abs/7faa9e.wgsl.expected.glsl b/test/tint/builtins/gen/var/abs/7faa9e.wgsl.expected.glsl new file mode 100644 index 0000000000..11023ea8d0 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/7faa9e.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void abs_7faa9e() { + ivec2 arg_0 = ivec2(0); + ivec2 res = abs(arg_0); +} + +vec4 vertex_main() { + abs_7faa9e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void abs_7faa9e() { + ivec2 arg_0 = ivec2(0); + ivec2 res = abs(arg_0); +} + +void fragment_main() { + abs_7faa9e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void abs_7faa9e() { + ivec2 arg_0 = ivec2(0); + ivec2 res = abs(arg_0); +} + +void compute_main() { + abs_7faa9e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/7faa9e.wgsl.expected.hlsl b/test/tint/builtins/gen/var/abs/7faa9e.wgsl.expected.hlsl new file mode 100644 index 0000000000..6a8e40363c --- /dev/null +++ b/test/tint/builtins/gen/var/abs/7faa9e.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void abs_7faa9e() { + int2 arg_0 = (0).xx; + int2 res = abs(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_7faa9e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_7faa9e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_7faa9e(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/7faa9e.wgsl.expected.msl b/test/tint/builtins/gen/var/abs/7faa9e.wgsl.expected.msl new file mode 100644 index 0000000000..715073456f --- /dev/null +++ b/test/tint/builtins/gen/var/abs/7faa9e.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void abs_7faa9e() { + int2 arg_0 = int2(0); + int2 res = abs(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + abs_7faa9e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + abs_7faa9e(); + return; +} + +kernel void compute_main() { + abs_7faa9e(); + return; +} + diff --git a/test/tint/builtins/gen/var/abs/7faa9e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/abs/7faa9e.wgsl.expected.spvasm new file mode 100644 index 0000000000..fe6e8ee04f --- /dev/null +++ b/test/tint/builtins/gen/var/abs/7faa9e.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %abs_7faa9e "abs_7faa9e" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %15 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %abs_7faa9e = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2int Function %15 + %res = OpVariable %_ptr_Function_v2int Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v2int %arg_0 + %18 = OpExtInst %v2int %19 SAbs %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %abs_7faa9e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %abs_7faa9e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %abs_7faa9e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/abs/7faa9e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/abs/7faa9e.wgsl.expected.wgsl new file mode 100644 index 0000000000..95ebb29b25 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/7faa9e.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn abs_7faa9e() { + var arg_0 = vec2(); + var res : vec2 = abs(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + abs_7faa9e(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + abs_7faa9e(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + abs_7faa9e(); +} diff --git a/test/tint/builtins/gen/var/abs/9c80a6.wgsl b/test/tint/builtins/gen/var/abs/9c80a6.wgsl new file mode 100644 index 0000000000..ec9f3e2be2 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/9c80a6.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn abs(vec<4, i32>) -> vec<4, i32> +fn abs_9c80a6() { + var arg_0 = vec4(); + var res: vec4 = abs(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + abs_9c80a6(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + abs_9c80a6(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + abs_9c80a6(); +} diff --git a/test/tint/builtins/gen/var/abs/9c80a6.wgsl.expected.glsl b/test/tint/builtins/gen/var/abs/9c80a6.wgsl.expected.glsl new file mode 100644 index 0000000000..bd0c1f7ff0 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/9c80a6.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void abs_9c80a6() { + ivec4 arg_0 = ivec4(0); + ivec4 res = abs(arg_0); +} + +vec4 vertex_main() { + abs_9c80a6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void abs_9c80a6() { + ivec4 arg_0 = ivec4(0); + ivec4 res = abs(arg_0); +} + +void fragment_main() { + abs_9c80a6(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void abs_9c80a6() { + ivec4 arg_0 = ivec4(0); + ivec4 res = abs(arg_0); +} + +void compute_main() { + abs_9c80a6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/9c80a6.wgsl.expected.hlsl b/test/tint/builtins/gen/var/abs/9c80a6.wgsl.expected.hlsl new file mode 100644 index 0000000000..9457142ded --- /dev/null +++ b/test/tint/builtins/gen/var/abs/9c80a6.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void abs_9c80a6() { + int4 arg_0 = (0).xxxx; + int4 res = abs(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_9c80a6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_9c80a6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_9c80a6(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/9c80a6.wgsl.expected.msl b/test/tint/builtins/gen/var/abs/9c80a6.wgsl.expected.msl new file mode 100644 index 0000000000..e3a3aad36f --- /dev/null +++ b/test/tint/builtins/gen/var/abs/9c80a6.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void abs_9c80a6() { + int4 arg_0 = int4(0); + int4 res = abs(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + abs_9c80a6(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + abs_9c80a6(); + return; +} + +kernel void compute_main() { + abs_9c80a6(); + return; +} + diff --git a/test/tint/builtins/gen/var/abs/9c80a6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/abs/9c80a6.wgsl.expected.spvasm new file mode 100644 index 0000000000..170b055281 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/9c80a6.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %abs_9c80a6 "abs_9c80a6" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %15 = OpConstantNull %v4int +%_ptr_Function_v4int = OpTypePointer Function %v4int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %abs_9c80a6 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4int Function %15 + %res = OpVariable %_ptr_Function_v4int Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v4int %arg_0 + %18 = OpExtInst %v4int %19 SAbs %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %abs_9c80a6 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %abs_9c80a6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %abs_9c80a6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/abs/9c80a6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/abs/9c80a6.wgsl.expected.wgsl new file mode 100644 index 0000000000..9fb60c89ec --- /dev/null +++ b/test/tint/builtins/gen/var/abs/9c80a6.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn abs_9c80a6() { + var arg_0 = vec4(); + var res : vec4 = abs(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + abs_9c80a6(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + abs_9c80a6(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + abs_9c80a6(); +} diff --git a/test/tint/builtins/gen/var/abs/b96037.wgsl b/test/tint/builtins/gen/var/abs/b96037.wgsl new file mode 100644 index 0000000000..7d4df57817 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/b96037.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn abs(f32) -> f32 +fn abs_b96037() { + var arg_0 = 1.0; + var res: f32 = abs(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + abs_b96037(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + abs_b96037(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + abs_b96037(); +} diff --git a/test/tint/builtins/gen/var/abs/b96037.wgsl.expected.glsl b/test/tint/builtins/gen/var/abs/b96037.wgsl.expected.glsl new file mode 100644 index 0000000000..0c3a36456d --- /dev/null +++ b/test/tint/builtins/gen/var/abs/b96037.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void abs_b96037() { + float arg_0 = 1.0f; + float res = abs(arg_0); +} + +vec4 vertex_main() { + abs_b96037(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void abs_b96037() { + float arg_0 = 1.0f; + float res = abs(arg_0); +} + +void fragment_main() { + abs_b96037(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void abs_b96037() { + float arg_0 = 1.0f; + float res = abs(arg_0); +} + +void compute_main() { + abs_b96037(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/b96037.wgsl.expected.hlsl b/test/tint/builtins/gen/var/abs/b96037.wgsl.expected.hlsl new file mode 100644 index 0000000000..b19d55ff79 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/b96037.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void abs_b96037() { + float arg_0 = 1.0f; + float res = abs(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_b96037(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_b96037(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_b96037(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/b96037.wgsl.expected.msl b/test/tint/builtins/gen/var/abs/b96037.wgsl.expected.msl new file mode 100644 index 0000000000..ad39e75088 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/b96037.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void abs_b96037() { + float arg_0 = 1.0f; + float res = fabs(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + abs_b96037(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + abs_b96037(); + return; +} + +kernel void compute_main() { + abs_b96037(); + return; +} + diff --git a/test/tint/builtins/gen/var/abs/b96037.wgsl.expected.spvasm b/test/tint/builtins/gen/var/abs/b96037.wgsl.expected.spvasm new file mode 100644 index 0000000000..419d3a15f0 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/b96037.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %abs_b96037 "abs_b96037" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %20 = OpTypeFunction %v4float + %abs_b96037 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + %18 = OpLoad %float %arg_0 + %16 = OpExtInst %float %17 FAbs %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %abs_b96037 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %abs_b96037 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %abs_b96037 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/abs/b96037.wgsl.expected.wgsl b/test/tint/builtins/gen/var/abs/b96037.wgsl.expected.wgsl new file mode 100644 index 0000000000..e77b0cbde2 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/b96037.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn abs_b96037() { + var arg_0 = 1.0; + var res : f32 = abs(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + abs_b96037(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + abs_b96037(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + abs_b96037(); +} diff --git a/test/tint/builtins/gen/var/acos/489247.wgsl b/test/tint/builtins/gen/var/acos/489247.wgsl new file mode 100644 index 0000000000..3fe1481a5e --- /dev/null +++ b/test/tint/builtins/gen/var/acos/489247.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn acos(f32) -> f32 +fn acos_489247() { + var arg_0 = 1.0; + var res: f32 = acos(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + acos_489247(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + acos_489247(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + acos_489247(); +} diff --git a/test/tint/builtins/gen/var/acos/489247.wgsl.expected.glsl b/test/tint/builtins/gen/var/acos/489247.wgsl.expected.glsl new file mode 100644 index 0000000000..bd507c702e --- /dev/null +++ b/test/tint/builtins/gen/var/acos/489247.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void acos_489247() { + float arg_0 = 1.0f; + float res = acos(arg_0); +} + +vec4 vertex_main() { + acos_489247(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void acos_489247() { + float arg_0 = 1.0f; + float res = acos(arg_0); +} + +void fragment_main() { + acos_489247(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void acos_489247() { + float arg_0 = 1.0f; + float res = acos(arg_0); +} + +void compute_main() { + acos_489247(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/acos/489247.wgsl.expected.hlsl b/test/tint/builtins/gen/var/acos/489247.wgsl.expected.hlsl new file mode 100644 index 0000000000..9f53955922 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/489247.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void acos_489247() { + float arg_0 = 1.0f; + float res = acos(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acos_489247(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acos_489247(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acos_489247(); + return; +} diff --git a/test/tint/builtins/gen/var/acos/489247.wgsl.expected.msl b/test/tint/builtins/gen/var/acos/489247.wgsl.expected.msl new file mode 100644 index 0000000000..273a93f6b8 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/489247.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void acos_489247() { + float arg_0 = 1.0f; + float res = acos(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + acos_489247(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + acos_489247(); + return; +} + +kernel void compute_main() { + acos_489247(); + return; +} + diff --git a/test/tint/builtins/gen/var/acos/489247.wgsl.expected.spvasm b/test/tint/builtins/gen/var/acos/489247.wgsl.expected.spvasm new file mode 100644 index 0000000000..854923b83c --- /dev/null +++ b/test/tint/builtins/gen/var/acos/489247.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %acos_489247 "acos_489247" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %20 = OpTypeFunction %v4float +%acos_489247 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + %18 = OpLoad %float %arg_0 + %16 = OpExtInst %float %17 Acos %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %acos_489247 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %acos_489247 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %acos_489247 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/acos/489247.wgsl.expected.wgsl b/test/tint/builtins/gen/var/acos/489247.wgsl.expected.wgsl new file mode 100644 index 0000000000..c1cf17061d --- /dev/null +++ b/test/tint/builtins/gen/var/acos/489247.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn acos_489247() { + var arg_0 = 1.0; + var res : f32 = acos(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + acos_489247(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + acos_489247(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + acos_489247(); +} diff --git a/test/tint/builtins/gen/var/acos/8e2acf.wgsl b/test/tint/builtins/gen/var/acos/8e2acf.wgsl new file mode 100644 index 0000000000..d706cf164d --- /dev/null +++ b/test/tint/builtins/gen/var/acos/8e2acf.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn acos(vec<4, f32>) -> vec<4, f32> +fn acos_8e2acf() { + var arg_0 = vec4(); + var res: vec4 = acos(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + acos_8e2acf(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + acos_8e2acf(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + acos_8e2acf(); +} diff --git a/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.glsl b/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.glsl new file mode 100644 index 0000000000..c0f988199a --- /dev/null +++ b/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void acos_8e2acf() { + vec4 arg_0 = vec4(0.0f); + vec4 res = acos(arg_0); +} + +vec4 vertex_main() { + acos_8e2acf(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void acos_8e2acf() { + vec4 arg_0 = vec4(0.0f); + vec4 res = acos(arg_0); +} + +void fragment_main() { + acos_8e2acf(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void acos_8e2acf() { + vec4 arg_0 = vec4(0.0f); + vec4 res = acos(arg_0); +} + +void compute_main() { + acos_8e2acf(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.hlsl b/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.hlsl new file mode 100644 index 0000000000..4e05e04d70 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void acos_8e2acf() { + float4 arg_0 = (0.0f).xxxx; + float4 res = acos(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acos_8e2acf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acos_8e2acf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acos_8e2acf(); + return; +} diff --git a/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.msl b/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.msl new file mode 100644 index 0000000000..6908f7caa6 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void acos_8e2acf() { + float4 arg_0 = float4(0.0f); + float4 res = acos(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + acos_8e2acf(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + acos_8e2acf(); + return; +} + +kernel void compute_main() { + acos_8e2acf(); + return; +} + diff --git a/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.spvasm b/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.spvasm new file mode 100644 index 0000000000..3d0fda7003 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %acos_8e2acf "acos_8e2acf" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%acos_8e2acf = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %5 + %17 = OpLoad %v4float %arg_0 + %15 = OpExtInst %v4float %16 Acos %17 + OpStore %res %15 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %acos_8e2acf + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %acos_8e2acf + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %acos_8e2acf + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.wgsl b/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.wgsl new file mode 100644 index 0000000000..b284e35e5d --- /dev/null +++ b/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn acos_8e2acf() { + var arg_0 = vec4(); + var res : vec4 = acos(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + acos_8e2acf(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + acos_8e2acf(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + acos_8e2acf(); +} diff --git a/test/tint/builtins/gen/var/acos/a610c4.wgsl b/test/tint/builtins/gen/var/acos/a610c4.wgsl new file mode 100644 index 0000000000..f8c535baec --- /dev/null +++ b/test/tint/builtins/gen/var/acos/a610c4.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn acos(vec<3, f32>) -> vec<3, f32> +fn acos_a610c4() { + var arg_0 = vec3(); + var res: vec3 = acos(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + acos_a610c4(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + acos_a610c4(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + acos_a610c4(); +} diff --git a/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.glsl b/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.glsl new file mode 100644 index 0000000000..eb76a0310c --- /dev/null +++ b/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void acos_a610c4() { + vec3 arg_0 = vec3(0.0f); + vec3 res = acos(arg_0); +} + +vec4 vertex_main() { + acos_a610c4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void acos_a610c4() { + vec3 arg_0 = vec3(0.0f); + vec3 res = acos(arg_0); +} + +void fragment_main() { + acos_a610c4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void acos_a610c4() { + vec3 arg_0 = vec3(0.0f); + vec3 res = acos(arg_0); +} + +void compute_main() { + acos_a610c4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.hlsl b/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.hlsl new file mode 100644 index 0000000000..df2b23182a --- /dev/null +++ b/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void acos_a610c4() { + float3 arg_0 = (0.0f).xxx; + float3 res = acos(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acos_a610c4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acos_a610c4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acos_a610c4(); + return; +} diff --git a/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.msl b/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.msl new file mode 100644 index 0000000000..fa8d78cc25 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void acos_a610c4() { + float3 arg_0 = float3(0.0f); + float3 res = acos(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + acos_a610c4(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + acos_a610c4(); + return; +} + +kernel void compute_main() { + acos_a610c4(); + return; +} + diff --git a/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.spvasm new file mode 100644 index 0000000000..1fedd83e80 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %acos_a610c4 "acos_a610c4" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %14 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%acos_a610c4 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %14 + %res = OpVariable %_ptr_Function_v3float Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %v3float %arg_0 + %17 = OpExtInst %v3float %18 Acos %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %acos_a610c4 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %acos_a610c4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %acos_a610c4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.wgsl new file mode 100644 index 0000000000..fed3a9e013 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn acos_a610c4() { + var arg_0 = vec3(); + var res : vec3 = acos(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + acos_a610c4(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + acos_a610c4(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + acos_a610c4(); +} diff --git a/test/tint/builtins/gen/var/acos/dfc915.wgsl b/test/tint/builtins/gen/var/acos/dfc915.wgsl new file mode 100644 index 0000000000..e517978dab --- /dev/null +++ b/test/tint/builtins/gen/var/acos/dfc915.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn acos(vec<2, f32>) -> vec<2, f32> +fn acos_dfc915() { + var arg_0 = vec2(); + var res: vec2 = acos(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + acos_dfc915(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + acos_dfc915(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + acos_dfc915(); +} diff --git a/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.glsl b/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.glsl new file mode 100644 index 0000000000..7645730074 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void acos_dfc915() { + vec2 arg_0 = vec2(0.0f); + vec2 res = acos(arg_0); +} + +vec4 vertex_main() { + acos_dfc915(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void acos_dfc915() { + vec2 arg_0 = vec2(0.0f); + vec2 res = acos(arg_0); +} + +void fragment_main() { + acos_dfc915(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void acos_dfc915() { + vec2 arg_0 = vec2(0.0f); + vec2 res = acos(arg_0); +} + +void compute_main() { + acos_dfc915(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.hlsl b/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.hlsl new file mode 100644 index 0000000000..01e6a4ede8 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void acos_dfc915() { + float2 arg_0 = (0.0f).xx; + float2 res = acos(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acos_dfc915(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acos_dfc915(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acos_dfc915(); + return; +} diff --git a/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.msl b/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.msl new file mode 100644 index 0000000000..0981ef0356 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void acos_dfc915() { + float2 arg_0 = float2(0.0f); + float2 res = acos(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + acos_dfc915(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + acos_dfc915(); + return; +} + +kernel void compute_main() { + acos_dfc915(); + return; +} + diff --git a/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.spvasm b/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.spvasm new file mode 100644 index 0000000000..0e8006651a --- /dev/null +++ b/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %acos_dfc915 "acos_dfc915" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %14 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%acos_dfc915 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %14 + %res = OpVariable %_ptr_Function_v2float Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %v2float %arg_0 + %17 = OpExtInst %v2float %18 Acos %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %acos_dfc915 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %acos_dfc915 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %acos_dfc915 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.wgsl b/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.wgsl new file mode 100644 index 0000000000..f1044c3858 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn acos_dfc915() { + var arg_0 = vec2(); + var res : vec2 = acos(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + acos_dfc915(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + acos_dfc915(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + acos_dfc915(); +} diff --git a/test/tint/builtins/gen/var/all/353d6a.wgsl b/test/tint/builtins/gen/var/all/353d6a.wgsl new file mode 100644 index 0000000000..e443991e92 --- /dev/null +++ b/test/tint/builtins/gen/var/all/353d6a.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn all(bool) -> bool +fn all_353d6a() { + var arg_0 = bool(); + var res: bool = all(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + all_353d6a(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + all_353d6a(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + all_353d6a(); +} diff --git a/test/tint/builtins/gen/var/all/353d6a.wgsl.expected.glsl b/test/tint/builtins/gen/var/all/353d6a.wgsl.expected.glsl new file mode 100644 index 0000000000..cd35887207 --- /dev/null +++ b/test/tint/builtins/gen/var/all/353d6a.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void all_353d6a() { + bool arg_0 = false; + bool res = arg_0; +} + +vec4 vertex_main() { + all_353d6a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void all_353d6a() { + bool arg_0 = false; + bool res = arg_0; +} + +void fragment_main() { + all_353d6a(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void all_353d6a() { + bool arg_0 = false; + bool res = arg_0; +} + +void compute_main() { + all_353d6a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/all/353d6a.wgsl.expected.hlsl b/test/tint/builtins/gen/var/all/353d6a.wgsl.expected.hlsl new file mode 100644 index 0000000000..2bc077889d --- /dev/null +++ b/test/tint/builtins/gen/var/all/353d6a.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void all_353d6a() { + bool arg_0 = false; + bool res = all(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + all_353d6a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + all_353d6a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + all_353d6a(); + return; +} diff --git a/test/tint/builtins/gen/var/all/353d6a.wgsl.expected.msl b/test/tint/builtins/gen/var/all/353d6a.wgsl.expected.msl new file mode 100644 index 0000000000..8e2d6a0ff8 --- /dev/null +++ b/test/tint/builtins/gen/var/all/353d6a.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void all_353d6a() { + bool arg_0 = false; + bool res = all(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + all_353d6a(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + all_353d6a(); + return; +} + +kernel void compute_main() { + all_353d6a(); + return; +} + diff --git a/test/tint/builtins/gen/var/all/353d6a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/all/353d6a.wgsl.expected.spvasm new file mode 100644 index 0000000000..58378ecb63 --- /dev/null +++ b/test/tint/builtins/gen/var/all/353d6a.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %all_353d6a "all_353d6a" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %bool = OpTypeBool + %14 = OpConstantNull %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %all_353d6a = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_bool Function %14 + %res = OpVariable %_ptr_Function_bool Function %14 + OpStore %arg_0 %14 + %18 = OpLoad %bool %arg_0 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %all_353d6a + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %all_353d6a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %all_353d6a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/all/353d6a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/all/353d6a.wgsl.expected.wgsl new file mode 100644 index 0000000000..d9993dad07 --- /dev/null +++ b/test/tint/builtins/gen/var/all/353d6a.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn all_353d6a() { + var arg_0 = bool(); + var res : bool = all(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + all_353d6a(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + all_353d6a(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + all_353d6a(); +} diff --git a/test/tint/builtins/gen/var/all/986c7b.wgsl b/test/tint/builtins/gen/var/all/986c7b.wgsl new file mode 100644 index 0000000000..524837240f --- /dev/null +++ b/test/tint/builtins/gen/var/all/986c7b.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn all(vec<4, bool>) -> bool +fn all_986c7b() { + var arg_0 = vec4(); + var res: bool = all(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + all_986c7b(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + all_986c7b(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + all_986c7b(); +} diff --git a/test/tint/builtins/gen/var/all/986c7b.wgsl.expected.glsl b/test/tint/builtins/gen/var/all/986c7b.wgsl.expected.glsl new file mode 100644 index 0000000000..f64d3d7e2c --- /dev/null +++ b/test/tint/builtins/gen/var/all/986c7b.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void all_986c7b() { + bvec4 arg_0 = bvec4(false); + bool res = all(arg_0); +} + +vec4 vertex_main() { + all_986c7b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void all_986c7b() { + bvec4 arg_0 = bvec4(false); + bool res = all(arg_0); +} + +void fragment_main() { + all_986c7b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void all_986c7b() { + bvec4 arg_0 = bvec4(false); + bool res = all(arg_0); +} + +void compute_main() { + all_986c7b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/all/986c7b.wgsl.expected.hlsl b/test/tint/builtins/gen/var/all/986c7b.wgsl.expected.hlsl new file mode 100644 index 0000000000..5bac853ce4 --- /dev/null +++ b/test/tint/builtins/gen/var/all/986c7b.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void all_986c7b() { + bool4 arg_0 = (false).xxxx; + bool res = all(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + all_986c7b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + all_986c7b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + all_986c7b(); + return; +} diff --git a/test/tint/builtins/gen/var/all/986c7b.wgsl.expected.msl b/test/tint/builtins/gen/var/all/986c7b.wgsl.expected.msl new file mode 100644 index 0000000000..42546359d1 --- /dev/null +++ b/test/tint/builtins/gen/var/all/986c7b.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void all_986c7b() { + bool4 arg_0 = bool4(false); + bool res = all(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + all_986c7b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + all_986c7b(); + return; +} + +kernel void compute_main() { + all_986c7b(); + return; +} + diff --git a/test/tint/builtins/gen/var/all/986c7b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/all/986c7b.wgsl.expected.spvasm new file mode 100644 index 0000000000..f6d2124ac3 --- /dev/null +++ b/test/tint/builtins/gen/var/all/986c7b.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %all_986c7b "all_986c7b" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %15 = OpConstantNull %v4bool +%_ptr_Function_v4bool = OpTypePointer Function %v4bool +%_ptr_Function_bool = OpTypePointer Function %bool + %22 = OpConstantNull %bool + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %all_986c7b = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4bool Function %15 + %res = OpVariable %_ptr_Function_bool Function %22 + OpStore %arg_0 %15 + %19 = OpLoad %v4bool %arg_0 + %18 = OpAll %bool %19 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %all_986c7b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %all_986c7b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %all_986c7b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/all/986c7b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/all/986c7b.wgsl.expected.wgsl new file mode 100644 index 0000000000..6aab44deed --- /dev/null +++ b/test/tint/builtins/gen/var/all/986c7b.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn all_986c7b() { + var arg_0 = vec4(); + var res : bool = all(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + all_986c7b(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + all_986c7b(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + all_986c7b(); +} diff --git a/test/tint/builtins/gen/var/all/bd2dba.wgsl b/test/tint/builtins/gen/var/all/bd2dba.wgsl new file mode 100644 index 0000000000..2383e0d6da --- /dev/null +++ b/test/tint/builtins/gen/var/all/bd2dba.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn all(vec<3, bool>) -> bool +fn all_bd2dba() { + var arg_0 = vec3(); + var res: bool = all(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + all_bd2dba(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + all_bd2dba(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + all_bd2dba(); +} diff --git a/test/tint/builtins/gen/var/all/bd2dba.wgsl.expected.glsl b/test/tint/builtins/gen/var/all/bd2dba.wgsl.expected.glsl new file mode 100644 index 0000000000..9ed5d6b380 --- /dev/null +++ b/test/tint/builtins/gen/var/all/bd2dba.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void all_bd2dba() { + bvec3 arg_0 = bvec3(false); + bool res = all(arg_0); +} + +vec4 vertex_main() { + all_bd2dba(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void all_bd2dba() { + bvec3 arg_0 = bvec3(false); + bool res = all(arg_0); +} + +void fragment_main() { + all_bd2dba(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void all_bd2dba() { + bvec3 arg_0 = bvec3(false); + bool res = all(arg_0); +} + +void compute_main() { + all_bd2dba(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/all/bd2dba.wgsl.expected.hlsl b/test/tint/builtins/gen/var/all/bd2dba.wgsl.expected.hlsl new file mode 100644 index 0000000000..c9bf7afae9 --- /dev/null +++ b/test/tint/builtins/gen/var/all/bd2dba.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void all_bd2dba() { + bool3 arg_0 = (false).xxx; + bool res = all(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + all_bd2dba(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + all_bd2dba(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + all_bd2dba(); + return; +} diff --git a/test/tint/builtins/gen/var/all/bd2dba.wgsl.expected.msl b/test/tint/builtins/gen/var/all/bd2dba.wgsl.expected.msl new file mode 100644 index 0000000000..2e5b633c2f --- /dev/null +++ b/test/tint/builtins/gen/var/all/bd2dba.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void all_bd2dba() { + bool3 arg_0 = bool3(false); + bool res = all(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + all_bd2dba(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + all_bd2dba(); + return; +} + +kernel void compute_main() { + all_bd2dba(); + return; +} + diff --git a/test/tint/builtins/gen/var/all/bd2dba.wgsl.expected.spvasm b/test/tint/builtins/gen/var/all/bd2dba.wgsl.expected.spvasm new file mode 100644 index 0000000000..0a55820385 --- /dev/null +++ b/test/tint/builtins/gen/var/all/bd2dba.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %all_bd2dba "all_bd2dba" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %15 = OpConstantNull %v3bool +%_ptr_Function_v3bool = OpTypePointer Function %v3bool +%_ptr_Function_bool = OpTypePointer Function %bool + %22 = OpConstantNull %bool + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %all_bd2dba = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3bool Function %15 + %res = OpVariable %_ptr_Function_bool Function %22 + OpStore %arg_0 %15 + %19 = OpLoad %v3bool %arg_0 + %18 = OpAll %bool %19 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %all_bd2dba + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %all_bd2dba + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %all_bd2dba + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/all/bd2dba.wgsl.expected.wgsl b/test/tint/builtins/gen/var/all/bd2dba.wgsl.expected.wgsl new file mode 100644 index 0000000000..4bfafa1baa --- /dev/null +++ b/test/tint/builtins/gen/var/all/bd2dba.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn all_bd2dba() { + var arg_0 = vec3(); + var res : bool = all(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + all_bd2dba(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + all_bd2dba(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + all_bd2dba(); +} diff --git a/test/tint/builtins/gen/var/all/f46790.wgsl b/test/tint/builtins/gen/var/all/f46790.wgsl new file mode 100644 index 0000000000..b8217b9168 --- /dev/null +++ b/test/tint/builtins/gen/var/all/f46790.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn all(vec<2, bool>) -> bool +fn all_f46790() { + var arg_0 = vec2(); + var res: bool = all(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + all_f46790(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + all_f46790(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + all_f46790(); +} diff --git a/test/tint/builtins/gen/var/all/f46790.wgsl.expected.glsl b/test/tint/builtins/gen/var/all/f46790.wgsl.expected.glsl new file mode 100644 index 0000000000..4840d1d1cb --- /dev/null +++ b/test/tint/builtins/gen/var/all/f46790.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void all_f46790() { + bvec2 arg_0 = bvec2(false); + bool res = all(arg_0); +} + +vec4 vertex_main() { + all_f46790(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void all_f46790() { + bvec2 arg_0 = bvec2(false); + bool res = all(arg_0); +} + +void fragment_main() { + all_f46790(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void all_f46790() { + bvec2 arg_0 = bvec2(false); + bool res = all(arg_0); +} + +void compute_main() { + all_f46790(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/all/f46790.wgsl.expected.hlsl b/test/tint/builtins/gen/var/all/f46790.wgsl.expected.hlsl new file mode 100644 index 0000000000..e82b1328d3 --- /dev/null +++ b/test/tint/builtins/gen/var/all/f46790.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void all_f46790() { + bool2 arg_0 = (false).xx; + bool res = all(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + all_f46790(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + all_f46790(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + all_f46790(); + return; +} diff --git a/test/tint/builtins/gen/var/all/f46790.wgsl.expected.msl b/test/tint/builtins/gen/var/all/f46790.wgsl.expected.msl new file mode 100644 index 0000000000..855b1c4a6d --- /dev/null +++ b/test/tint/builtins/gen/var/all/f46790.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void all_f46790() { + bool2 arg_0 = bool2(false); + bool res = all(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + all_f46790(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + all_f46790(); + return; +} + +kernel void compute_main() { + all_f46790(); + return; +} + diff --git a/test/tint/builtins/gen/var/all/f46790.wgsl.expected.spvasm b/test/tint/builtins/gen/var/all/f46790.wgsl.expected.spvasm new file mode 100644 index 0000000000..9efeee7d05 --- /dev/null +++ b/test/tint/builtins/gen/var/all/f46790.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %all_f46790 "all_f46790" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %15 = OpConstantNull %v2bool +%_ptr_Function_v2bool = OpTypePointer Function %v2bool +%_ptr_Function_bool = OpTypePointer Function %bool + %22 = OpConstantNull %bool + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %all_f46790 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2bool Function %15 + %res = OpVariable %_ptr_Function_bool Function %22 + OpStore %arg_0 %15 + %19 = OpLoad %v2bool %arg_0 + %18 = OpAll %bool %19 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %all_f46790 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %all_f46790 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %all_f46790 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/all/f46790.wgsl.expected.wgsl b/test/tint/builtins/gen/var/all/f46790.wgsl.expected.wgsl new file mode 100644 index 0000000000..692168026d --- /dev/null +++ b/test/tint/builtins/gen/var/all/f46790.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn all_f46790() { + var arg_0 = vec2(); + var res : bool = all(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + all_f46790(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + all_f46790(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + all_f46790(); +} diff --git a/test/tint/builtins/gen/var/any/083428.wgsl b/test/tint/builtins/gen/var/any/083428.wgsl new file mode 100644 index 0000000000..3a7a69a20f --- /dev/null +++ b/test/tint/builtins/gen/var/any/083428.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn any(vec<4, bool>) -> bool +fn any_083428() { + var arg_0 = vec4(); + var res: bool = any(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + any_083428(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + any_083428(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + any_083428(); +} diff --git a/test/tint/builtins/gen/var/any/083428.wgsl.expected.glsl b/test/tint/builtins/gen/var/any/083428.wgsl.expected.glsl new file mode 100644 index 0000000000..3a47aaa326 --- /dev/null +++ b/test/tint/builtins/gen/var/any/083428.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void any_083428() { + bvec4 arg_0 = bvec4(false); + bool res = any(arg_0); +} + +vec4 vertex_main() { + any_083428(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void any_083428() { + bvec4 arg_0 = bvec4(false); + bool res = any(arg_0); +} + +void fragment_main() { + any_083428(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void any_083428() { + bvec4 arg_0 = bvec4(false); + bool res = any(arg_0); +} + +void compute_main() { + any_083428(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/any/083428.wgsl.expected.hlsl b/test/tint/builtins/gen/var/any/083428.wgsl.expected.hlsl new file mode 100644 index 0000000000..3064009338 --- /dev/null +++ b/test/tint/builtins/gen/var/any/083428.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void any_083428() { + bool4 arg_0 = (false).xxxx; + bool res = any(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + any_083428(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + any_083428(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + any_083428(); + return; +} diff --git a/test/tint/builtins/gen/var/any/083428.wgsl.expected.msl b/test/tint/builtins/gen/var/any/083428.wgsl.expected.msl new file mode 100644 index 0000000000..faeff8cd39 --- /dev/null +++ b/test/tint/builtins/gen/var/any/083428.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void any_083428() { + bool4 arg_0 = bool4(false); + bool res = any(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + any_083428(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + any_083428(); + return; +} + +kernel void compute_main() { + any_083428(); + return; +} + diff --git a/test/tint/builtins/gen/var/any/083428.wgsl.expected.spvasm b/test/tint/builtins/gen/var/any/083428.wgsl.expected.spvasm new file mode 100644 index 0000000000..5911608390 --- /dev/null +++ b/test/tint/builtins/gen/var/any/083428.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %any_083428 "any_083428" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %15 = OpConstantNull %v4bool +%_ptr_Function_v4bool = OpTypePointer Function %v4bool +%_ptr_Function_bool = OpTypePointer Function %bool + %22 = OpConstantNull %bool + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %any_083428 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4bool Function %15 + %res = OpVariable %_ptr_Function_bool Function %22 + OpStore %arg_0 %15 + %19 = OpLoad %v4bool %arg_0 + %18 = OpAny %bool %19 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %any_083428 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %any_083428 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %any_083428 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/any/083428.wgsl.expected.wgsl b/test/tint/builtins/gen/var/any/083428.wgsl.expected.wgsl new file mode 100644 index 0000000000..6db2c9ac6a --- /dev/null +++ b/test/tint/builtins/gen/var/any/083428.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn any_083428() { + var arg_0 = vec4(); + var res : bool = any(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + any_083428(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + any_083428(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + any_083428(); +} diff --git a/test/tint/builtins/gen/var/any/0e3e58.wgsl b/test/tint/builtins/gen/var/any/0e3e58.wgsl new file mode 100644 index 0000000000..270012c907 --- /dev/null +++ b/test/tint/builtins/gen/var/any/0e3e58.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn any(vec<2, bool>) -> bool +fn any_0e3e58() { + var arg_0 = vec2(); + var res: bool = any(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + any_0e3e58(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + any_0e3e58(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + any_0e3e58(); +} diff --git a/test/tint/builtins/gen/var/any/0e3e58.wgsl.expected.glsl b/test/tint/builtins/gen/var/any/0e3e58.wgsl.expected.glsl new file mode 100644 index 0000000000..6b9459a29f --- /dev/null +++ b/test/tint/builtins/gen/var/any/0e3e58.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void any_0e3e58() { + bvec2 arg_0 = bvec2(false); + bool res = any(arg_0); +} + +vec4 vertex_main() { + any_0e3e58(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void any_0e3e58() { + bvec2 arg_0 = bvec2(false); + bool res = any(arg_0); +} + +void fragment_main() { + any_0e3e58(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void any_0e3e58() { + bvec2 arg_0 = bvec2(false); + bool res = any(arg_0); +} + +void compute_main() { + any_0e3e58(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/any/0e3e58.wgsl.expected.hlsl b/test/tint/builtins/gen/var/any/0e3e58.wgsl.expected.hlsl new file mode 100644 index 0000000000..2662733182 --- /dev/null +++ b/test/tint/builtins/gen/var/any/0e3e58.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void any_0e3e58() { + bool2 arg_0 = (false).xx; + bool res = any(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + any_0e3e58(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + any_0e3e58(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + any_0e3e58(); + return; +} diff --git a/test/tint/builtins/gen/var/any/0e3e58.wgsl.expected.msl b/test/tint/builtins/gen/var/any/0e3e58.wgsl.expected.msl new file mode 100644 index 0000000000..8890ff57b2 --- /dev/null +++ b/test/tint/builtins/gen/var/any/0e3e58.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void any_0e3e58() { + bool2 arg_0 = bool2(false); + bool res = any(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + any_0e3e58(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + any_0e3e58(); + return; +} + +kernel void compute_main() { + any_0e3e58(); + return; +} + diff --git a/test/tint/builtins/gen/var/any/0e3e58.wgsl.expected.spvasm b/test/tint/builtins/gen/var/any/0e3e58.wgsl.expected.spvasm new file mode 100644 index 0000000000..1dc30ea83c --- /dev/null +++ b/test/tint/builtins/gen/var/any/0e3e58.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %any_0e3e58 "any_0e3e58" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %15 = OpConstantNull %v2bool +%_ptr_Function_v2bool = OpTypePointer Function %v2bool +%_ptr_Function_bool = OpTypePointer Function %bool + %22 = OpConstantNull %bool + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %any_0e3e58 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2bool Function %15 + %res = OpVariable %_ptr_Function_bool Function %22 + OpStore %arg_0 %15 + %19 = OpLoad %v2bool %arg_0 + %18 = OpAny %bool %19 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %any_0e3e58 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %any_0e3e58 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %any_0e3e58 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/any/0e3e58.wgsl.expected.wgsl b/test/tint/builtins/gen/var/any/0e3e58.wgsl.expected.wgsl new file mode 100644 index 0000000000..c21cd01d66 --- /dev/null +++ b/test/tint/builtins/gen/var/any/0e3e58.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn any_0e3e58() { + var arg_0 = vec2(); + var res : bool = any(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + any_0e3e58(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + any_0e3e58(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + any_0e3e58(); +} diff --git a/test/tint/builtins/gen/var/any/2ab91a.wgsl b/test/tint/builtins/gen/var/any/2ab91a.wgsl new file mode 100644 index 0000000000..c234642e03 --- /dev/null +++ b/test/tint/builtins/gen/var/any/2ab91a.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn any(bool) -> bool +fn any_2ab91a() { + var arg_0 = bool(); + var res: bool = any(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + any_2ab91a(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + any_2ab91a(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + any_2ab91a(); +} diff --git a/test/tint/builtins/gen/var/any/2ab91a.wgsl.expected.glsl b/test/tint/builtins/gen/var/any/2ab91a.wgsl.expected.glsl new file mode 100644 index 0000000000..05c92361f6 --- /dev/null +++ b/test/tint/builtins/gen/var/any/2ab91a.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void any_2ab91a() { + bool arg_0 = false; + bool res = arg_0; +} + +vec4 vertex_main() { + any_2ab91a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void any_2ab91a() { + bool arg_0 = false; + bool res = arg_0; +} + +void fragment_main() { + any_2ab91a(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void any_2ab91a() { + bool arg_0 = false; + bool res = arg_0; +} + +void compute_main() { + any_2ab91a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/any/2ab91a.wgsl.expected.hlsl b/test/tint/builtins/gen/var/any/2ab91a.wgsl.expected.hlsl new file mode 100644 index 0000000000..d34bc39aaa --- /dev/null +++ b/test/tint/builtins/gen/var/any/2ab91a.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void any_2ab91a() { + bool arg_0 = false; + bool res = any(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + any_2ab91a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + any_2ab91a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + any_2ab91a(); + return; +} diff --git a/test/tint/builtins/gen/var/any/2ab91a.wgsl.expected.msl b/test/tint/builtins/gen/var/any/2ab91a.wgsl.expected.msl new file mode 100644 index 0000000000..c304db3ea5 --- /dev/null +++ b/test/tint/builtins/gen/var/any/2ab91a.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void any_2ab91a() { + bool arg_0 = false; + bool res = any(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + any_2ab91a(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + any_2ab91a(); + return; +} + +kernel void compute_main() { + any_2ab91a(); + return; +} + diff --git a/test/tint/builtins/gen/var/any/2ab91a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/any/2ab91a.wgsl.expected.spvasm new file mode 100644 index 0000000000..d50f7f8af8 --- /dev/null +++ b/test/tint/builtins/gen/var/any/2ab91a.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %any_2ab91a "any_2ab91a" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %bool = OpTypeBool + %14 = OpConstantNull %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %any_2ab91a = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_bool Function %14 + %res = OpVariable %_ptr_Function_bool Function %14 + OpStore %arg_0 %14 + %18 = OpLoad %bool %arg_0 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %any_2ab91a + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %any_2ab91a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %any_2ab91a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/any/2ab91a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/any/2ab91a.wgsl.expected.wgsl new file mode 100644 index 0000000000..74315cf56d --- /dev/null +++ b/test/tint/builtins/gen/var/any/2ab91a.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn any_2ab91a() { + var arg_0 = bool(); + var res : bool = any(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + any_2ab91a(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + any_2ab91a(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + any_2ab91a(); +} diff --git a/test/tint/builtins/gen/var/any/e755c1.wgsl b/test/tint/builtins/gen/var/any/e755c1.wgsl new file mode 100644 index 0000000000..983e8cf280 --- /dev/null +++ b/test/tint/builtins/gen/var/any/e755c1.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn any(vec<3, bool>) -> bool +fn any_e755c1() { + var arg_0 = vec3(); + var res: bool = any(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + any_e755c1(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + any_e755c1(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + any_e755c1(); +} diff --git a/test/tint/builtins/gen/var/any/e755c1.wgsl.expected.glsl b/test/tint/builtins/gen/var/any/e755c1.wgsl.expected.glsl new file mode 100644 index 0000000000..355f53ac65 --- /dev/null +++ b/test/tint/builtins/gen/var/any/e755c1.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void any_e755c1() { + bvec3 arg_0 = bvec3(false); + bool res = any(arg_0); +} + +vec4 vertex_main() { + any_e755c1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void any_e755c1() { + bvec3 arg_0 = bvec3(false); + bool res = any(arg_0); +} + +void fragment_main() { + any_e755c1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void any_e755c1() { + bvec3 arg_0 = bvec3(false); + bool res = any(arg_0); +} + +void compute_main() { + any_e755c1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/any/e755c1.wgsl.expected.hlsl b/test/tint/builtins/gen/var/any/e755c1.wgsl.expected.hlsl new file mode 100644 index 0000000000..cac18b451c --- /dev/null +++ b/test/tint/builtins/gen/var/any/e755c1.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void any_e755c1() { + bool3 arg_0 = (false).xxx; + bool res = any(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + any_e755c1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + any_e755c1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + any_e755c1(); + return; +} diff --git a/test/tint/builtins/gen/var/any/e755c1.wgsl.expected.msl b/test/tint/builtins/gen/var/any/e755c1.wgsl.expected.msl new file mode 100644 index 0000000000..9ae6049e58 --- /dev/null +++ b/test/tint/builtins/gen/var/any/e755c1.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void any_e755c1() { + bool3 arg_0 = bool3(false); + bool res = any(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + any_e755c1(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + any_e755c1(); + return; +} + +kernel void compute_main() { + any_e755c1(); + return; +} + diff --git a/test/tint/builtins/gen/var/any/e755c1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/any/e755c1.wgsl.expected.spvasm new file mode 100644 index 0000000000..b0c24069d9 --- /dev/null +++ b/test/tint/builtins/gen/var/any/e755c1.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %any_e755c1 "any_e755c1" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %15 = OpConstantNull %v3bool +%_ptr_Function_v3bool = OpTypePointer Function %v3bool +%_ptr_Function_bool = OpTypePointer Function %bool + %22 = OpConstantNull %bool + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %any_e755c1 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3bool Function %15 + %res = OpVariable %_ptr_Function_bool Function %22 + OpStore %arg_0 %15 + %19 = OpLoad %v3bool %arg_0 + %18 = OpAny %bool %19 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %any_e755c1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %any_e755c1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %any_e755c1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/any/e755c1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/any/e755c1.wgsl.expected.wgsl new file mode 100644 index 0000000000..5c5c75042b --- /dev/null +++ b/test/tint/builtins/gen/var/any/e755c1.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn any_e755c1() { + var arg_0 = vec3(); + var res : bool = any(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + any_e755c1(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + any_e755c1(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + any_e755c1(); +} diff --git a/test/tint/builtins/gen/var/arrayLength/1588cd.wgsl b/test/tint/builtins/gen/var/arrayLength/1588cd.wgsl new file mode 100644 index 0000000000..c4dec13c3c --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/1588cd.wgsl @@ -0,0 +1,49 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RO { + arg_0: array, +}; +@group(0) @binding(1) var sb_ro : SB_RO; + +// fn arrayLength(ptr, read>) -> u32 +fn arrayLength_1588cd() { + var res: u32 = arrayLength(&sb_ro.arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + arrayLength_1588cd(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + arrayLength_1588cd(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + arrayLength_1588cd(); +} diff --git a/test/tint/builtins/gen/var/arrayLength/1588cd.wgsl.expected.glsl b/test/tint/builtins/gen/var/arrayLength/1588cd.wgsl.expected.glsl new file mode 100644 index 0000000000..a143e1835e --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/1588cd.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +layout(binding = 1, std430) buffer SB_RO_1 { + int arg_0[]; +} sb_ro; +void arrayLength_1588cd() { + uint res = uint(sb_ro.arg_0.length()); +} + +vec4 vertex_main() { + arrayLength_1588cd(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(binding = 1, std430) buffer SB_RO_1 { + int arg_0[]; +} sb_ro; +void arrayLength_1588cd() { + uint res = uint(sb_ro.arg_0.length()); +} + +void fragment_main() { + arrayLength_1588cd(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(binding = 1, std430) buffer SB_RO_1 { + int arg_0[]; +} sb_ro; +void arrayLength_1588cd() { + uint res = uint(sb_ro.arg_0.length()); +} + +void compute_main() { + arrayLength_1588cd(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/arrayLength/1588cd.wgsl.expected.hlsl b/test/tint/builtins/gen/var/arrayLength/1588cd.wgsl.expected.hlsl new file mode 100644 index 0000000000..fabbad5078 --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/1588cd.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +ByteAddressBuffer sb_ro : register(t1, space0); + +void arrayLength_1588cd() { + uint tint_symbol_2 = 0u; + sb_ro.GetDimensions(tint_symbol_2); + const uint tint_symbol_3 = ((tint_symbol_2 - 0u) / 4u); + uint res = tint_symbol_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + arrayLength_1588cd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + arrayLength_1588cd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + arrayLength_1588cd(); + return; +} diff --git a/test/tint/builtins/gen/var/arrayLength/1588cd.wgsl.expected.msl b/test/tint/builtins/gen/var/arrayLength/1588cd.wgsl.expected.msl new file mode 100644 index 0000000000..1f8ac29561 --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/1588cd.wgsl.expected.msl @@ -0,0 +1,41 @@ +#include + +using namespace metal; +struct tint_symbol_1 { + /* 0x0000 */ uint4 buffer_size[1]; +}; + +struct SB_RO { + int arg_0[1]; +}; + +void arrayLength_1588cd(const constant tint_symbol_1* const tint_symbol_3) { + uint res = (((*(tint_symbol_3)).buffer_size[0u][0u] - 0u) / 4u); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(const constant tint_symbol_1* const tint_symbol_4) { + arrayLength_1588cd(tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(const constant tint_symbol_1* tint_symbol_5 [[buffer(30)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(const constant tint_symbol_1* tint_symbol_6 [[buffer(30)]]) { + arrayLength_1588cd(tint_symbol_6); + return; +} + +kernel void compute_main(const constant tint_symbol_1* tint_symbol_7 [[buffer(30)]]) { + arrayLength_1588cd(tint_symbol_7); + return; +} + diff --git a/test/tint/builtins/gen/var/arrayLength/1588cd.wgsl.expected.spvasm b/test/tint/builtins/gen/var/arrayLength/1588cd.wgsl.expected.spvasm new file mode 100644 index 0000000000..40b7f6e6d2 --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/1588cd.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %SB_RO "SB_RO" + OpMemberName %SB_RO 0 "arg_0" + OpName %sb_ro "sb_ro" + OpName %arrayLength_1588cd "arrayLength_1588cd" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %SB_RO Block + OpMemberDecorate %SB_RO 0 Offset 0 + OpDecorate %_runtimearr_int ArrayStride 4 + OpDecorate %sb_ro NonWritable + OpDecorate %sb_ro DescriptorSet 0 + OpDecorate %sb_ro Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 +%_runtimearr_int = OpTypeRuntimeArray %int + %SB_RO = OpTypeStruct %_runtimearr_int +%_ptr_StorageBuffer_SB_RO = OpTypePointer StorageBuffer %SB_RO + %sb_ro = OpVariable %_ptr_StorageBuffer_SB_RO StorageBuffer + %void = OpTypeVoid + %14 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %22 = OpConstantNull %uint + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%arrayLength_1588cd = OpFunction %void None %14 + %17 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %22 + %18 = OpArrayLength %uint %sb_ro 0 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %arrayLength_1588cd + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %14 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %14 + %32 = OpLabel + %33 = OpFunctionCall %void %arrayLength_1588cd + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %14 + %35 = OpLabel + %36 = OpFunctionCall %void %arrayLength_1588cd + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/arrayLength/1588cd.wgsl.expected.wgsl b/test/tint/builtins/gen/var/arrayLength/1588cd.wgsl.expected.wgsl new file mode 100644 index 0000000000..2a2648d3e0 --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/1588cd.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +struct SB_RO { + arg_0 : array, +} + +@group(0) @binding(1) var sb_ro : SB_RO; + +fn arrayLength_1588cd() { + var res : u32 = arrayLength(&(sb_ro.arg_0)); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + arrayLength_1588cd(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + arrayLength_1588cd(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + arrayLength_1588cd(); +} diff --git a/test/tint/builtins/gen/var/arrayLength/61b1c7.wgsl b/test/tint/builtins/gen/var/arrayLength/61b1c7.wgsl new file mode 100644 index 0000000000..a7adcc1bea --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/61b1c7.wgsl @@ -0,0 +1,49 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: array, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn arrayLength(ptr, read_write>) -> u32 +fn arrayLength_61b1c7() { + var res: u32 = arrayLength(&sb_rw.arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + arrayLength_61b1c7(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + arrayLength_61b1c7(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + arrayLength_61b1c7(); +} diff --git a/test/tint/builtins/gen/var/arrayLength/61b1c7.wgsl.expected.glsl b/test/tint/builtins/gen/var/arrayLength/61b1c7.wgsl.expected.glsl new file mode 100644 index 0000000000..46667de5c6 --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/61b1c7.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +layout(binding = 0, std430) buffer SB_RW_1 { + int arg_0[]; +} sb_rw; +void arrayLength_61b1c7() { + uint res = uint(sb_rw.arg_0.length()); +} + +vec4 vertex_main() { + arrayLength_61b1c7(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(binding = 0, std430) buffer SB_RW_1 { + int arg_0[]; +} sb_rw; +void arrayLength_61b1c7() { + uint res = uint(sb_rw.arg_0.length()); +} + +void fragment_main() { + arrayLength_61b1c7(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(binding = 0, std430) buffer SB_RW_1 { + int arg_0[]; +} sb_rw; +void arrayLength_61b1c7() { + uint res = uint(sb_rw.arg_0.length()); +} + +void compute_main() { + arrayLength_61b1c7(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/arrayLength/61b1c7.wgsl.expected.hlsl b/test/tint/builtins/gen/var/arrayLength/61b1c7.wgsl.expected.hlsl new file mode 100644 index 0000000000..ba47339e36 --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/61b1c7.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +void arrayLength_61b1c7() { + uint tint_symbol_2 = 0u; + sb_rw.GetDimensions(tint_symbol_2); + const uint tint_symbol_3 = ((tint_symbol_2 - 0u) / 4u); + uint res = tint_symbol_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + arrayLength_61b1c7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + arrayLength_61b1c7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + arrayLength_61b1c7(); + return; +} diff --git a/test/tint/builtins/gen/var/arrayLength/61b1c7.wgsl.expected.msl b/test/tint/builtins/gen/var/arrayLength/61b1c7.wgsl.expected.msl new file mode 100644 index 0000000000..9fa02f3a11 --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/61b1c7.wgsl.expected.msl @@ -0,0 +1,41 @@ +#include + +using namespace metal; +struct tint_symbol_1 { + /* 0x0000 */ uint4 buffer_size[1]; +}; + +struct SB_RW { + int arg_0[1]; +}; + +void arrayLength_61b1c7(const constant tint_symbol_1* const tint_symbol_3) { + uint res = (((*(tint_symbol_3)).buffer_size[0u][0u] - 0u) / 4u); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(const constant tint_symbol_1* const tint_symbol_4) { + arrayLength_61b1c7(tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(const constant tint_symbol_1* tint_symbol_5 [[buffer(30)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(const constant tint_symbol_1* tint_symbol_6 [[buffer(30)]]) { + arrayLength_61b1c7(tint_symbol_6); + return; +} + +kernel void compute_main(const constant tint_symbol_1* tint_symbol_7 [[buffer(30)]]) { + arrayLength_61b1c7(tint_symbol_7); + return; +} + diff --git a/test/tint/builtins/gen/var/arrayLength/61b1c7.wgsl.expected.spvasm b/test/tint/builtins/gen/var/arrayLength/61b1c7.wgsl.expected.spvasm new file mode 100644 index 0000000000..482bb98d32 --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/61b1c7.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %arrayLength_61b1c7 "arrayLength_61b1c7" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %_runtimearr_int ArrayStride 4 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 +%_runtimearr_int = OpTypeRuntimeArray %int + %SB_RW = OpTypeStruct %_runtimearr_int +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %14 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %22 = OpConstantNull %uint + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%arrayLength_61b1c7 = OpFunction %void None %14 + %17 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %22 + %18 = OpArrayLength %uint %sb_rw 0 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %arrayLength_61b1c7 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %14 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %14 + %32 = OpLabel + %33 = OpFunctionCall %void %arrayLength_61b1c7 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %14 + %35 = OpLabel + %36 = OpFunctionCall %void %arrayLength_61b1c7 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/arrayLength/61b1c7.wgsl.expected.wgsl b/test/tint/builtins/gen/var/arrayLength/61b1c7.wgsl.expected.wgsl new file mode 100644 index 0000000000..73dbbb7f3a --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/61b1c7.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +struct SB_RW { + arg_0 : array, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn arrayLength_61b1c7() { + var res : u32 = arrayLength(&(sb_rw.arg_0)); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + arrayLength_61b1c7(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + arrayLength_61b1c7(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + arrayLength_61b1c7(); +} diff --git a/test/tint/builtins/gen/var/arrayLength/a0f5ca.wgsl b/test/tint/builtins/gen/var/arrayLength/a0f5ca.wgsl new file mode 100644 index 0000000000..3f83858e27 --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/a0f5ca.wgsl @@ -0,0 +1,49 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RO { + arg_0: array, +}; +@group(0) @binding(1) var sb_ro : SB_RO; + +// fn arrayLength(ptr, read>) -> u32 +fn arrayLength_a0f5ca() { + var res: u32 = arrayLength(&sb_ro.arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + arrayLength_a0f5ca(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + arrayLength_a0f5ca(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + arrayLength_a0f5ca(); +} diff --git a/test/tint/builtins/gen/var/arrayLength/a0f5ca.wgsl.expected.glsl b/test/tint/builtins/gen/var/arrayLength/a0f5ca.wgsl.expected.glsl new file mode 100644 index 0000000000..44aaf23ebf --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/a0f5ca.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +layout(binding = 1, std430) buffer SB_RO_1 { + float arg_0[]; +} sb_ro; +void arrayLength_a0f5ca() { + uint res = uint(sb_ro.arg_0.length()); +} + +vec4 vertex_main() { + arrayLength_a0f5ca(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(binding = 1, std430) buffer SB_RO_1 { + float arg_0[]; +} sb_ro; +void arrayLength_a0f5ca() { + uint res = uint(sb_ro.arg_0.length()); +} + +void fragment_main() { + arrayLength_a0f5ca(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(binding = 1, std430) buffer SB_RO_1 { + float arg_0[]; +} sb_ro; +void arrayLength_a0f5ca() { + uint res = uint(sb_ro.arg_0.length()); +} + +void compute_main() { + arrayLength_a0f5ca(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/arrayLength/a0f5ca.wgsl.expected.hlsl b/test/tint/builtins/gen/var/arrayLength/a0f5ca.wgsl.expected.hlsl new file mode 100644 index 0000000000..cee7ff20e5 --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/a0f5ca.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +ByteAddressBuffer sb_ro : register(t1, space0); + +void arrayLength_a0f5ca() { + uint tint_symbol_2 = 0u; + sb_ro.GetDimensions(tint_symbol_2); + const uint tint_symbol_3 = ((tint_symbol_2 - 0u) / 4u); + uint res = tint_symbol_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + arrayLength_a0f5ca(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + arrayLength_a0f5ca(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + arrayLength_a0f5ca(); + return; +} diff --git a/test/tint/builtins/gen/var/arrayLength/a0f5ca.wgsl.expected.msl b/test/tint/builtins/gen/var/arrayLength/a0f5ca.wgsl.expected.msl new file mode 100644 index 0000000000..f1b77851c2 --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/a0f5ca.wgsl.expected.msl @@ -0,0 +1,41 @@ +#include + +using namespace metal; +struct tint_symbol_1 { + /* 0x0000 */ uint4 buffer_size[1]; +}; + +struct SB_RO { + float arg_0[1]; +}; + +void arrayLength_a0f5ca(const constant tint_symbol_1* const tint_symbol_3) { + uint res = (((*(tint_symbol_3)).buffer_size[0u][0u] - 0u) / 4u); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(const constant tint_symbol_1* const tint_symbol_4) { + arrayLength_a0f5ca(tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(const constant tint_symbol_1* tint_symbol_5 [[buffer(30)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(const constant tint_symbol_1* tint_symbol_6 [[buffer(30)]]) { + arrayLength_a0f5ca(tint_symbol_6); + return; +} + +kernel void compute_main(const constant tint_symbol_1* tint_symbol_7 [[buffer(30)]]) { + arrayLength_a0f5ca(tint_symbol_7); + return; +} + diff --git a/test/tint/builtins/gen/var/arrayLength/a0f5ca.wgsl.expected.spvasm b/test/tint/builtins/gen/var/arrayLength/a0f5ca.wgsl.expected.spvasm new file mode 100644 index 0000000000..0af5f92524 --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/a0f5ca.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %SB_RO "SB_RO" + OpMemberName %SB_RO 0 "arg_0" + OpName %sb_ro "sb_ro" + OpName %arrayLength_a0f5ca "arrayLength_a0f5ca" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %SB_RO Block + OpMemberDecorate %SB_RO 0 Offset 0 + OpDecorate %_runtimearr_float ArrayStride 4 + OpDecorate %sb_ro NonWritable + OpDecorate %sb_ro DescriptorSet 0 + OpDecorate %sb_ro Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 +%_runtimearr_float = OpTypeRuntimeArray %float + %SB_RO = OpTypeStruct %_runtimearr_float +%_ptr_StorageBuffer_SB_RO = OpTypePointer StorageBuffer %SB_RO + %sb_ro = OpVariable %_ptr_StorageBuffer_SB_RO StorageBuffer + %void = OpTypeVoid + %13 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %21 = OpConstantNull %uint + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%arrayLength_a0f5ca = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %21 + %17 = OpArrayLength %uint %sb_ro 0 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %arrayLength_a0f5ca + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %31 = OpLabel + %32 = OpFunctionCall %void %arrayLength_a0f5ca + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %void %arrayLength_a0f5ca + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/arrayLength/a0f5ca.wgsl.expected.wgsl b/test/tint/builtins/gen/var/arrayLength/a0f5ca.wgsl.expected.wgsl new file mode 100644 index 0000000000..a1eb324f96 --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/a0f5ca.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +struct SB_RO { + arg_0 : array, +} + +@group(0) @binding(1) var sb_ro : SB_RO; + +fn arrayLength_a0f5ca() { + var res : u32 = arrayLength(&(sb_ro.arg_0)); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + arrayLength_a0f5ca(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + arrayLength_a0f5ca(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + arrayLength_a0f5ca(); +} diff --git a/test/tint/builtins/gen/var/arrayLength/cdd123.wgsl b/test/tint/builtins/gen/var/arrayLength/cdd123.wgsl new file mode 100644 index 0000000000..3b38e51c77 --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/cdd123.wgsl @@ -0,0 +1,49 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: array, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn arrayLength(ptr, read_write>) -> u32 +fn arrayLength_cdd123() { + var res: u32 = arrayLength(&sb_rw.arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + arrayLength_cdd123(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + arrayLength_cdd123(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + arrayLength_cdd123(); +} diff --git a/test/tint/builtins/gen/var/arrayLength/cdd123.wgsl.expected.glsl b/test/tint/builtins/gen/var/arrayLength/cdd123.wgsl.expected.glsl new file mode 100644 index 0000000000..dac4336dee --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/cdd123.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +layout(binding = 0, std430) buffer SB_RW_1 { + float arg_0[]; +} sb_rw; +void arrayLength_cdd123() { + uint res = uint(sb_rw.arg_0.length()); +} + +vec4 vertex_main() { + arrayLength_cdd123(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(binding = 0, std430) buffer SB_RW_1 { + float arg_0[]; +} sb_rw; +void arrayLength_cdd123() { + uint res = uint(sb_rw.arg_0.length()); +} + +void fragment_main() { + arrayLength_cdd123(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(binding = 0, std430) buffer SB_RW_1 { + float arg_0[]; +} sb_rw; +void arrayLength_cdd123() { + uint res = uint(sb_rw.arg_0.length()); +} + +void compute_main() { + arrayLength_cdd123(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/arrayLength/cdd123.wgsl.expected.hlsl b/test/tint/builtins/gen/var/arrayLength/cdd123.wgsl.expected.hlsl new file mode 100644 index 0000000000..2156844065 --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/cdd123.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +void arrayLength_cdd123() { + uint tint_symbol_2 = 0u; + sb_rw.GetDimensions(tint_symbol_2); + const uint tint_symbol_3 = ((tint_symbol_2 - 0u) / 4u); + uint res = tint_symbol_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + arrayLength_cdd123(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + arrayLength_cdd123(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + arrayLength_cdd123(); + return; +} diff --git a/test/tint/builtins/gen/var/arrayLength/cdd123.wgsl.expected.msl b/test/tint/builtins/gen/var/arrayLength/cdd123.wgsl.expected.msl new file mode 100644 index 0000000000..22cfa6cbaa --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/cdd123.wgsl.expected.msl @@ -0,0 +1,41 @@ +#include + +using namespace metal; +struct tint_symbol_1 { + /* 0x0000 */ uint4 buffer_size[1]; +}; + +struct SB_RW { + float arg_0[1]; +}; + +void arrayLength_cdd123(const constant tint_symbol_1* const tint_symbol_3) { + uint res = (((*(tint_symbol_3)).buffer_size[0u][0u] - 0u) / 4u); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(const constant tint_symbol_1* const tint_symbol_4) { + arrayLength_cdd123(tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(const constant tint_symbol_1* tint_symbol_5 [[buffer(30)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(const constant tint_symbol_1* tint_symbol_6 [[buffer(30)]]) { + arrayLength_cdd123(tint_symbol_6); + return; +} + +kernel void compute_main(const constant tint_symbol_1* tint_symbol_7 [[buffer(30)]]) { + arrayLength_cdd123(tint_symbol_7); + return; +} + diff --git a/test/tint/builtins/gen/var/arrayLength/cdd123.wgsl.expected.spvasm b/test/tint/builtins/gen/var/arrayLength/cdd123.wgsl.expected.spvasm new file mode 100644 index 0000000000..46447961c2 --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/cdd123.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %arrayLength_cdd123 "arrayLength_cdd123" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %_runtimearr_float ArrayStride 4 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 +%_runtimearr_float = OpTypeRuntimeArray %float + %SB_RW = OpTypeStruct %_runtimearr_float +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %13 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %21 = OpConstantNull %uint + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%arrayLength_cdd123 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %21 + %17 = OpArrayLength %uint %sb_rw 0 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %arrayLength_cdd123 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %31 = OpLabel + %32 = OpFunctionCall %void %arrayLength_cdd123 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %void %arrayLength_cdd123 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/arrayLength/cdd123.wgsl.expected.wgsl b/test/tint/builtins/gen/var/arrayLength/cdd123.wgsl.expected.wgsl new file mode 100644 index 0000000000..1f2d17cb09 --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/cdd123.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +struct SB_RW { + arg_0 : array, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn arrayLength_cdd123() { + var res : u32 = arrayLength(&(sb_rw.arg_0)); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + arrayLength_cdd123(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + arrayLength_cdd123(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + arrayLength_cdd123(); +} diff --git a/test/tint/builtins/gen/var/arrayLength/cfca0a.wgsl b/test/tint/builtins/gen/var/arrayLength/cfca0a.wgsl new file mode 100644 index 0000000000..99d788d87b --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/cfca0a.wgsl @@ -0,0 +1,49 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RO { + arg_0: array, +}; +@group(0) @binding(1) var sb_ro : SB_RO; + +// fn arrayLength(ptr, read>) -> u32 +fn arrayLength_cfca0a() { + var res: u32 = arrayLength(&sb_ro.arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + arrayLength_cfca0a(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + arrayLength_cfca0a(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + arrayLength_cfca0a(); +} diff --git a/test/tint/builtins/gen/var/arrayLength/cfca0a.wgsl.expected.glsl b/test/tint/builtins/gen/var/arrayLength/cfca0a.wgsl.expected.glsl new file mode 100644 index 0000000000..e159befc7e --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/cfca0a.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +layout(binding = 1, std430) buffer SB_RO_1 { + uint arg_0[]; +} sb_ro; +void arrayLength_cfca0a() { + uint res = uint(sb_ro.arg_0.length()); +} + +vec4 vertex_main() { + arrayLength_cfca0a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(binding = 1, std430) buffer SB_RO_1 { + uint arg_0[]; +} sb_ro; +void arrayLength_cfca0a() { + uint res = uint(sb_ro.arg_0.length()); +} + +void fragment_main() { + arrayLength_cfca0a(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(binding = 1, std430) buffer SB_RO_1 { + uint arg_0[]; +} sb_ro; +void arrayLength_cfca0a() { + uint res = uint(sb_ro.arg_0.length()); +} + +void compute_main() { + arrayLength_cfca0a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/arrayLength/cfca0a.wgsl.expected.hlsl b/test/tint/builtins/gen/var/arrayLength/cfca0a.wgsl.expected.hlsl new file mode 100644 index 0000000000..a6cf72ccdb --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/cfca0a.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +ByteAddressBuffer sb_ro : register(t1, space0); + +void arrayLength_cfca0a() { + uint tint_symbol_2 = 0u; + sb_ro.GetDimensions(tint_symbol_2); + const uint tint_symbol_3 = ((tint_symbol_2 - 0u) / 4u); + uint res = tint_symbol_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + arrayLength_cfca0a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + arrayLength_cfca0a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + arrayLength_cfca0a(); + return; +} diff --git a/test/tint/builtins/gen/var/arrayLength/cfca0a.wgsl.expected.msl b/test/tint/builtins/gen/var/arrayLength/cfca0a.wgsl.expected.msl new file mode 100644 index 0000000000..d64c1e002d --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/cfca0a.wgsl.expected.msl @@ -0,0 +1,41 @@ +#include + +using namespace metal; +struct tint_symbol_1 { + /* 0x0000 */ uint4 buffer_size[1]; +}; + +struct SB_RO { + uint arg_0[1]; +}; + +void arrayLength_cfca0a(const constant tint_symbol_1* const tint_symbol_3) { + uint res = (((*(tint_symbol_3)).buffer_size[0u][0u] - 0u) / 4u); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(const constant tint_symbol_1* const tint_symbol_4) { + arrayLength_cfca0a(tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(const constant tint_symbol_1* tint_symbol_5 [[buffer(30)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(const constant tint_symbol_1* tint_symbol_6 [[buffer(30)]]) { + arrayLength_cfca0a(tint_symbol_6); + return; +} + +kernel void compute_main(const constant tint_symbol_1* tint_symbol_7 [[buffer(30)]]) { + arrayLength_cfca0a(tint_symbol_7); + return; +} + diff --git a/test/tint/builtins/gen/var/arrayLength/cfca0a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/arrayLength/cfca0a.wgsl.expected.spvasm new file mode 100644 index 0000000000..db230e90cd --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/cfca0a.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %SB_RO "SB_RO" + OpMemberName %SB_RO 0 "arg_0" + OpName %sb_ro "sb_ro" + OpName %arrayLength_cfca0a "arrayLength_cfca0a" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %SB_RO Block + OpMemberDecorate %SB_RO 0 Offset 0 + OpDecorate %_runtimearr_uint ArrayStride 4 + OpDecorate %sb_ro NonWritable + OpDecorate %sb_ro DescriptorSet 0 + OpDecorate %sb_ro Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %SB_RO = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer_SB_RO = OpTypePointer StorageBuffer %SB_RO + %sb_ro = OpVariable %_ptr_StorageBuffer_SB_RO StorageBuffer + %void = OpTypeVoid + %14 = OpTypeFunction %void +%_ptr_Function_uint = OpTypePointer Function %uint + %21 = OpConstantNull %uint + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%arrayLength_cfca0a = OpFunction %void None %14 + %17 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %21 + %18 = OpArrayLength %uint %sb_ro 0 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %arrayLength_cfca0a + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %14 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %14 + %31 = OpLabel + %32 = OpFunctionCall %void %arrayLength_cfca0a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %14 + %34 = OpLabel + %35 = OpFunctionCall %void %arrayLength_cfca0a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/arrayLength/cfca0a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/arrayLength/cfca0a.wgsl.expected.wgsl new file mode 100644 index 0000000000..5778963880 --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/cfca0a.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +struct SB_RO { + arg_0 : array, +} + +@group(0) @binding(1) var sb_ro : SB_RO; + +fn arrayLength_cfca0a() { + var res : u32 = arrayLength(&(sb_ro.arg_0)); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + arrayLength_cfca0a(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + arrayLength_cfca0a(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + arrayLength_cfca0a(); +} diff --git a/test/tint/builtins/gen/var/arrayLength/eb510f.wgsl b/test/tint/builtins/gen/var/arrayLength/eb510f.wgsl new file mode 100644 index 0000000000..cc2627bbda --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/eb510f.wgsl @@ -0,0 +1,49 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: array, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn arrayLength(ptr, read_write>) -> u32 +fn arrayLength_eb510f() { + var res: u32 = arrayLength(&sb_rw.arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + arrayLength_eb510f(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + arrayLength_eb510f(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + arrayLength_eb510f(); +} diff --git a/test/tint/builtins/gen/var/arrayLength/eb510f.wgsl.expected.glsl b/test/tint/builtins/gen/var/arrayLength/eb510f.wgsl.expected.glsl new file mode 100644 index 0000000000..a11f1aa674 --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/eb510f.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +layout(binding = 0, std430) buffer SB_RW_1 { + uint arg_0[]; +} sb_rw; +void arrayLength_eb510f() { + uint res = uint(sb_rw.arg_0.length()); +} + +vec4 vertex_main() { + arrayLength_eb510f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(binding = 0, std430) buffer SB_RW_1 { + uint arg_0[]; +} sb_rw; +void arrayLength_eb510f() { + uint res = uint(sb_rw.arg_0.length()); +} + +void fragment_main() { + arrayLength_eb510f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(binding = 0, std430) buffer SB_RW_1 { + uint arg_0[]; +} sb_rw; +void arrayLength_eb510f() { + uint res = uint(sb_rw.arg_0.length()); +} + +void compute_main() { + arrayLength_eb510f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/arrayLength/eb510f.wgsl.expected.hlsl b/test/tint/builtins/gen/var/arrayLength/eb510f.wgsl.expected.hlsl new file mode 100644 index 0000000000..4b05a0fc83 --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/eb510f.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +void arrayLength_eb510f() { + uint tint_symbol_2 = 0u; + sb_rw.GetDimensions(tint_symbol_2); + const uint tint_symbol_3 = ((tint_symbol_2 - 0u) / 4u); + uint res = tint_symbol_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + arrayLength_eb510f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + arrayLength_eb510f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + arrayLength_eb510f(); + return; +} diff --git a/test/tint/builtins/gen/var/arrayLength/eb510f.wgsl.expected.msl b/test/tint/builtins/gen/var/arrayLength/eb510f.wgsl.expected.msl new file mode 100644 index 0000000000..44128538b9 --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/eb510f.wgsl.expected.msl @@ -0,0 +1,41 @@ +#include + +using namespace metal; +struct tint_symbol_1 { + /* 0x0000 */ uint4 buffer_size[1]; +}; + +struct SB_RW { + uint arg_0[1]; +}; + +void arrayLength_eb510f(const constant tint_symbol_1* const tint_symbol_3) { + uint res = (((*(tint_symbol_3)).buffer_size[0u][0u] - 0u) / 4u); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(const constant tint_symbol_1* const tint_symbol_4) { + arrayLength_eb510f(tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(const constant tint_symbol_1* tint_symbol_5 [[buffer(30)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(const constant tint_symbol_1* tint_symbol_6 [[buffer(30)]]) { + arrayLength_eb510f(tint_symbol_6); + return; +} + +kernel void compute_main(const constant tint_symbol_1* tint_symbol_7 [[buffer(30)]]) { + arrayLength_eb510f(tint_symbol_7); + return; +} + diff --git a/test/tint/builtins/gen/var/arrayLength/eb510f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/arrayLength/eb510f.wgsl.expected.spvasm new file mode 100644 index 0000000000..b165c3fbc0 --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/eb510f.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %arrayLength_eb510f "arrayLength_eb510f" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %_runtimearr_uint ArrayStride 4 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %SB_RW = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %14 = OpTypeFunction %void +%_ptr_Function_uint = OpTypePointer Function %uint + %21 = OpConstantNull %uint + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%arrayLength_eb510f = OpFunction %void None %14 + %17 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %21 + %18 = OpArrayLength %uint %sb_rw 0 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %arrayLength_eb510f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %14 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %14 + %31 = OpLabel + %32 = OpFunctionCall %void %arrayLength_eb510f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %14 + %34 = OpLabel + %35 = OpFunctionCall %void %arrayLength_eb510f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/arrayLength/eb510f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/arrayLength/eb510f.wgsl.expected.wgsl new file mode 100644 index 0000000000..805917c027 --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/eb510f.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +struct SB_RW { + arg_0 : array, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn arrayLength_eb510f() { + var res : u32 = arrayLength(&(sb_rw.arg_0)); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + arrayLength_eb510f(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + arrayLength_eb510f(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + arrayLength_eb510f(); +} diff --git a/test/tint/builtins/gen/var/asin/064953.wgsl b/test/tint/builtins/gen/var/asin/064953.wgsl new file mode 100644 index 0000000000..5e2ba51b8d --- /dev/null +++ b/test/tint/builtins/gen/var/asin/064953.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn asin(vec<4, f32>) -> vec<4, f32> +fn asin_064953() { + var arg_0 = vec4(); + var res: vec4 = asin(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + asin_064953(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + asin_064953(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + asin_064953(); +} diff --git a/test/tint/builtins/gen/var/asin/064953.wgsl.expected.glsl b/test/tint/builtins/gen/var/asin/064953.wgsl.expected.glsl new file mode 100644 index 0000000000..3ea2994796 --- /dev/null +++ b/test/tint/builtins/gen/var/asin/064953.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void asin_064953() { + vec4 arg_0 = vec4(0.0f); + vec4 res = asin(arg_0); +} + +vec4 vertex_main() { + asin_064953(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void asin_064953() { + vec4 arg_0 = vec4(0.0f); + vec4 res = asin(arg_0); +} + +void fragment_main() { + asin_064953(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void asin_064953() { + vec4 arg_0 = vec4(0.0f); + vec4 res = asin(arg_0); +} + +void compute_main() { + asin_064953(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/asin/064953.wgsl.expected.hlsl b/test/tint/builtins/gen/var/asin/064953.wgsl.expected.hlsl new file mode 100644 index 0000000000..21168e7ea4 --- /dev/null +++ b/test/tint/builtins/gen/var/asin/064953.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void asin_064953() { + float4 arg_0 = (0.0f).xxxx; + float4 res = asin(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asin_064953(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asin_064953(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asin_064953(); + return; +} diff --git a/test/tint/builtins/gen/var/asin/064953.wgsl.expected.msl b/test/tint/builtins/gen/var/asin/064953.wgsl.expected.msl new file mode 100644 index 0000000000..ee8a542c8c --- /dev/null +++ b/test/tint/builtins/gen/var/asin/064953.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void asin_064953() { + float4 arg_0 = float4(0.0f); + float4 res = asin(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + asin_064953(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + asin_064953(); + return; +} + +kernel void compute_main() { + asin_064953(); + return; +} + diff --git a/test/tint/builtins/gen/var/asin/064953.wgsl.expected.spvasm b/test/tint/builtins/gen/var/asin/064953.wgsl.expected.spvasm new file mode 100644 index 0000000000..632fae465f --- /dev/null +++ b/test/tint/builtins/gen/var/asin/064953.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %asin_064953 "asin_064953" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%asin_064953 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %5 + %17 = OpLoad %v4float %arg_0 + %15 = OpExtInst %v4float %16 Asin %17 + OpStore %res %15 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %asin_064953 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %asin_064953 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %asin_064953 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/asin/064953.wgsl.expected.wgsl b/test/tint/builtins/gen/var/asin/064953.wgsl.expected.wgsl new file mode 100644 index 0000000000..3753e5a982 --- /dev/null +++ b/test/tint/builtins/gen/var/asin/064953.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn asin_064953() { + var arg_0 = vec4(); + var res : vec4 = asin(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + asin_064953(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + asin_064953(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + asin_064953(); +} diff --git a/test/tint/builtins/gen/var/asin/7b6a44.wgsl b/test/tint/builtins/gen/var/asin/7b6a44.wgsl new file mode 100644 index 0000000000..a52ec14c31 --- /dev/null +++ b/test/tint/builtins/gen/var/asin/7b6a44.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn asin(vec<2, f32>) -> vec<2, f32> +fn asin_7b6a44() { + var arg_0 = vec2(); + var res: vec2 = asin(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + asin_7b6a44(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + asin_7b6a44(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + asin_7b6a44(); +} diff --git a/test/tint/builtins/gen/var/asin/7b6a44.wgsl.expected.glsl b/test/tint/builtins/gen/var/asin/7b6a44.wgsl.expected.glsl new file mode 100644 index 0000000000..28c990f2b1 --- /dev/null +++ b/test/tint/builtins/gen/var/asin/7b6a44.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void asin_7b6a44() { + vec2 arg_0 = vec2(0.0f); + vec2 res = asin(arg_0); +} + +vec4 vertex_main() { + asin_7b6a44(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void asin_7b6a44() { + vec2 arg_0 = vec2(0.0f); + vec2 res = asin(arg_0); +} + +void fragment_main() { + asin_7b6a44(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void asin_7b6a44() { + vec2 arg_0 = vec2(0.0f); + vec2 res = asin(arg_0); +} + +void compute_main() { + asin_7b6a44(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/asin/7b6a44.wgsl.expected.hlsl b/test/tint/builtins/gen/var/asin/7b6a44.wgsl.expected.hlsl new file mode 100644 index 0000000000..306769cdce --- /dev/null +++ b/test/tint/builtins/gen/var/asin/7b6a44.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void asin_7b6a44() { + float2 arg_0 = (0.0f).xx; + float2 res = asin(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asin_7b6a44(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asin_7b6a44(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asin_7b6a44(); + return; +} diff --git a/test/tint/builtins/gen/var/asin/7b6a44.wgsl.expected.msl b/test/tint/builtins/gen/var/asin/7b6a44.wgsl.expected.msl new file mode 100644 index 0000000000..f1e70f4223 --- /dev/null +++ b/test/tint/builtins/gen/var/asin/7b6a44.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void asin_7b6a44() { + float2 arg_0 = float2(0.0f); + float2 res = asin(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + asin_7b6a44(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + asin_7b6a44(); + return; +} + +kernel void compute_main() { + asin_7b6a44(); + return; +} + diff --git a/test/tint/builtins/gen/var/asin/7b6a44.wgsl.expected.spvasm b/test/tint/builtins/gen/var/asin/7b6a44.wgsl.expected.spvasm new file mode 100644 index 0000000000..a77325ca41 --- /dev/null +++ b/test/tint/builtins/gen/var/asin/7b6a44.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %asin_7b6a44 "asin_7b6a44" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %14 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%asin_7b6a44 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %14 + %res = OpVariable %_ptr_Function_v2float Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %v2float %arg_0 + %17 = OpExtInst %v2float %18 Asin %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %asin_7b6a44 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %asin_7b6a44 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %asin_7b6a44 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/asin/7b6a44.wgsl.expected.wgsl b/test/tint/builtins/gen/var/asin/7b6a44.wgsl.expected.wgsl new file mode 100644 index 0000000000..ec5ec15906 --- /dev/null +++ b/test/tint/builtins/gen/var/asin/7b6a44.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn asin_7b6a44() { + var arg_0 = vec2(); + var res : vec2 = asin(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + asin_7b6a44(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + asin_7b6a44(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + asin_7b6a44(); +} diff --git a/test/tint/builtins/gen/var/asin/8cd9c9.wgsl b/test/tint/builtins/gen/var/asin/8cd9c9.wgsl new file mode 100644 index 0000000000..e568908c5e --- /dev/null +++ b/test/tint/builtins/gen/var/asin/8cd9c9.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn asin(vec<3, f32>) -> vec<3, f32> +fn asin_8cd9c9() { + var arg_0 = vec3(); + var res: vec3 = asin(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + asin_8cd9c9(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + asin_8cd9c9(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + asin_8cd9c9(); +} diff --git a/test/tint/builtins/gen/var/asin/8cd9c9.wgsl.expected.glsl b/test/tint/builtins/gen/var/asin/8cd9c9.wgsl.expected.glsl new file mode 100644 index 0000000000..f1a29671c4 --- /dev/null +++ b/test/tint/builtins/gen/var/asin/8cd9c9.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void asin_8cd9c9() { + vec3 arg_0 = vec3(0.0f); + vec3 res = asin(arg_0); +} + +vec4 vertex_main() { + asin_8cd9c9(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void asin_8cd9c9() { + vec3 arg_0 = vec3(0.0f); + vec3 res = asin(arg_0); +} + +void fragment_main() { + asin_8cd9c9(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void asin_8cd9c9() { + vec3 arg_0 = vec3(0.0f); + vec3 res = asin(arg_0); +} + +void compute_main() { + asin_8cd9c9(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/asin/8cd9c9.wgsl.expected.hlsl b/test/tint/builtins/gen/var/asin/8cd9c9.wgsl.expected.hlsl new file mode 100644 index 0000000000..ba54cdc4db --- /dev/null +++ b/test/tint/builtins/gen/var/asin/8cd9c9.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void asin_8cd9c9() { + float3 arg_0 = (0.0f).xxx; + float3 res = asin(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asin_8cd9c9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asin_8cd9c9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asin_8cd9c9(); + return; +} diff --git a/test/tint/builtins/gen/var/asin/8cd9c9.wgsl.expected.msl b/test/tint/builtins/gen/var/asin/8cd9c9.wgsl.expected.msl new file mode 100644 index 0000000000..848555c240 --- /dev/null +++ b/test/tint/builtins/gen/var/asin/8cd9c9.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void asin_8cd9c9() { + float3 arg_0 = float3(0.0f); + float3 res = asin(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + asin_8cd9c9(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + asin_8cd9c9(); + return; +} + +kernel void compute_main() { + asin_8cd9c9(); + return; +} + diff --git a/test/tint/builtins/gen/var/asin/8cd9c9.wgsl.expected.spvasm b/test/tint/builtins/gen/var/asin/8cd9c9.wgsl.expected.spvasm new file mode 100644 index 0000000000..85c702db70 --- /dev/null +++ b/test/tint/builtins/gen/var/asin/8cd9c9.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %asin_8cd9c9 "asin_8cd9c9" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %14 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%asin_8cd9c9 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %14 + %res = OpVariable %_ptr_Function_v3float Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %v3float %arg_0 + %17 = OpExtInst %v3float %18 Asin %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %asin_8cd9c9 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %asin_8cd9c9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %asin_8cd9c9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/asin/8cd9c9.wgsl.expected.wgsl b/test/tint/builtins/gen/var/asin/8cd9c9.wgsl.expected.wgsl new file mode 100644 index 0000000000..be247ddb0d --- /dev/null +++ b/test/tint/builtins/gen/var/asin/8cd9c9.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn asin_8cd9c9() { + var arg_0 = vec3(); + var res : vec3 = asin(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + asin_8cd9c9(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + asin_8cd9c9(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + asin_8cd9c9(); +} diff --git a/test/tint/builtins/gen/var/asin/c0c272.wgsl b/test/tint/builtins/gen/var/asin/c0c272.wgsl new file mode 100644 index 0000000000..f7c1933d3b --- /dev/null +++ b/test/tint/builtins/gen/var/asin/c0c272.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn asin(f32) -> f32 +fn asin_c0c272() { + var arg_0 = 1.0; + var res: f32 = asin(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + asin_c0c272(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + asin_c0c272(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + asin_c0c272(); +} diff --git a/test/tint/builtins/gen/var/asin/c0c272.wgsl.expected.glsl b/test/tint/builtins/gen/var/asin/c0c272.wgsl.expected.glsl new file mode 100644 index 0000000000..9869bdbc05 --- /dev/null +++ b/test/tint/builtins/gen/var/asin/c0c272.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void asin_c0c272() { + float arg_0 = 1.0f; + float res = asin(arg_0); +} + +vec4 vertex_main() { + asin_c0c272(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void asin_c0c272() { + float arg_0 = 1.0f; + float res = asin(arg_0); +} + +void fragment_main() { + asin_c0c272(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void asin_c0c272() { + float arg_0 = 1.0f; + float res = asin(arg_0); +} + +void compute_main() { + asin_c0c272(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/asin/c0c272.wgsl.expected.hlsl b/test/tint/builtins/gen/var/asin/c0c272.wgsl.expected.hlsl new file mode 100644 index 0000000000..ad66315d46 --- /dev/null +++ b/test/tint/builtins/gen/var/asin/c0c272.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void asin_c0c272() { + float arg_0 = 1.0f; + float res = asin(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asin_c0c272(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asin_c0c272(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asin_c0c272(); + return; +} diff --git a/test/tint/builtins/gen/var/asin/c0c272.wgsl.expected.msl b/test/tint/builtins/gen/var/asin/c0c272.wgsl.expected.msl new file mode 100644 index 0000000000..c8dc4da358 --- /dev/null +++ b/test/tint/builtins/gen/var/asin/c0c272.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void asin_c0c272() { + float arg_0 = 1.0f; + float res = asin(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + asin_c0c272(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + asin_c0c272(); + return; +} + +kernel void compute_main() { + asin_c0c272(); + return; +} + diff --git a/test/tint/builtins/gen/var/asin/c0c272.wgsl.expected.spvasm b/test/tint/builtins/gen/var/asin/c0c272.wgsl.expected.spvasm new file mode 100644 index 0000000000..6ee3f4a9cb --- /dev/null +++ b/test/tint/builtins/gen/var/asin/c0c272.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %asin_c0c272 "asin_c0c272" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %20 = OpTypeFunction %v4float +%asin_c0c272 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + %18 = OpLoad %float %arg_0 + %16 = OpExtInst %float %17 Asin %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %asin_c0c272 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %asin_c0c272 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %asin_c0c272 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/asin/c0c272.wgsl.expected.wgsl b/test/tint/builtins/gen/var/asin/c0c272.wgsl.expected.wgsl new file mode 100644 index 0000000000..15931858bf --- /dev/null +++ b/test/tint/builtins/gen/var/asin/c0c272.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn asin_c0c272() { + var arg_0 = 1.0; + var res : f32 = asin(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + asin_c0c272(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + asin_c0c272(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + asin_c0c272(); +} diff --git a/test/tint/builtins/gen/var/atan/02979a.wgsl b/test/tint/builtins/gen/var/atan/02979a.wgsl new file mode 100644 index 0000000000..b78ade5cfe --- /dev/null +++ b/test/tint/builtins/gen/var/atan/02979a.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn atan(f32) -> f32 +fn atan_02979a() { + var arg_0 = 1.0; + var res: f32 = atan(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + atan_02979a(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + atan_02979a(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atan_02979a(); +} diff --git a/test/tint/builtins/gen/var/atan/02979a.wgsl.expected.glsl b/test/tint/builtins/gen/var/atan/02979a.wgsl.expected.glsl new file mode 100644 index 0000000000..b228c08b1b --- /dev/null +++ b/test/tint/builtins/gen/var/atan/02979a.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void atan_02979a() { + float arg_0 = 1.0f; + float res = atan(arg_0); +} + +vec4 vertex_main() { + atan_02979a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void atan_02979a() { + float arg_0 = 1.0f; + float res = atan(arg_0); +} + +void fragment_main() { + atan_02979a(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void atan_02979a() { + float arg_0 = 1.0f; + float res = atan(arg_0); +} + +void compute_main() { + atan_02979a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atan/02979a.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atan/02979a.wgsl.expected.hlsl new file mode 100644 index 0000000000..8b78942c67 --- /dev/null +++ b/test/tint/builtins/gen/var/atan/02979a.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void atan_02979a() { + float arg_0 = 1.0f; + float res = atan(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan_02979a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan_02979a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan_02979a(); + return; +} diff --git a/test/tint/builtins/gen/var/atan/02979a.wgsl.expected.msl b/test/tint/builtins/gen/var/atan/02979a.wgsl.expected.msl new file mode 100644 index 0000000000..53002f43d1 --- /dev/null +++ b/test/tint/builtins/gen/var/atan/02979a.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void atan_02979a() { + float arg_0 = 1.0f; + float res = atan(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atan_02979a(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atan_02979a(); + return; +} + +kernel void compute_main() { + atan_02979a(); + return; +} + diff --git a/test/tint/builtins/gen/var/atan/02979a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atan/02979a.wgsl.expected.spvasm new file mode 100644 index 0000000000..b405e4a798 --- /dev/null +++ b/test/tint/builtins/gen/var/atan/02979a.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %atan_02979a "atan_02979a" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %20 = OpTypeFunction %v4float +%atan_02979a = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + %18 = OpLoad %float %arg_0 + %16 = OpExtInst %float %17 Atan %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %atan_02979a + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %atan_02979a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %atan_02979a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atan/02979a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atan/02979a.wgsl.expected.wgsl new file mode 100644 index 0000000000..398e043eee --- /dev/null +++ b/test/tint/builtins/gen/var/atan/02979a.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn atan_02979a() { + var arg_0 = 1.0; + var res : f32 = atan(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + atan_02979a(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + atan_02979a(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atan_02979a(); +} diff --git a/test/tint/builtins/gen/var/atan/331e6d.wgsl b/test/tint/builtins/gen/var/atan/331e6d.wgsl new file mode 100644 index 0000000000..672efcba01 --- /dev/null +++ b/test/tint/builtins/gen/var/atan/331e6d.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn atan(vec<3, f32>) -> vec<3, f32> +fn atan_331e6d() { + var arg_0 = vec3(); + var res: vec3 = atan(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + atan_331e6d(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + atan_331e6d(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atan_331e6d(); +} diff --git a/test/tint/builtins/gen/var/atan/331e6d.wgsl.expected.glsl b/test/tint/builtins/gen/var/atan/331e6d.wgsl.expected.glsl new file mode 100644 index 0000000000..89f42e6b56 --- /dev/null +++ b/test/tint/builtins/gen/var/atan/331e6d.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void atan_331e6d() { + vec3 arg_0 = vec3(0.0f); + vec3 res = atan(arg_0); +} + +vec4 vertex_main() { + atan_331e6d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void atan_331e6d() { + vec3 arg_0 = vec3(0.0f); + vec3 res = atan(arg_0); +} + +void fragment_main() { + atan_331e6d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void atan_331e6d() { + vec3 arg_0 = vec3(0.0f); + vec3 res = atan(arg_0); +} + +void compute_main() { + atan_331e6d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atan/331e6d.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atan/331e6d.wgsl.expected.hlsl new file mode 100644 index 0000000000..11f8b76ec9 --- /dev/null +++ b/test/tint/builtins/gen/var/atan/331e6d.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void atan_331e6d() { + float3 arg_0 = (0.0f).xxx; + float3 res = atan(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan_331e6d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan_331e6d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan_331e6d(); + return; +} diff --git a/test/tint/builtins/gen/var/atan/331e6d.wgsl.expected.msl b/test/tint/builtins/gen/var/atan/331e6d.wgsl.expected.msl new file mode 100644 index 0000000000..4594dbc311 --- /dev/null +++ b/test/tint/builtins/gen/var/atan/331e6d.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void atan_331e6d() { + float3 arg_0 = float3(0.0f); + float3 res = atan(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atan_331e6d(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atan_331e6d(); + return; +} + +kernel void compute_main() { + atan_331e6d(); + return; +} + diff --git a/test/tint/builtins/gen/var/atan/331e6d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atan/331e6d.wgsl.expected.spvasm new file mode 100644 index 0000000000..3f6e2f0cb6 --- /dev/null +++ b/test/tint/builtins/gen/var/atan/331e6d.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %atan_331e6d "atan_331e6d" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %14 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%atan_331e6d = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %14 + %res = OpVariable %_ptr_Function_v3float Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %v3float %arg_0 + %17 = OpExtInst %v3float %18 Atan %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %atan_331e6d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %atan_331e6d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %atan_331e6d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atan/331e6d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atan/331e6d.wgsl.expected.wgsl new file mode 100644 index 0000000000..22be44367d --- /dev/null +++ b/test/tint/builtins/gen/var/atan/331e6d.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn atan_331e6d() { + var arg_0 = vec3(); + var res : vec3 = atan(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + atan_331e6d(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + atan_331e6d(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atan_331e6d(); +} diff --git a/test/tint/builtins/gen/var/atan/a8b696.wgsl b/test/tint/builtins/gen/var/atan/a8b696.wgsl new file mode 100644 index 0000000000..edab37d5cf --- /dev/null +++ b/test/tint/builtins/gen/var/atan/a8b696.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn atan(vec<4, f32>) -> vec<4, f32> +fn atan_a8b696() { + var arg_0 = vec4(); + var res: vec4 = atan(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + atan_a8b696(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + atan_a8b696(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atan_a8b696(); +} diff --git a/test/tint/builtins/gen/var/atan/a8b696.wgsl.expected.glsl b/test/tint/builtins/gen/var/atan/a8b696.wgsl.expected.glsl new file mode 100644 index 0000000000..358182986a --- /dev/null +++ b/test/tint/builtins/gen/var/atan/a8b696.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void atan_a8b696() { + vec4 arg_0 = vec4(0.0f); + vec4 res = atan(arg_0); +} + +vec4 vertex_main() { + atan_a8b696(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void atan_a8b696() { + vec4 arg_0 = vec4(0.0f); + vec4 res = atan(arg_0); +} + +void fragment_main() { + atan_a8b696(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void atan_a8b696() { + vec4 arg_0 = vec4(0.0f); + vec4 res = atan(arg_0); +} + +void compute_main() { + atan_a8b696(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atan/a8b696.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atan/a8b696.wgsl.expected.hlsl new file mode 100644 index 0000000000..952af660e9 --- /dev/null +++ b/test/tint/builtins/gen/var/atan/a8b696.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void atan_a8b696() { + float4 arg_0 = (0.0f).xxxx; + float4 res = atan(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan_a8b696(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan_a8b696(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan_a8b696(); + return; +} diff --git a/test/tint/builtins/gen/var/atan/a8b696.wgsl.expected.msl b/test/tint/builtins/gen/var/atan/a8b696.wgsl.expected.msl new file mode 100644 index 0000000000..28232e0e5e --- /dev/null +++ b/test/tint/builtins/gen/var/atan/a8b696.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void atan_a8b696() { + float4 arg_0 = float4(0.0f); + float4 res = atan(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atan_a8b696(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atan_a8b696(); + return; +} + +kernel void compute_main() { + atan_a8b696(); + return; +} + diff --git a/test/tint/builtins/gen/var/atan/a8b696.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atan/a8b696.wgsl.expected.spvasm new file mode 100644 index 0000000000..71ce407ba5 --- /dev/null +++ b/test/tint/builtins/gen/var/atan/a8b696.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %atan_a8b696 "atan_a8b696" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%atan_a8b696 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %5 + %17 = OpLoad %v4float %arg_0 + %15 = OpExtInst %v4float %16 Atan %17 + OpStore %res %15 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %atan_a8b696 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %atan_a8b696 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %atan_a8b696 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atan/a8b696.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atan/a8b696.wgsl.expected.wgsl new file mode 100644 index 0000000000..88209b12e8 --- /dev/null +++ b/test/tint/builtins/gen/var/atan/a8b696.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn atan_a8b696() { + var arg_0 = vec4(); + var res : vec4 = atan(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + atan_a8b696(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + atan_a8b696(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atan_a8b696(); +} diff --git a/test/tint/builtins/gen/var/atan/ad96e4.wgsl b/test/tint/builtins/gen/var/atan/ad96e4.wgsl new file mode 100644 index 0000000000..0d33269ace --- /dev/null +++ b/test/tint/builtins/gen/var/atan/ad96e4.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn atan(vec<2, f32>) -> vec<2, f32> +fn atan_ad96e4() { + var arg_0 = vec2(); + var res: vec2 = atan(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + atan_ad96e4(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + atan_ad96e4(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atan_ad96e4(); +} diff --git a/test/tint/builtins/gen/var/atan/ad96e4.wgsl.expected.glsl b/test/tint/builtins/gen/var/atan/ad96e4.wgsl.expected.glsl new file mode 100644 index 0000000000..cef5994a60 --- /dev/null +++ b/test/tint/builtins/gen/var/atan/ad96e4.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void atan_ad96e4() { + vec2 arg_0 = vec2(0.0f); + vec2 res = atan(arg_0); +} + +vec4 vertex_main() { + atan_ad96e4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void atan_ad96e4() { + vec2 arg_0 = vec2(0.0f); + vec2 res = atan(arg_0); +} + +void fragment_main() { + atan_ad96e4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void atan_ad96e4() { + vec2 arg_0 = vec2(0.0f); + vec2 res = atan(arg_0); +} + +void compute_main() { + atan_ad96e4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atan/ad96e4.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atan/ad96e4.wgsl.expected.hlsl new file mode 100644 index 0000000000..dca78eb327 --- /dev/null +++ b/test/tint/builtins/gen/var/atan/ad96e4.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void atan_ad96e4() { + float2 arg_0 = (0.0f).xx; + float2 res = atan(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan_ad96e4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan_ad96e4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan_ad96e4(); + return; +} diff --git a/test/tint/builtins/gen/var/atan/ad96e4.wgsl.expected.msl b/test/tint/builtins/gen/var/atan/ad96e4.wgsl.expected.msl new file mode 100644 index 0000000000..683f31d709 --- /dev/null +++ b/test/tint/builtins/gen/var/atan/ad96e4.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void atan_ad96e4() { + float2 arg_0 = float2(0.0f); + float2 res = atan(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atan_ad96e4(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atan_ad96e4(); + return; +} + +kernel void compute_main() { + atan_ad96e4(); + return; +} + diff --git a/test/tint/builtins/gen/var/atan/ad96e4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atan/ad96e4.wgsl.expected.spvasm new file mode 100644 index 0000000000..2434fef6ed --- /dev/null +++ b/test/tint/builtins/gen/var/atan/ad96e4.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %atan_ad96e4 "atan_ad96e4" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %14 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%atan_ad96e4 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %14 + %res = OpVariable %_ptr_Function_v2float Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %v2float %arg_0 + %17 = OpExtInst %v2float %18 Atan %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %atan_ad96e4 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %atan_ad96e4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %atan_ad96e4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atan/ad96e4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atan/ad96e4.wgsl.expected.wgsl new file mode 100644 index 0000000000..7fa376b7ac --- /dev/null +++ b/test/tint/builtins/gen/var/atan/ad96e4.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn atan_ad96e4() { + var arg_0 = vec2(); + var res : vec2 = atan(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + atan_ad96e4(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + atan_ad96e4(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atan_ad96e4(); +} diff --git a/test/tint/builtins/gen/var/atan2/57fb13.wgsl b/test/tint/builtins/gen/var/atan2/57fb13.wgsl new file mode 100644 index 0000000000..768cf69f7a --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/57fb13.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn atan2(vec<2, f32>, vec<2, f32>) -> vec<2, f32> +fn atan2_57fb13() { + var arg_0 = vec2(); + var arg_1 = vec2(); + var res: vec2 = atan2(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + atan2_57fb13(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + atan2_57fb13(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atan2_57fb13(); +} diff --git a/test/tint/builtins/gen/var/atan2/57fb13.wgsl.expected.glsl b/test/tint/builtins/gen/var/atan2/57fb13.wgsl.expected.glsl new file mode 100644 index 0000000000..b3a643bf41 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/57fb13.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void atan2_57fb13() { + vec2 arg_0 = vec2(0.0f); + vec2 arg_1 = vec2(0.0f); + vec2 res = atan(arg_0, arg_1); +} + +vec4 vertex_main() { + atan2_57fb13(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void atan2_57fb13() { + vec2 arg_0 = vec2(0.0f); + vec2 arg_1 = vec2(0.0f); + vec2 res = atan(arg_0, arg_1); +} + +void fragment_main() { + atan2_57fb13(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void atan2_57fb13() { + vec2 arg_0 = vec2(0.0f); + vec2 arg_1 = vec2(0.0f); + vec2 res = atan(arg_0, arg_1); +} + +void compute_main() { + atan2_57fb13(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atan2/57fb13.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atan2/57fb13.wgsl.expected.hlsl new file mode 100644 index 0000000000..8cccbb73f1 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/57fb13.wgsl.expected.hlsl @@ -0,0 +1,32 @@ +void atan2_57fb13() { + float2 arg_0 = (0.0f).xx; + float2 arg_1 = (0.0f).xx; + float2 res = atan2(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan2_57fb13(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan2_57fb13(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan2_57fb13(); + return; +} diff --git a/test/tint/builtins/gen/var/atan2/57fb13.wgsl.expected.msl b/test/tint/builtins/gen/var/atan2/57fb13.wgsl.expected.msl new file mode 100644 index 0000000000..4db45ca72b --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/57fb13.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void atan2_57fb13() { + float2 arg_0 = float2(0.0f); + float2 arg_1 = float2(0.0f); + float2 res = atan2(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atan2_57fb13(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atan2_57fb13(); + return; +} + +kernel void compute_main() { + atan2_57fb13(); + return; +} + diff --git a/test/tint/builtins/gen/var/atan2/57fb13.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atan2/57fb13.wgsl.expected.spvasm new file mode 100644 index 0000000000..32423fa3da --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/57fb13.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %atan2_57fb13 "atan2_57fb13" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %14 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%atan2_57fb13 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %14 + %arg_1 = OpVariable %_ptr_Function_v2float Function %14 + %res = OpVariable %_ptr_Function_v2float Function %14 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + %20 = OpLoad %v2float %arg_0 + %21 = OpLoad %v2float %arg_1 + %18 = OpExtInst %v2float %19 Atan2 %20 %21 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %atan2_57fb13 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %atan2_57fb13 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %atan2_57fb13 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atan2/57fb13.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atan2/57fb13.wgsl.expected.wgsl new file mode 100644 index 0000000000..d53cd33e9e --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/57fb13.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn atan2_57fb13() { + var arg_0 = vec2(); + var arg_1 = vec2(); + var res : vec2 = atan2(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + atan2_57fb13(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + atan2_57fb13(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atan2_57fb13(); +} diff --git a/test/tint/builtins/gen/var/atan2/96057c.wgsl b/test/tint/builtins/gen/var/atan2/96057c.wgsl new file mode 100644 index 0000000000..789461b043 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/96057c.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn atan2(f32, f32) -> f32 +fn atan2_96057c() { + var arg_0 = 1.0; + var arg_1 = 1.0; + var res: f32 = atan2(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + atan2_96057c(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + atan2_96057c(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atan2_96057c(); +} diff --git a/test/tint/builtins/gen/var/atan2/96057c.wgsl.expected.glsl b/test/tint/builtins/gen/var/atan2/96057c.wgsl.expected.glsl new file mode 100644 index 0000000000..f1ea03a736 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/96057c.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void atan2_96057c() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float res = atan(arg_0, arg_1); +} + +vec4 vertex_main() { + atan2_96057c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void atan2_96057c() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float res = atan(arg_0, arg_1); +} + +void fragment_main() { + atan2_96057c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void atan2_96057c() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float res = atan(arg_0, arg_1); +} + +void compute_main() { + atan2_96057c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atan2/96057c.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atan2/96057c.wgsl.expected.hlsl new file mode 100644 index 0000000000..39bf0d5e19 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/96057c.wgsl.expected.hlsl @@ -0,0 +1,32 @@ +void atan2_96057c() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float res = atan2(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan2_96057c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan2_96057c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan2_96057c(); + return; +} diff --git a/test/tint/builtins/gen/var/atan2/96057c.wgsl.expected.msl b/test/tint/builtins/gen/var/atan2/96057c.wgsl.expected.msl new file mode 100644 index 0000000000..799efaa0c6 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/96057c.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void atan2_96057c() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float res = atan2(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atan2_96057c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atan2_96057c(); + return; +} + +kernel void compute_main() { + atan2_96057c(); + return; +} + diff --git a/test/tint/builtins/gen/var/atan2/96057c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atan2/96057c.wgsl.expected.spvasm new file mode 100644 index 0000000000..8a92d4b071 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/96057c.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %atan2_96057c "atan2_96057c" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %22 = OpTypeFunction %v4float +%atan2_96057c = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %arg_1 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + OpStore %arg_1 %float_1 + %19 = OpLoad %float %arg_0 + %20 = OpLoad %float %arg_1 + %17 = OpExtInst %float %18 Atan2 %19 %20 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %atan2_96057c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %atan2_96057c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %atan2_96057c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atan2/96057c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atan2/96057c.wgsl.expected.wgsl new file mode 100644 index 0000000000..7931ce2234 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/96057c.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn atan2_96057c() { + var arg_0 = 1.0; + var arg_1 = 1.0; + var res : f32 = atan2(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + atan2_96057c(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + atan2_96057c(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atan2_96057c(); +} diff --git a/test/tint/builtins/gen/var/atan2/a70d0d.wgsl b/test/tint/builtins/gen/var/atan2/a70d0d.wgsl new file mode 100644 index 0000000000..1a5599b736 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/a70d0d.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn atan2(vec<3, f32>, vec<3, f32>) -> vec<3, f32> +fn atan2_a70d0d() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var res: vec3 = atan2(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + atan2_a70d0d(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + atan2_a70d0d(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atan2_a70d0d(); +} diff --git a/test/tint/builtins/gen/var/atan2/a70d0d.wgsl.expected.glsl b/test/tint/builtins/gen/var/atan2/a70d0d.wgsl.expected.glsl new file mode 100644 index 0000000000..4a5efeb10d --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/a70d0d.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void atan2_a70d0d() { + vec3 arg_0 = vec3(0.0f); + vec3 arg_1 = vec3(0.0f); + vec3 res = atan(arg_0, arg_1); +} + +vec4 vertex_main() { + atan2_a70d0d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void atan2_a70d0d() { + vec3 arg_0 = vec3(0.0f); + vec3 arg_1 = vec3(0.0f); + vec3 res = atan(arg_0, arg_1); +} + +void fragment_main() { + atan2_a70d0d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void atan2_a70d0d() { + vec3 arg_0 = vec3(0.0f); + vec3 arg_1 = vec3(0.0f); + vec3 res = atan(arg_0, arg_1); +} + +void compute_main() { + atan2_a70d0d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atan2/a70d0d.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atan2/a70d0d.wgsl.expected.hlsl new file mode 100644 index 0000000000..e21a03a93b --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/a70d0d.wgsl.expected.hlsl @@ -0,0 +1,32 @@ +void atan2_a70d0d() { + float3 arg_0 = (0.0f).xxx; + float3 arg_1 = (0.0f).xxx; + float3 res = atan2(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan2_a70d0d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan2_a70d0d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan2_a70d0d(); + return; +} diff --git a/test/tint/builtins/gen/var/atan2/a70d0d.wgsl.expected.msl b/test/tint/builtins/gen/var/atan2/a70d0d.wgsl.expected.msl new file mode 100644 index 0000000000..e76e753a57 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/a70d0d.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void atan2_a70d0d() { + float3 arg_0 = float3(0.0f); + float3 arg_1 = float3(0.0f); + float3 res = atan2(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atan2_a70d0d(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atan2_a70d0d(); + return; +} + +kernel void compute_main() { + atan2_a70d0d(); + return; +} + diff --git a/test/tint/builtins/gen/var/atan2/a70d0d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atan2/a70d0d.wgsl.expected.spvasm new file mode 100644 index 0000000000..e6675dc9cf --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/a70d0d.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %atan2_a70d0d "atan2_a70d0d" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %14 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%atan2_a70d0d = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %14 + %arg_1 = OpVariable %_ptr_Function_v3float Function %14 + %res = OpVariable %_ptr_Function_v3float Function %14 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + %20 = OpLoad %v3float %arg_0 + %21 = OpLoad %v3float %arg_1 + %18 = OpExtInst %v3float %19 Atan2 %20 %21 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %atan2_a70d0d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %atan2_a70d0d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %atan2_a70d0d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atan2/a70d0d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atan2/a70d0d.wgsl.expected.wgsl new file mode 100644 index 0000000000..3cc0e0f67b --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/a70d0d.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn atan2_a70d0d() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var res : vec3 = atan2(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + atan2_a70d0d(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + atan2_a70d0d(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atan2_a70d0d(); +} diff --git a/test/tint/builtins/gen/var/atan2/ae713e.wgsl b/test/tint/builtins/gen/var/atan2/ae713e.wgsl new file mode 100644 index 0000000000..1045aea140 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/ae713e.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn atan2(vec<4, f32>, vec<4, f32>) -> vec<4, f32> +fn atan2_ae713e() { + var arg_0 = vec4(); + var arg_1 = vec4(); + var res: vec4 = atan2(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + atan2_ae713e(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + atan2_ae713e(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atan2_ae713e(); +} diff --git a/test/tint/builtins/gen/var/atan2/ae713e.wgsl.expected.glsl b/test/tint/builtins/gen/var/atan2/ae713e.wgsl.expected.glsl new file mode 100644 index 0000000000..54f87fdf18 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/ae713e.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void atan2_ae713e() { + vec4 arg_0 = vec4(0.0f); + vec4 arg_1 = vec4(0.0f); + vec4 res = atan(arg_0, arg_1); +} + +vec4 vertex_main() { + atan2_ae713e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void atan2_ae713e() { + vec4 arg_0 = vec4(0.0f); + vec4 arg_1 = vec4(0.0f); + vec4 res = atan(arg_0, arg_1); +} + +void fragment_main() { + atan2_ae713e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void atan2_ae713e() { + vec4 arg_0 = vec4(0.0f); + vec4 arg_1 = vec4(0.0f); + vec4 res = atan(arg_0, arg_1); +} + +void compute_main() { + atan2_ae713e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atan2/ae713e.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atan2/ae713e.wgsl.expected.hlsl new file mode 100644 index 0000000000..68a82e0006 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/ae713e.wgsl.expected.hlsl @@ -0,0 +1,32 @@ +void atan2_ae713e() { + float4 arg_0 = (0.0f).xxxx; + float4 arg_1 = (0.0f).xxxx; + float4 res = atan2(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan2_ae713e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan2_ae713e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan2_ae713e(); + return; +} diff --git a/test/tint/builtins/gen/var/atan2/ae713e.wgsl.expected.msl b/test/tint/builtins/gen/var/atan2/ae713e.wgsl.expected.msl new file mode 100644 index 0000000000..1fb8aa2331 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/ae713e.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void atan2_ae713e() { + float4 arg_0 = float4(0.0f); + float4 arg_1 = float4(0.0f); + float4 res = atan2(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atan2_ae713e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atan2_ae713e(); + return; +} + +kernel void compute_main() { + atan2_ae713e(); + return; +} + diff --git a/test/tint/builtins/gen/var/atan2/ae713e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atan2/ae713e.wgsl.expected.spvasm new file mode 100644 index 0000000000..7b4ac1877d --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/ae713e.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %atan2_ae713e "atan2_ae713e" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%atan2_ae713e = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %arg_1 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %5 + OpStore %arg_1 %5 + %18 = OpLoad %v4float %arg_0 + %19 = OpLoad %v4float %arg_1 + %16 = OpExtInst %v4float %17 Atan2 %18 %19 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %atan2_ae713e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %atan2_ae713e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %atan2_ae713e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atan2/ae713e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atan2/ae713e.wgsl.expected.wgsl new file mode 100644 index 0000000000..cfdb8ca660 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/ae713e.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn atan2_ae713e() { + var arg_0 = vec4(); + var arg_1 = vec4(); + var res : vec4 = atan2(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + atan2_ae713e(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + atan2_ae713e(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atan2_ae713e(); +} diff --git a/test/tint/builtins/gen/var/atomicAdd/794055.wgsl b/test/tint/builtins/gen/var/atomicAdd/794055.wgsl new file mode 100644 index 0000000000..7c911e2110 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAdd/794055.wgsl @@ -0,0 +1,36 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +var arg_0: atomic; + +// fn atomicAdd(ptr, read_write>, i32) -> i32 +fn atomicAdd_794055() { + var arg_1 = 1; + var res: i32 = atomicAdd(&arg_0, arg_1); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicAdd_794055(); +} diff --git a/test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.glsl new file mode 100644 index 0000000000..6e7ea7eca9 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.glsl @@ -0,0 +1,21 @@ +#version 310 es + +shared int arg_0; +void atomicAdd_794055() { + int arg_1 = 1; + int res = atomicAdd(arg_0, arg_1); +} + +void compute_main(uint local_invocation_index) { + { + atomicExchange(arg_0, 0); + } + barrier(); + atomicAdd_794055(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.hlsl new file mode 100644 index 0000000000..94edce7bd4 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.hlsl @@ -0,0 +1,27 @@ +groupshared int arg_0; + +void atomicAdd_794055() { + int arg_1 = 1; + int atomic_result = 0; + InterlockedAdd(arg_0, arg_1, atomic_result); + int res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicAdd_794055(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.msl new file mode 100644 index 0000000000..b84f508e6c --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +void atomicAdd_794055(threadgroup atomic_int* const tint_symbol) { + int arg_1 = 1; + int res = atomic_fetch_add_explicit(tint_symbol, arg_1, memory_order_relaxed); +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) { + { + atomic_store_explicit(tint_symbol_1, 0, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicAdd_794055(tint_symbol_1); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup atomic_int tint_symbol_2; + compute_main_inner(local_invocation_index, &(tint_symbol_2)); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.spvasm new file mode 100644 index 0000000000..9a311f18c4 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.spvasm @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicAdd_794055 "atomicAdd_794055" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %7 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %14 = OpConstantNull %int + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %21 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicAdd_794055 = OpFunction %void None %7 + %10 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %14 + %res = OpVariable %_ptr_Function_int Function %14 + OpStore %arg_1 %int_1 + %19 = OpLoad %int %arg_1 + %15 = OpAtomicIAdd %int %arg_0 %uint_2 %uint_0 %19 + OpStore %res %15 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %21 +%local_invocation_index = OpFunctionParameter %uint + %24 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %29 = OpFunctionCall %void %atomicAdd_794055 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %7 + %31 = OpLabel + %33 = OpLoad %uint %local_invocation_index_1 + %32 = OpFunctionCall %void %compute_main_inner %33 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.wgsl new file mode 100644 index 0000000000..113cf03b7d --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.wgsl @@ -0,0 +1,11 @@ +var arg_0 : atomic; + +fn atomicAdd_794055() { + var arg_1 = 1; + var res : i32 = atomicAdd(&(arg_0), arg_1); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicAdd_794055(); +} diff --git a/test/tint/builtins/gen/var/atomicAdd/8a199a.wgsl b/test/tint/builtins/gen/var/atomicAdd/8a199a.wgsl new file mode 100644 index 0000000000..d84abb25ef --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAdd/8a199a.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: atomic, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn atomicAdd(ptr, read_write>, u32) -> u32 +fn atomicAdd_8a199a() { + var arg_1 = 1u; + var res: u32 = atomicAdd(&sb_rw.arg_0, arg_1); +} + +@stage(fragment) +fn fragment_main() { + atomicAdd_8a199a(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicAdd_8a199a(); +} diff --git a/test/tint/builtins/gen/var/atomicAdd/8a199a.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicAdd/8a199a.wgsl.expected.glsl new file mode 100644 index 0000000000..b4e7e25b56 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAdd/8a199a.wgsl.expected.glsl @@ -0,0 +1,46 @@ +#version 310 es +precision mediump float; + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + uint arg_0; +} sb_rw; +void atomicAdd_8a199a() { + uint arg_1 = 1u; + uint res = atomicAdd(sb_rw.arg_0, arg_1); +} + +void fragment_main() { + atomicAdd_8a199a(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + uint arg_0; +} sb_rw; +void atomicAdd_8a199a() { + uint arg_1 = 1u; + uint res = atomicAdd(sb_rw.arg_0, arg_1); +} + +void compute_main() { + atomicAdd_8a199a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicAdd/8a199a.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicAdd/8a199a.wgsl.expected.hlsl new file mode 100644 index 0000000000..1bf7c3ef82 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAdd/8a199a.wgsl.expected.hlsl @@ -0,0 +1,24 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicAdd(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedAdd(offset, value, original_value); + return original_value; +} + + +void atomicAdd_8a199a() { + uint arg_1 = 1u; + uint res = tint_atomicAdd(sb_rw, 0u, arg_1); +} + +void fragment_main() { + atomicAdd_8a199a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicAdd_8a199a(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicAdd/8a199a.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicAdd/8a199a.wgsl.expected.msl new file mode 100644 index 0000000000..e1e7c61b97 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAdd/8a199a.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +struct SB_RW { + /* 0x0000 */ atomic_uint arg_0; +}; + +void atomicAdd_8a199a(device SB_RW* const tint_symbol) { + uint arg_1 = 1u; + uint res = atomic_fetch_add_explicit(&((*(tint_symbol)).arg_0), arg_1, memory_order_relaxed); +} + +fragment void fragment_main(device SB_RW* tint_symbol_1 [[buffer(0)]]) { + atomicAdd_8a199a(tint_symbol_1); + return; +} + +kernel void compute_main(device SB_RW* tint_symbol_2 [[buffer(0)]]) { + atomicAdd_8a199a(tint_symbol_2); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicAdd/8a199a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicAdd/8a199a.wgsl.expected.spvasm new file mode 100644 index 0000000000..98d9690d34 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAdd/8a199a.wgsl.expected.spvasm @@ -0,0 +1,55 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicAdd_8a199a "atomicAdd_8a199a" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %uint = OpTypeInt 32 0 + %SB_RW = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %12 = OpConstantNull %uint + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%atomicAdd_8a199a = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %12 + %res = OpVariable %_ptr_Function_uint Function %12 + OpStore %arg_1 %uint_1 + %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %18 = OpLoad %uint %arg_1 + %13 = OpAtomicIAdd %uint %17 %uint_1 %uint_0 %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %21 = OpLabel + %22 = OpFunctionCall %void %atomicAdd_8a199a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %24 = OpLabel + %25 = OpFunctionCall %void %atomicAdd_8a199a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicAdd/8a199a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicAdd/8a199a.wgsl.expected.wgsl new file mode 100644 index 0000000000..63cef4f72a --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAdd/8a199a.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +struct SB_RW { + arg_0 : atomic, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn atomicAdd_8a199a() { + var arg_1 = 1u; + var res : u32 = atomicAdd(&(sb_rw.arg_0), arg_1); +} + +@stage(fragment) +fn fragment_main() { + atomicAdd_8a199a(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicAdd_8a199a(); +} diff --git a/test/tint/builtins/gen/var/atomicAdd/d32fe4.wgsl b/test/tint/builtins/gen/var/atomicAdd/d32fe4.wgsl new file mode 100644 index 0000000000..38cca7f58a --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAdd/d32fe4.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: atomic, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn atomicAdd(ptr, read_write>, i32) -> i32 +fn atomicAdd_d32fe4() { + var arg_1 = 1; + var res: i32 = atomicAdd(&sb_rw.arg_0, arg_1); +} + +@stage(fragment) +fn fragment_main() { + atomicAdd_d32fe4(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicAdd_d32fe4(); +} diff --git a/test/tint/builtins/gen/var/atomicAdd/d32fe4.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicAdd/d32fe4.wgsl.expected.glsl new file mode 100644 index 0000000000..c589612d2b --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAdd/d32fe4.wgsl.expected.glsl @@ -0,0 +1,46 @@ +#version 310 es +precision mediump float; + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + int arg_0; +} sb_rw; +void atomicAdd_d32fe4() { + int arg_1 = 1; + int res = atomicAdd(sb_rw.arg_0, arg_1); +} + +void fragment_main() { + atomicAdd_d32fe4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + int arg_0; +} sb_rw; +void atomicAdd_d32fe4() { + int arg_1 = 1; + int res = atomicAdd(sb_rw.arg_0, arg_1); +} + +void compute_main() { + atomicAdd_d32fe4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicAdd/d32fe4.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicAdd/d32fe4.wgsl.expected.hlsl new file mode 100644 index 0000000000..213221ba82 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAdd/d32fe4.wgsl.expected.hlsl @@ -0,0 +1,24 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicAdd(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedAdd(offset, value, original_value); + return original_value; +} + + +void atomicAdd_d32fe4() { + int arg_1 = 1; + int res = tint_atomicAdd(sb_rw, 0u, arg_1); +} + +void fragment_main() { + atomicAdd_d32fe4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicAdd_d32fe4(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicAdd/d32fe4.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicAdd/d32fe4.wgsl.expected.msl new file mode 100644 index 0000000000..2ef2df3e6e --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAdd/d32fe4.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +struct SB_RW { + /* 0x0000 */ atomic_int arg_0; +}; + +void atomicAdd_d32fe4(device SB_RW* const tint_symbol) { + int arg_1 = 1; + int res = atomic_fetch_add_explicit(&((*(tint_symbol)).arg_0), arg_1, memory_order_relaxed); +} + +fragment void fragment_main(device SB_RW* tint_symbol_1 [[buffer(0)]]) { + atomicAdd_d32fe4(tint_symbol_1); + return; +} + +kernel void compute_main(device SB_RW* tint_symbol_2 [[buffer(0)]]) { + atomicAdd_d32fe4(tint_symbol_2); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicAdd/d32fe4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicAdd/d32fe4.wgsl.expected.spvasm new file mode 100644 index 0000000000..2fd0e19721 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAdd/d32fe4.wgsl.expected.spvasm @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 28 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicAdd_d32fe4 "atomicAdd_d32fe4" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %int = OpTypeInt 32 1 + %SB_RW = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %12 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int +%atomicAdd_d32fe4 = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %12 + %res = OpVariable %_ptr_Function_int Function %12 + OpStore %arg_1 %int_1 + %19 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %20 = OpLoad %int %arg_1 + %13 = OpAtomicIAdd %int %19 %uint_1 %uint_0 %20 + OpStore %res %13 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %23 = OpLabel + %24 = OpFunctionCall %void %atomicAdd_d32fe4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %26 = OpLabel + %27 = OpFunctionCall %void %atomicAdd_d32fe4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicAdd/d32fe4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicAdd/d32fe4.wgsl.expected.wgsl new file mode 100644 index 0000000000..bc1c383829 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAdd/d32fe4.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +struct SB_RW { + arg_0 : atomic, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn atomicAdd_d32fe4() { + var arg_1 = 1; + var res : i32 = atomicAdd(&(sb_rw.arg_0), arg_1); +} + +@stage(fragment) +fn fragment_main() { + atomicAdd_d32fe4(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicAdd_d32fe4(); +} diff --git a/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl b/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl new file mode 100644 index 0000000000..528d4aa051 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl @@ -0,0 +1,36 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +var arg_0: atomic; + +// fn atomicAdd(ptr, read_write>, u32) -> u32 +fn atomicAdd_d5db1d() { + var arg_1 = 1u; + var res: u32 = atomicAdd(&arg_0, arg_1); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicAdd_d5db1d(); +} diff --git a/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.glsl new file mode 100644 index 0000000000..4d92172b69 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.glsl @@ -0,0 +1,21 @@ +#version 310 es + +shared uint arg_0; +void atomicAdd_d5db1d() { + uint arg_1 = 1u; + uint res = atomicAdd(arg_0, arg_1); +} + +void compute_main(uint local_invocation_index) { + { + atomicExchange(arg_0, 0u); + } + barrier(); + atomicAdd_d5db1d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.hlsl new file mode 100644 index 0000000000..c74e7bdbe4 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.hlsl @@ -0,0 +1,27 @@ +groupshared uint arg_0; + +void atomicAdd_d5db1d() { + uint arg_1 = 1u; + uint atomic_result = 0u; + InterlockedAdd(arg_0, arg_1, atomic_result); + uint res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicAdd_d5db1d(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.msl new file mode 100644 index 0000000000..c05a45c9e0 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +void atomicAdd_d5db1d(threadgroup atomic_uint* const tint_symbol) { + uint arg_1 = 1u; + uint res = atomic_fetch_add_explicit(tint_symbol, arg_1, memory_order_relaxed); +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) { + { + atomic_store_explicit(tint_symbol_1, 0u, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicAdd_d5db1d(tint_symbol_1); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup atomic_uint tint_symbol_2; + compute_main_inner(local_invocation_index, &(tint_symbol_2)); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.spvasm new file mode 100644 index 0000000000..7ab1e8d2e3 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.spvasm @@ -0,0 +1,56 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicAdd_d5db1d "atomicAdd_d5db1d" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %6 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %13 = OpConstantNull %uint + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %20 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicAdd_d5db1d = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %13 + %res = OpVariable %_ptr_Function_uint Function %13 + OpStore %arg_1 %uint_1 + %18 = OpLoad %uint %arg_1 + %14 = OpAtomicIAdd %uint %arg_0 %uint_2 %uint_0 %18 + OpStore %res %14 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %20 +%local_invocation_index = OpFunctionParameter %uint + %23 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %13 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %28 = OpFunctionCall %void %atomicAdd_d5db1d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %6 + %30 = OpLabel + %32 = OpLoad %uint %local_invocation_index_1 + %31 = OpFunctionCall %void %compute_main_inner %32 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.wgsl new file mode 100644 index 0000000000..eaafde0741 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.wgsl @@ -0,0 +1,11 @@ +var arg_0 : atomic; + +fn atomicAdd_d5db1d() { + var arg_1 = 1u; + var res : u32 = atomicAdd(&(arg_0), arg_1); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicAdd_d5db1d(); +} diff --git a/test/tint/builtins/gen/var/atomicAnd/152966.wgsl b/test/tint/builtins/gen/var/atomicAnd/152966.wgsl new file mode 100644 index 0000000000..62d12c1ab3 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAnd/152966.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: atomic, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn atomicAnd(ptr, read_write>, i32) -> i32 +fn atomicAnd_152966() { + var arg_1 = 1; + var res: i32 = atomicAnd(&sb_rw.arg_0, arg_1); +} + +@stage(fragment) +fn fragment_main() { + atomicAnd_152966(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicAnd_152966(); +} diff --git a/test/tint/builtins/gen/var/atomicAnd/152966.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicAnd/152966.wgsl.expected.glsl new file mode 100644 index 0000000000..3e8c40f3ce --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAnd/152966.wgsl.expected.glsl @@ -0,0 +1,46 @@ +#version 310 es +precision mediump float; + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + int arg_0; +} sb_rw; +void atomicAnd_152966() { + int arg_1 = 1; + int res = atomicAnd(sb_rw.arg_0, arg_1); +} + +void fragment_main() { + atomicAnd_152966(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + int arg_0; +} sb_rw; +void atomicAnd_152966() { + int arg_1 = 1; + int res = atomicAnd(sb_rw.arg_0, arg_1); +} + +void compute_main() { + atomicAnd_152966(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicAnd/152966.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicAnd/152966.wgsl.expected.hlsl new file mode 100644 index 0000000000..4562edbdc2 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAnd/152966.wgsl.expected.hlsl @@ -0,0 +1,24 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicAnd(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedAnd(offset, value, original_value); + return original_value; +} + + +void atomicAnd_152966() { + int arg_1 = 1; + int res = tint_atomicAnd(sb_rw, 0u, arg_1); +} + +void fragment_main() { + atomicAnd_152966(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicAnd_152966(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicAnd/152966.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicAnd/152966.wgsl.expected.msl new file mode 100644 index 0000000000..c7bf4a8624 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAnd/152966.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +struct SB_RW { + /* 0x0000 */ atomic_int arg_0; +}; + +void atomicAnd_152966(device SB_RW* const tint_symbol) { + int arg_1 = 1; + int res = atomic_fetch_and_explicit(&((*(tint_symbol)).arg_0), arg_1, memory_order_relaxed); +} + +fragment void fragment_main(device SB_RW* tint_symbol_1 [[buffer(0)]]) { + atomicAnd_152966(tint_symbol_1); + return; +} + +kernel void compute_main(device SB_RW* tint_symbol_2 [[buffer(0)]]) { + atomicAnd_152966(tint_symbol_2); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicAnd/152966.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicAnd/152966.wgsl.expected.spvasm new file mode 100644 index 0000000000..18408ba002 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAnd/152966.wgsl.expected.spvasm @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 28 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicAnd_152966 "atomicAnd_152966" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %int = OpTypeInt 32 1 + %SB_RW = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %12 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int +%atomicAnd_152966 = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %12 + %res = OpVariable %_ptr_Function_int Function %12 + OpStore %arg_1 %int_1 + %19 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %20 = OpLoad %int %arg_1 + %13 = OpAtomicAnd %int %19 %uint_1 %uint_0 %20 + OpStore %res %13 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %23 = OpLabel + %24 = OpFunctionCall %void %atomicAnd_152966 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %26 = OpLabel + %27 = OpFunctionCall %void %atomicAnd_152966 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicAnd/152966.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicAnd/152966.wgsl.expected.wgsl new file mode 100644 index 0000000000..52984c728b --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAnd/152966.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +struct SB_RW { + arg_0 : atomic, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn atomicAnd_152966() { + var arg_1 = 1; + var res : i32 = atomicAnd(&(sb_rw.arg_0), arg_1); +} + +@stage(fragment) +fn fragment_main() { + atomicAnd_152966(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicAnd_152966(); +} diff --git a/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl b/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl new file mode 100644 index 0000000000..ffb20d8e8a --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl @@ -0,0 +1,36 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +var arg_0: atomic; + +// fn atomicAnd(ptr, read_write>, u32) -> u32 +fn atomicAnd_34edd3() { + var arg_1 = 1u; + var res: u32 = atomicAnd(&arg_0, arg_1); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicAnd_34edd3(); +} diff --git a/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.glsl new file mode 100644 index 0000000000..1233dc8dde --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.glsl @@ -0,0 +1,21 @@ +#version 310 es + +shared uint arg_0; +void atomicAnd_34edd3() { + uint arg_1 = 1u; + uint res = atomicAnd(arg_0, arg_1); +} + +void compute_main(uint local_invocation_index) { + { + atomicExchange(arg_0, 0u); + } + barrier(); + atomicAnd_34edd3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.hlsl new file mode 100644 index 0000000000..9aca847882 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.hlsl @@ -0,0 +1,27 @@ +groupshared uint arg_0; + +void atomicAnd_34edd3() { + uint arg_1 = 1u; + uint atomic_result = 0u; + InterlockedAnd(arg_0, arg_1, atomic_result); + uint res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicAnd_34edd3(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.msl new file mode 100644 index 0000000000..ea6ba7ebd7 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +void atomicAnd_34edd3(threadgroup atomic_uint* const tint_symbol) { + uint arg_1 = 1u; + uint res = atomic_fetch_and_explicit(tint_symbol, arg_1, memory_order_relaxed); +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) { + { + atomic_store_explicit(tint_symbol_1, 0u, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicAnd_34edd3(tint_symbol_1); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup atomic_uint tint_symbol_2; + compute_main_inner(local_invocation_index, &(tint_symbol_2)); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.spvasm new file mode 100644 index 0000000000..e6e94c1a3a --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.spvasm @@ -0,0 +1,56 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicAnd_34edd3 "atomicAnd_34edd3" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %6 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %13 = OpConstantNull %uint + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %20 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicAnd_34edd3 = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %13 + %res = OpVariable %_ptr_Function_uint Function %13 + OpStore %arg_1 %uint_1 + %18 = OpLoad %uint %arg_1 + %14 = OpAtomicAnd %uint %arg_0 %uint_2 %uint_0 %18 + OpStore %res %14 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %20 +%local_invocation_index = OpFunctionParameter %uint + %23 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %13 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %28 = OpFunctionCall %void %atomicAnd_34edd3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %6 + %30 = OpLabel + %32 = OpLoad %uint %local_invocation_index_1 + %31 = OpFunctionCall %void %compute_main_inner %32 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.wgsl new file mode 100644 index 0000000000..a7070c304c --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.wgsl @@ -0,0 +1,11 @@ +var arg_0 : atomic; + +fn atomicAnd_34edd3() { + var arg_1 = 1u; + var res : u32 = atomicAnd(&(arg_0), arg_1); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicAnd_34edd3(); +} diff --git a/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl b/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl new file mode 100644 index 0000000000..dfd0ca134a --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl @@ -0,0 +1,36 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +var arg_0: atomic; + +// fn atomicAnd(ptr, read_write>, i32) -> i32 +fn atomicAnd_45a819() { + var arg_1 = 1; + var res: i32 = atomicAnd(&arg_0, arg_1); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicAnd_45a819(); +} diff --git a/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.glsl new file mode 100644 index 0000000000..5f90d4a6b4 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.glsl @@ -0,0 +1,21 @@ +#version 310 es + +shared int arg_0; +void atomicAnd_45a819() { + int arg_1 = 1; + int res = atomicAnd(arg_0, arg_1); +} + +void compute_main(uint local_invocation_index) { + { + atomicExchange(arg_0, 0); + } + barrier(); + atomicAnd_45a819(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.hlsl new file mode 100644 index 0000000000..7bf2f53a90 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.hlsl @@ -0,0 +1,27 @@ +groupshared int arg_0; + +void atomicAnd_45a819() { + int arg_1 = 1; + int atomic_result = 0; + InterlockedAnd(arg_0, arg_1, atomic_result); + int res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicAnd_45a819(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.msl new file mode 100644 index 0000000000..ece0c9f64b --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +void atomicAnd_45a819(threadgroup atomic_int* const tint_symbol) { + int arg_1 = 1; + int res = atomic_fetch_and_explicit(tint_symbol, arg_1, memory_order_relaxed); +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) { + { + atomic_store_explicit(tint_symbol_1, 0, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicAnd_45a819(tint_symbol_1); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup atomic_int tint_symbol_2; + compute_main_inner(local_invocation_index, &(tint_symbol_2)); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.spvasm new file mode 100644 index 0000000000..e0c9a7e2f3 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.spvasm @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicAnd_45a819 "atomicAnd_45a819" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %7 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %14 = OpConstantNull %int + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %21 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicAnd_45a819 = OpFunction %void None %7 + %10 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %14 + %res = OpVariable %_ptr_Function_int Function %14 + OpStore %arg_1 %int_1 + %19 = OpLoad %int %arg_1 + %15 = OpAtomicAnd %int %arg_0 %uint_2 %uint_0 %19 + OpStore %res %15 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %21 +%local_invocation_index = OpFunctionParameter %uint + %24 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %29 = OpFunctionCall %void %atomicAnd_45a819 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %7 + %31 = OpLabel + %33 = OpLoad %uint %local_invocation_index_1 + %32 = OpFunctionCall %void %compute_main_inner %33 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.wgsl new file mode 100644 index 0000000000..1d8af20275 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.wgsl @@ -0,0 +1,11 @@ +var arg_0 : atomic; + +fn atomicAnd_45a819() { + var arg_1 = 1; + var res : i32 = atomicAnd(&(arg_0), arg_1); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicAnd_45a819(); +} diff --git a/test/tint/builtins/gen/var/atomicAnd/85a8d9.wgsl b/test/tint/builtins/gen/var/atomicAnd/85a8d9.wgsl new file mode 100644 index 0000000000..726d4ad911 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAnd/85a8d9.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: atomic, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn atomicAnd(ptr, read_write>, u32) -> u32 +fn atomicAnd_85a8d9() { + var arg_1 = 1u; + var res: u32 = atomicAnd(&sb_rw.arg_0, arg_1); +} + +@stage(fragment) +fn fragment_main() { + atomicAnd_85a8d9(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicAnd_85a8d9(); +} diff --git a/test/tint/builtins/gen/var/atomicAnd/85a8d9.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicAnd/85a8d9.wgsl.expected.glsl new file mode 100644 index 0000000000..6d6dd70164 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAnd/85a8d9.wgsl.expected.glsl @@ -0,0 +1,46 @@ +#version 310 es +precision mediump float; + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + uint arg_0; +} sb_rw; +void atomicAnd_85a8d9() { + uint arg_1 = 1u; + uint res = atomicAnd(sb_rw.arg_0, arg_1); +} + +void fragment_main() { + atomicAnd_85a8d9(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + uint arg_0; +} sb_rw; +void atomicAnd_85a8d9() { + uint arg_1 = 1u; + uint res = atomicAnd(sb_rw.arg_0, arg_1); +} + +void compute_main() { + atomicAnd_85a8d9(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicAnd/85a8d9.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicAnd/85a8d9.wgsl.expected.hlsl new file mode 100644 index 0000000000..f2099cfe1a --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAnd/85a8d9.wgsl.expected.hlsl @@ -0,0 +1,24 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicAnd(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedAnd(offset, value, original_value); + return original_value; +} + + +void atomicAnd_85a8d9() { + uint arg_1 = 1u; + uint res = tint_atomicAnd(sb_rw, 0u, arg_1); +} + +void fragment_main() { + atomicAnd_85a8d9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicAnd_85a8d9(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicAnd/85a8d9.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicAnd/85a8d9.wgsl.expected.msl new file mode 100644 index 0000000000..f38ff4345e --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAnd/85a8d9.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +struct SB_RW { + /* 0x0000 */ atomic_uint arg_0; +}; + +void atomicAnd_85a8d9(device SB_RW* const tint_symbol) { + uint arg_1 = 1u; + uint res = atomic_fetch_and_explicit(&((*(tint_symbol)).arg_0), arg_1, memory_order_relaxed); +} + +fragment void fragment_main(device SB_RW* tint_symbol_1 [[buffer(0)]]) { + atomicAnd_85a8d9(tint_symbol_1); + return; +} + +kernel void compute_main(device SB_RW* tint_symbol_2 [[buffer(0)]]) { + atomicAnd_85a8d9(tint_symbol_2); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicAnd/85a8d9.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicAnd/85a8d9.wgsl.expected.spvasm new file mode 100644 index 0000000000..d8c4b78793 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAnd/85a8d9.wgsl.expected.spvasm @@ -0,0 +1,55 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicAnd_85a8d9 "atomicAnd_85a8d9" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %uint = OpTypeInt 32 0 + %SB_RW = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %12 = OpConstantNull %uint + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%atomicAnd_85a8d9 = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %12 + %res = OpVariable %_ptr_Function_uint Function %12 + OpStore %arg_1 %uint_1 + %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %18 = OpLoad %uint %arg_1 + %13 = OpAtomicAnd %uint %17 %uint_1 %uint_0 %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %21 = OpLabel + %22 = OpFunctionCall %void %atomicAnd_85a8d9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %24 = OpLabel + %25 = OpFunctionCall %void %atomicAnd_85a8d9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicAnd/85a8d9.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicAnd/85a8d9.wgsl.expected.wgsl new file mode 100644 index 0000000000..f93a934d9e --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAnd/85a8d9.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +struct SB_RW { + arg_0 : atomic, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn atomicAnd_85a8d9() { + var arg_1 = 1u; + var res : u32 = atomicAnd(&(sb_rw.arg_0), arg_1); +} + +@stage(fragment) +fn fragment_main() { + atomicAnd_85a8d9(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicAnd_85a8d9(); +} diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/1bd40a.wgsl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/1bd40a.wgsl new file mode 100644 index 0000000000..10dfb91af5 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/1bd40a.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: atomic, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn atomicCompareExchangeWeak(ptr, read_write>, i32, i32) -> __atomic_compare_exchange_result +fn atomicCompareExchangeWeak_1bd40a() { + var arg_1 = 1; + var arg_2 = 1; + var res = atomicCompareExchangeWeak(&sb_rw.arg_0, arg_1, arg_2); +} + +@stage(fragment) +fn fragment_main() { + atomicCompareExchangeWeak_1bd40a(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicCompareExchangeWeak_1bd40a(); +} diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/1bd40a.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/1bd40a.wgsl.expected.glsl new file mode 100644 index 0000000000..cae561bc0a --- /dev/null +++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/1bd40a.wgsl.expected.glsl @@ -0,0 +1,66 @@ +#version 310 es +precision mediump float; + +struct atomic_compare_exchange_resulti32 { + int old_value; + bool exchanged; +}; + + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + int arg_0; +} sb_rw; +void atomicCompareExchangeWeak_1bd40a() { + int arg_1 = 1; + int arg_2 = 1; + atomic_compare_exchange_resulti32 atomic_compare_result; + atomic_compare_result.old_value = atomicCompSwap(sb_rw.arg_0, arg_1, arg_2); + atomic_compare_result.exchanged = atomic_compare_result.old_value == arg_1; + atomic_compare_exchange_resulti32 res = atomic_compare_result; +} + +void fragment_main() { + atomicCompareExchangeWeak_1bd40a(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct atomic_compare_exchange_resulti32 { + int old_value; + bool exchanged; +}; + + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + int arg_0; +} sb_rw; +void atomicCompareExchangeWeak_1bd40a() { + int arg_1 = 1; + int arg_2 = 1; + atomic_compare_exchange_resulti32 atomic_compare_result; + atomic_compare_result.old_value = atomicCompSwap(sb_rw.arg_0, arg_1, arg_2); + atomic_compare_result.exchanged = atomic_compare_result.old_value == arg_1; + atomic_compare_exchange_resulti32 res = atomic_compare_result; +} + +void compute_main() { + atomicCompareExchangeWeak_1bd40a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/1bd40a.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/1bd40a.wgsl.expected.hlsl new file mode 100644 index 0000000000..53a01c6f54 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/1bd40a.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +struct atomic_compare_exchange_weak_ret_type { + int old_value; + bool exchanged; +}; + +atomic_compare_exchange_weak_ret_type tint_atomicCompareExchangeWeak(RWByteAddressBuffer buffer, uint offset, int compare, int value) { + atomic_compare_exchange_weak_ret_type result=(atomic_compare_exchange_weak_ret_type)0; + buffer.InterlockedCompareExchange(offset, compare, value, result.old_value); + result.exchanged = result.old_value == compare; + return result; +} + + +void atomicCompareExchangeWeak_1bd40a() { + int arg_1 = 1; + int arg_2 = 1; + atomic_compare_exchange_weak_ret_type res = tint_atomicCompareExchangeWeak(sb_rw, 0u, arg_1, arg_2); +} + +void fragment_main() { + atomicCompareExchangeWeak_1bd40a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicCompareExchangeWeak_1bd40a(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/1bd40a.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/1bd40a.wgsl.expected.msl new file mode 100644 index 0000000000..11d8177555 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/1bd40a.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; + +struct atomic_compare_exchange_resulti32 { + int old_value; + bool exchanged; +}; +template +atomic_compare_exchange_resulti32 atomicCompareExchangeWeak_1(device A* atomic, T compare, T value) { + T old_value = compare; + bool exchanged = atomic_compare_exchange_weak_explicit(atomic, &old_value, value, memory_order_relaxed, memory_order_relaxed); + return {old_value, exchanged}; +} + +struct SB_RW { + /* 0x0000 */ atomic_int arg_0; +}; + +void atomicCompareExchangeWeak_1bd40a(device SB_RW* const tint_symbol) { + int arg_1 = 1; + int arg_2 = 1; + atomic_compare_exchange_resulti32 res = atomicCompareExchangeWeak_1(&((*(tint_symbol)).arg_0), arg_1, arg_2); +} + +fragment void fragment_main(device SB_RW* tint_symbol_1 [[buffer(0)]]) { + atomicCompareExchangeWeak_1bd40a(tint_symbol_1); + return; +} + +kernel void compute_main(device SB_RW* tint_symbol_2 [[buffer(0)]]) { + atomicCompareExchangeWeak_1bd40a(tint_symbol_2); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/1bd40a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/1bd40a.wgsl.expected.spvasm new file mode 100644 index 0000000000..0c9313476f --- /dev/null +++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/1bd40a.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicCompareExchangeWeak_1bd40a "atomicCompareExchangeWeak_1bd40a" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %__atomic_compare_exchange_resulti32 "__atomic_compare_exchange_resulti32" + OpMemberName %__atomic_compare_exchange_resulti32 0 "old_value" + OpMemberName %__atomic_compare_exchange_resulti32 1 "exchanged" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + OpMemberDecorate %__atomic_compare_exchange_resulti32 0 Offset 0 + OpMemberDecorate %__atomic_compare_exchange_resulti32 1 Offset 4 + %int = OpTypeInt 32 1 + %SB_RW = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %12 = OpConstantNull %int + %bool = OpTypeBool +%__atomic_compare_exchange_resulti32 = OpTypeStruct %int %bool + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int +%_ptr_Function___atomic_compare_exchange_resulti32 = OpTypePointer Function %__atomic_compare_exchange_resulti32 + %28 = OpConstantNull %__atomic_compare_exchange_resulti32 +%atomicCompareExchangeWeak_1bd40a = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %12 + %arg_2 = OpVariable %_ptr_Function_int Function %12 + %res = OpVariable %_ptr_Function___atomic_compare_exchange_resulti32 Function %28 + OpStore %arg_1 %int_1 + OpStore %arg_2 %int_1 + %22 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %23 = OpLoad %int %arg_2 + %24 = OpAtomicCompareExchange %int %22 %uint_1 %uint_0 %uint_0 %23 %arg_1 + %25 = OpIEqual %bool %24 %23 + %14 = OpCompositeConstruct %__atomic_compare_exchange_resulti32 %24 %25 + OpStore %res %14 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %30 = OpLabel + %31 = OpFunctionCall %void %atomicCompareExchangeWeak_1bd40a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %33 = OpLabel + %34 = OpFunctionCall %void %atomicCompareExchangeWeak_1bd40a + OpReturn + OpFunctionEnd +1:1: AtomicCompareExchange: expected Comparator to be of type Result Type + %24 = OpAtomicCompareExchange %int %22 %uint_1 %uint_0 %uint_0 %23 %arg_1 + diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/1bd40a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/1bd40a.wgsl.expected.wgsl new file mode 100644 index 0000000000..5db36c6bac --- /dev/null +++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/1bd40a.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +struct SB_RW { + arg_0 : atomic, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn atomicCompareExchangeWeak_1bd40a() { + var arg_1 = 1; + var arg_2 = 1; + var res = atomicCompareExchangeWeak(&(sb_rw.arg_0), arg_1, arg_2); +} + +@stage(fragment) +fn fragment_main() { + atomicCompareExchangeWeak_1bd40a(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicCompareExchangeWeak_1bd40a(); +} diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/63d8e6.wgsl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/63d8e6.wgsl new file mode 100644 index 0000000000..591914b033 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/63d8e6.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: atomic, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn atomicCompareExchangeWeak(ptr, read_write>, u32, u32) -> __atomic_compare_exchange_result +fn atomicCompareExchangeWeak_63d8e6() { + var arg_1 = 1u; + var arg_2 = 1u; + var res = atomicCompareExchangeWeak(&sb_rw.arg_0, arg_1, arg_2); +} + +@stage(fragment) +fn fragment_main() { + atomicCompareExchangeWeak_63d8e6(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicCompareExchangeWeak_63d8e6(); +} diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/63d8e6.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/63d8e6.wgsl.expected.glsl new file mode 100644 index 0000000000..a30b533d18 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/63d8e6.wgsl.expected.glsl @@ -0,0 +1,66 @@ +#version 310 es +precision mediump float; + +struct atomic_compare_exchange_resultu32 { + uint old_value; + bool exchanged; +}; + + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + uint arg_0; +} sb_rw; +void atomicCompareExchangeWeak_63d8e6() { + uint arg_1 = 1u; + uint arg_2 = 1u; + atomic_compare_exchange_resultu32 atomic_compare_result; + atomic_compare_result.old_value = atomicCompSwap(sb_rw.arg_0, arg_1, arg_2); + atomic_compare_result.exchanged = atomic_compare_result.old_value == arg_1; + atomic_compare_exchange_resultu32 res = atomic_compare_result; +} + +void fragment_main() { + atomicCompareExchangeWeak_63d8e6(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct atomic_compare_exchange_resultu32 { + uint old_value; + bool exchanged; +}; + + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + uint arg_0; +} sb_rw; +void atomicCompareExchangeWeak_63d8e6() { + uint arg_1 = 1u; + uint arg_2 = 1u; + atomic_compare_exchange_resultu32 atomic_compare_result; + atomic_compare_result.old_value = atomicCompSwap(sb_rw.arg_0, arg_1, arg_2); + atomic_compare_result.exchanged = atomic_compare_result.old_value == arg_1; + atomic_compare_exchange_resultu32 res = atomic_compare_result; +} + +void compute_main() { + atomicCompareExchangeWeak_63d8e6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/63d8e6.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/63d8e6.wgsl.expected.hlsl new file mode 100644 index 0000000000..3c22dc7ece --- /dev/null +++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/63d8e6.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +struct atomic_compare_exchange_weak_ret_type { + uint old_value; + bool exchanged; +}; + +atomic_compare_exchange_weak_ret_type tint_atomicCompareExchangeWeak(RWByteAddressBuffer buffer, uint offset, uint compare, uint value) { + atomic_compare_exchange_weak_ret_type result=(atomic_compare_exchange_weak_ret_type)0; + buffer.InterlockedCompareExchange(offset, compare, value, result.old_value); + result.exchanged = result.old_value == compare; + return result; +} + + +void atomicCompareExchangeWeak_63d8e6() { + uint arg_1 = 1u; + uint arg_2 = 1u; + atomic_compare_exchange_weak_ret_type res = tint_atomicCompareExchangeWeak(sb_rw, 0u, arg_1, arg_2); +} + +void fragment_main() { + atomicCompareExchangeWeak_63d8e6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicCompareExchangeWeak_63d8e6(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/63d8e6.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/63d8e6.wgsl.expected.msl new file mode 100644 index 0000000000..545803b2ee --- /dev/null +++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/63d8e6.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; + +struct atomic_compare_exchange_resultu32 { + uint old_value; + bool exchanged; +}; +template +atomic_compare_exchange_resultu32 atomicCompareExchangeWeak_1(device A* atomic, T compare, T value) { + T old_value = compare; + bool exchanged = atomic_compare_exchange_weak_explicit(atomic, &old_value, value, memory_order_relaxed, memory_order_relaxed); + return {old_value, exchanged}; +} + +struct SB_RW { + /* 0x0000 */ atomic_uint arg_0; +}; + +void atomicCompareExchangeWeak_63d8e6(device SB_RW* const tint_symbol) { + uint arg_1 = 1u; + uint arg_2 = 1u; + atomic_compare_exchange_resultu32 res = atomicCompareExchangeWeak_1(&((*(tint_symbol)).arg_0), arg_1, arg_2); +} + +fragment void fragment_main(device SB_RW* tint_symbol_1 [[buffer(0)]]) { + atomicCompareExchangeWeak_63d8e6(tint_symbol_1); + return; +} + +kernel void compute_main(device SB_RW* tint_symbol_2 [[buffer(0)]]) { + atomicCompareExchangeWeak_63d8e6(tint_symbol_2); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/63d8e6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/63d8e6.wgsl.expected.spvasm new file mode 100644 index 0000000000..62eac6119e --- /dev/null +++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/63d8e6.wgsl.expected.spvasm @@ -0,0 +1,74 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicCompareExchangeWeak_63d8e6 "atomicCompareExchangeWeak_63d8e6" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %__atomic_compare_exchange_resultu32 "__atomic_compare_exchange_resultu32" + OpMemberName %__atomic_compare_exchange_resultu32 0 "old_value" + OpMemberName %__atomic_compare_exchange_resultu32 1 "exchanged" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + OpMemberDecorate %__atomic_compare_exchange_resultu32 0 Offset 0 + OpMemberDecorate %__atomic_compare_exchange_resultu32 1 Offset 4 + %uint = OpTypeInt 32 0 + %SB_RW = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %12 = OpConstantNull %uint + %bool = OpTypeBool +%__atomic_compare_exchange_resultu32 = OpTypeStruct %uint %bool + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%_ptr_Function___atomic_compare_exchange_resultu32 = OpTypePointer Function %__atomic_compare_exchange_resultu32 + %26 = OpConstantNull %__atomic_compare_exchange_resultu32 +%atomicCompareExchangeWeak_63d8e6 = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %12 + %arg_2 = OpVariable %_ptr_Function_uint Function %12 + %res = OpVariable %_ptr_Function___atomic_compare_exchange_resultu32 Function %26 + OpStore %arg_1 %uint_1 + OpStore %arg_2 %uint_1 + %20 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %21 = OpLoad %uint %arg_2 + %22 = OpAtomicCompareExchange %uint %20 %uint_1 %uint_0 %uint_0 %21 %arg_1 + %23 = OpIEqual %bool %22 %21 + %14 = OpCompositeConstruct %__atomic_compare_exchange_resultu32 %22 %23 + OpStore %res %14 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %28 = OpLabel + %29 = OpFunctionCall %void %atomicCompareExchangeWeak_63d8e6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %31 = OpLabel + %32 = OpFunctionCall %void %atomicCompareExchangeWeak_63d8e6 + OpReturn + OpFunctionEnd +1:1: AtomicCompareExchange: expected Comparator to be of type Result Type + %22 = OpAtomicCompareExchange %uint %20 %uint_1 %uint_0 %uint_0 %21 %arg_1 + diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/63d8e6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/63d8e6.wgsl.expected.wgsl new file mode 100644 index 0000000000..6be230ee71 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/63d8e6.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +struct SB_RW { + arg_0 : atomic, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn atomicCompareExchangeWeak_63d8e6() { + var arg_1 = 1u; + var arg_2 = 1u; + var res = atomicCompareExchangeWeak(&(sb_rw.arg_0), arg_1, arg_2); +} + +@stage(fragment) +fn fragment_main() { + atomicCompareExchangeWeak_63d8e6(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicCompareExchangeWeak_63d8e6(); +} diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl new file mode 100644 index 0000000000..b13a4e4e63 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl @@ -0,0 +1,37 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +var arg_0: atomic; + +// fn atomicCompareExchangeWeak(ptr, read_write>, u32, u32) -> __atomic_compare_exchange_result +fn atomicCompareExchangeWeak_83580d() { + var arg_1 = 1u; + var arg_2 = 1u; + var res = atomicCompareExchangeWeak(&arg_0, arg_1, arg_2); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicCompareExchangeWeak_83580d(); +} diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.glsl new file mode 100644 index 0000000000..a9569da165 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.glsl @@ -0,0 +1,31 @@ +#version 310 es + +struct atomic_compare_exchange_resultu32 { + uint old_value; + bool exchanged; +}; + + +shared uint arg_0; +void atomicCompareExchangeWeak_83580d() { + uint arg_1 = 1u; + uint arg_2 = 1u; + atomic_compare_exchange_resultu32 atomic_compare_result; + atomic_compare_result.old_value = atomicCompSwap(arg_0, arg_1, arg_2); + atomic_compare_result.exchanged = atomic_compare_result.old_value == arg_1; + atomic_compare_exchange_resultu32 res = atomic_compare_result; +} + +void compute_main(uint local_invocation_index) { + { + atomicExchange(arg_0, 0u); + } + barrier(); + atomicCompareExchangeWeak_83580d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.hlsl new file mode 100644 index 0000000000..57e527d0c4 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.hlsl @@ -0,0 +1,17 @@ +SKIP: FAILED + + +var arg_0 : atomic; + +fn atomicCompareExchangeWeak_83580d() { + var arg_1 = 1u; + var arg_2 = 1u; + var res = atomicCompareExchangeWeak(&(arg_0), arg_1, arg_2); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicCompareExchangeWeak_83580d(); +} + +Failed to generate: error: unknown type in EmitType diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.msl new file mode 100644 index 0000000000..6e181e37d5 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; + +struct atomic_compare_exchange_resultu32 { + uint old_value; + bool exchanged; +}; +template +atomic_compare_exchange_resultu32 atomicCompareExchangeWeak_1(threadgroup A* atomic, T compare, T value) { + T old_value = compare; + bool exchanged = atomic_compare_exchange_weak_explicit(atomic, &old_value, value, memory_order_relaxed, memory_order_relaxed); + return {old_value, exchanged}; +} + +void atomicCompareExchangeWeak_83580d(threadgroup atomic_uint* const tint_symbol) { + uint arg_1 = 1u; + uint arg_2 = 1u; + atomic_compare_exchange_resultu32 res = atomicCompareExchangeWeak_1(tint_symbol, arg_1, arg_2); +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) { + { + atomic_store_explicit(tint_symbol_1, 0u, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicCompareExchangeWeak_83580d(tint_symbol_1); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup atomic_uint tint_symbol_2; + compute_main_inner(local_invocation_index, &(tint_symbol_2)); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.spvasm new file mode 100644 index 0000000000..4f519e03e4 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicCompareExchangeWeak_83580d "atomicCompareExchangeWeak_83580d" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %__atomic_compare_exchange_resultu32 "__atomic_compare_exchange_resultu32" + OpMemberName %__atomic_compare_exchange_resultu32 0 "old_value" + OpMemberName %__atomic_compare_exchange_resultu32 1 "exchanged" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + OpMemberDecorate %__atomic_compare_exchange_resultu32 0 Offset 0 + OpMemberDecorate %__atomic_compare_exchange_resultu32 1 Offset 4 + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %6 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %13 = OpConstantNull %uint + %bool = OpTypeBool +%__atomic_compare_exchange_resultu32 = OpTypeStruct %uint %bool + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 +%_ptr_Function___atomic_compare_exchange_resultu32 = OpTypePointer Function %__atomic_compare_exchange_resultu32 + %26 = OpConstantNull %__atomic_compare_exchange_resultu32 + %27 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicCompareExchangeWeak_83580d = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %13 + %arg_2 = OpVariable %_ptr_Function_uint Function %13 + %res = OpVariable %_ptr_Function___atomic_compare_exchange_resultu32 Function %26 + OpStore %arg_1 %uint_1 + OpStore %arg_2 %uint_1 + %21 = OpLoad %uint %arg_2 + %22 = OpAtomicCompareExchange %uint %arg_0 %uint_2 %uint_0 %uint_0 %21 %arg_1 + %23 = OpIEqual %bool %22 %21 + %15 = OpCompositeConstruct %__atomic_compare_exchange_resultu32 %22 %23 + OpStore %res %15 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %27 +%local_invocation_index = OpFunctionParameter %uint + %30 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %13 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %35 = OpFunctionCall %void %atomicCompareExchangeWeak_83580d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %6 + %37 = OpLabel + %39 = OpLoad %uint %local_invocation_index_1 + %38 = OpFunctionCall %void %compute_main_inner %39 + OpReturn + OpFunctionEnd +1:1: AtomicCompareExchange: expected Comparator to be of type Result Type + %22 = OpAtomicCompareExchange %uint %arg_0 %uint_2 %uint_0 %uint_0 %21 %arg_1 + diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.wgsl new file mode 100644 index 0000000000..385448dcf4 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +var arg_0 : atomic; + +fn atomicCompareExchangeWeak_83580d() { + var arg_1 = 1u; + var arg_2 = 1u; + var res = atomicCompareExchangeWeak(&(arg_0), arg_1, arg_2); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicCompareExchangeWeak_83580d(); +} diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl new file mode 100644 index 0000000000..c31c39da47 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl @@ -0,0 +1,37 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +var arg_0: atomic; + +// fn atomicCompareExchangeWeak(ptr, read_write>, i32, i32) -> __atomic_compare_exchange_result +fn atomicCompareExchangeWeak_e88938() { + var arg_1 = 1; + var arg_2 = 1; + var res = atomicCompareExchangeWeak(&arg_0, arg_1, arg_2); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicCompareExchangeWeak_e88938(); +} diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.glsl new file mode 100644 index 0000000000..2c5d1a394a --- /dev/null +++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.glsl @@ -0,0 +1,31 @@ +#version 310 es + +struct atomic_compare_exchange_resulti32 { + int old_value; + bool exchanged; +}; + + +shared int arg_0; +void atomicCompareExchangeWeak_e88938() { + int arg_1 = 1; + int arg_2 = 1; + atomic_compare_exchange_resulti32 atomic_compare_result; + atomic_compare_result.old_value = atomicCompSwap(arg_0, arg_1, arg_2); + atomic_compare_result.exchanged = atomic_compare_result.old_value == arg_1; + atomic_compare_exchange_resulti32 res = atomic_compare_result; +} + +void compute_main(uint local_invocation_index) { + { + atomicExchange(arg_0, 0); + } + barrier(); + atomicCompareExchangeWeak_e88938(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.hlsl new file mode 100644 index 0000000000..d74ead1a12 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.hlsl @@ -0,0 +1,17 @@ +SKIP: FAILED + + +var arg_0 : atomic; + +fn atomicCompareExchangeWeak_e88938() { + var arg_1 = 1; + var arg_2 = 1; + var res = atomicCompareExchangeWeak(&(arg_0), arg_1, arg_2); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicCompareExchangeWeak_e88938(); +} + +Failed to generate: error: unknown type in EmitType diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.msl new file mode 100644 index 0000000000..38f9dc57d2 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; + +struct atomic_compare_exchange_resulti32 { + int old_value; + bool exchanged; +}; +template +atomic_compare_exchange_resulti32 atomicCompareExchangeWeak_1(threadgroup A* atomic, T compare, T value) { + T old_value = compare; + bool exchanged = atomic_compare_exchange_weak_explicit(atomic, &old_value, value, memory_order_relaxed, memory_order_relaxed); + return {old_value, exchanged}; +} + +void atomicCompareExchangeWeak_e88938(threadgroup atomic_int* const tint_symbol) { + int arg_1 = 1; + int arg_2 = 1; + atomic_compare_exchange_resulti32 res = atomicCompareExchangeWeak_1(tint_symbol, arg_1, arg_2); +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) { + { + atomic_store_explicit(tint_symbol_1, 0, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicCompareExchangeWeak_e88938(tint_symbol_1); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup atomic_int tint_symbol_2; + compute_main_inner(local_invocation_index, &(tint_symbol_2)); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.spvasm new file mode 100644 index 0000000000..9bf039b6ee --- /dev/null +++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicCompareExchangeWeak_e88938 "atomicCompareExchangeWeak_e88938" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %__atomic_compare_exchange_resulti32 "__atomic_compare_exchange_resulti32" + OpMemberName %__atomic_compare_exchange_resulti32 0 "old_value" + OpMemberName %__atomic_compare_exchange_resulti32 1 "exchanged" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + OpMemberDecorate %__atomic_compare_exchange_resulti32 0 Offset 0 + OpMemberDecorate %__atomic_compare_exchange_resulti32 1 Offset 4 + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %7 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %14 = OpConstantNull %int + %bool = OpTypeBool +%__atomic_compare_exchange_resulti32 = OpTypeStruct %int %bool + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 +%_ptr_Function___atomic_compare_exchange_resulti32 = OpTypePointer Function %__atomic_compare_exchange_resulti32 + %27 = OpConstantNull %__atomic_compare_exchange_resulti32 + %28 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicCompareExchangeWeak_e88938 = OpFunction %void None %7 + %10 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %14 + %arg_2 = OpVariable %_ptr_Function_int Function %14 + %res = OpVariable %_ptr_Function___atomic_compare_exchange_resulti32 Function %27 + OpStore %arg_1 %int_1 + OpStore %arg_2 %int_1 + %22 = OpLoad %int %arg_2 + %23 = OpAtomicCompareExchange %int %arg_0 %uint_2 %uint_0 %uint_0 %22 %arg_1 + %24 = OpIEqual %bool %23 %22 + %16 = OpCompositeConstruct %__atomic_compare_exchange_resulti32 %23 %24 + OpStore %res %16 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %28 +%local_invocation_index = OpFunctionParameter %uint + %31 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %36 = OpFunctionCall %void %atomicCompareExchangeWeak_e88938 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %7 + %38 = OpLabel + %40 = OpLoad %uint %local_invocation_index_1 + %39 = OpFunctionCall %void %compute_main_inner %40 + OpReturn + OpFunctionEnd +1:1: AtomicCompareExchange: expected Comparator to be of type Result Type + %23 = OpAtomicCompareExchange %int %arg_0 %uint_2 %uint_0 %uint_0 %22 %arg_1 + diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.wgsl new file mode 100644 index 0000000000..ce2d4c96eb --- /dev/null +++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +var arg_0 : atomic; + +fn atomicCompareExchangeWeak_e88938() { + var arg_1 = 1; + var arg_2 = 1; + var res = atomicCompareExchangeWeak(&(arg_0), arg_1, arg_2); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicCompareExchangeWeak_e88938(); +} diff --git a/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl b/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl new file mode 100644 index 0000000000..1f089d2ff3 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl @@ -0,0 +1,36 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +var arg_0: atomic; + +// fn atomicExchange(ptr, read_write>, u32) -> u32 +fn atomicExchange_0a5dca() { + var arg_1 = 1u; + var res: u32 = atomicExchange(&arg_0, arg_1); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicExchange_0a5dca(); +} diff --git a/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.glsl new file mode 100644 index 0000000000..268ea18e7a --- /dev/null +++ b/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.glsl @@ -0,0 +1,21 @@ +#version 310 es + +shared uint arg_0; +void atomicExchange_0a5dca() { + uint arg_1 = 1u; + uint res = atomicExchange(arg_0, arg_1); +} + +void compute_main(uint local_invocation_index) { + { + atomicExchange(arg_0, 0u); + } + barrier(); + atomicExchange_0a5dca(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.hlsl new file mode 100644 index 0000000000..b119a3ff20 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.hlsl @@ -0,0 +1,27 @@ +groupshared uint arg_0; + +void atomicExchange_0a5dca() { + uint arg_1 = 1u; + uint atomic_result = 0u; + InterlockedExchange(arg_0, arg_1, atomic_result); + uint res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicExchange_0a5dca(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.msl new file mode 100644 index 0000000000..3b21e2f29c --- /dev/null +++ b/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +void atomicExchange_0a5dca(threadgroup atomic_uint* const tint_symbol) { + uint arg_1 = 1u; + uint res = atomic_exchange_explicit(tint_symbol, arg_1, memory_order_relaxed); +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) { + { + atomic_store_explicit(tint_symbol_1, 0u, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicExchange_0a5dca(tint_symbol_1); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup atomic_uint tint_symbol_2; + compute_main_inner(local_invocation_index, &(tint_symbol_2)); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.spvasm new file mode 100644 index 0000000000..3bbfe18b89 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.spvasm @@ -0,0 +1,56 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicExchange_0a5dca "atomicExchange_0a5dca" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %6 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %13 = OpConstantNull %uint + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %20 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicExchange_0a5dca = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %13 + %res = OpVariable %_ptr_Function_uint Function %13 + OpStore %arg_1 %uint_1 + %18 = OpLoad %uint %arg_1 + %14 = OpAtomicExchange %uint %arg_0 %uint_2 %uint_0 %18 + OpStore %res %14 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %20 +%local_invocation_index = OpFunctionParameter %uint + %23 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %13 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %28 = OpFunctionCall %void %atomicExchange_0a5dca + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %6 + %30 = OpLabel + %32 = OpLoad %uint %local_invocation_index_1 + %31 = OpFunctionCall %void %compute_main_inner %32 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.wgsl new file mode 100644 index 0000000000..97df00c834 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.wgsl @@ -0,0 +1,11 @@ +var arg_0 : atomic; + +fn atomicExchange_0a5dca() { + var arg_1 = 1u; + var res : u32 = atomicExchange(&(arg_0), arg_1); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicExchange_0a5dca(); +} diff --git a/test/tint/builtins/gen/var/atomicExchange/d59712.wgsl b/test/tint/builtins/gen/var/atomicExchange/d59712.wgsl new file mode 100644 index 0000000000..da57ab26fb --- /dev/null +++ b/test/tint/builtins/gen/var/atomicExchange/d59712.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: atomic, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn atomicExchange(ptr, read_write>, u32) -> u32 +fn atomicExchange_d59712() { + var arg_1 = 1u; + var res: u32 = atomicExchange(&sb_rw.arg_0, arg_1); +} + +@stage(fragment) +fn fragment_main() { + atomicExchange_d59712(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicExchange_d59712(); +} diff --git a/test/tint/builtins/gen/var/atomicExchange/d59712.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicExchange/d59712.wgsl.expected.glsl new file mode 100644 index 0000000000..36903e217d --- /dev/null +++ b/test/tint/builtins/gen/var/atomicExchange/d59712.wgsl.expected.glsl @@ -0,0 +1,46 @@ +#version 310 es +precision mediump float; + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + uint arg_0; +} sb_rw; +void atomicExchange_d59712() { + uint arg_1 = 1u; + uint res = atomicExchange(sb_rw.arg_0, arg_1); +} + +void fragment_main() { + atomicExchange_d59712(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + uint arg_0; +} sb_rw; +void atomicExchange_d59712() { + uint arg_1 = 1u; + uint res = atomicExchange(sb_rw.arg_0, arg_1); +} + +void compute_main() { + atomicExchange_d59712(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicExchange/d59712.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicExchange/d59712.wgsl.expected.hlsl new file mode 100644 index 0000000000..cec9984aab --- /dev/null +++ b/test/tint/builtins/gen/var/atomicExchange/d59712.wgsl.expected.hlsl @@ -0,0 +1,24 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicExchange(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedExchange(offset, value, original_value); + return original_value; +} + + +void atomicExchange_d59712() { + uint arg_1 = 1u; + uint res = tint_atomicExchange(sb_rw, 0u, arg_1); +} + +void fragment_main() { + atomicExchange_d59712(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicExchange_d59712(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicExchange/d59712.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicExchange/d59712.wgsl.expected.msl new file mode 100644 index 0000000000..425a34f260 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicExchange/d59712.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +struct SB_RW { + /* 0x0000 */ atomic_uint arg_0; +}; + +void atomicExchange_d59712(device SB_RW* const tint_symbol) { + uint arg_1 = 1u; + uint res = atomic_exchange_explicit(&((*(tint_symbol)).arg_0), arg_1, memory_order_relaxed); +} + +fragment void fragment_main(device SB_RW* tint_symbol_1 [[buffer(0)]]) { + atomicExchange_d59712(tint_symbol_1); + return; +} + +kernel void compute_main(device SB_RW* tint_symbol_2 [[buffer(0)]]) { + atomicExchange_d59712(tint_symbol_2); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicExchange/d59712.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicExchange/d59712.wgsl.expected.spvasm new file mode 100644 index 0000000000..2ec90f3908 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicExchange/d59712.wgsl.expected.spvasm @@ -0,0 +1,55 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicExchange_d59712 "atomicExchange_d59712" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %uint = OpTypeInt 32 0 + %SB_RW = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %12 = OpConstantNull %uint + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%atomicExchange_d59712 = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %12 + %res = OpVariable %_ptr_Function_uint Function %12 + OpStore %arg_1 %uint_1 + %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %18 = OpLoad %uint %arg_1 + %13 = OpAtomicExchange %uint %17 %uint_1 %uint_0 %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %21 = OpLabel + %22 = OpFunctionCall %void %atomicExchange_d59712 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %24 = OpLabel + %25 = OpFunctionCall %void %atomicExchange_d59712 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicExchange/d59712.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicExchange/d59712.wgsl.expected.wgsl new file mode 100644 index 0000000000..e2f39b74bf --- /dev/null +++ b/test/tint/builtins/gen/var/atomicExchange/d59712.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +struct SB_RW { + arg_0 : atomic, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn atomicExchange_d59712() { + var arg_1 = 1u; + var res : u32 = atomicExchange(&(sb_rw.arg_0), arg_1); +} + +@stage(fragment) +fn fragment_main() { + atomicExchange_d59712(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicExchange_d59712(); +} diff --git a/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl b/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl new file mode 100644 index 0000000000..5d88b53f51 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl @@ -0,0 +1,36 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +var arg_0: atomic; + +// fn atomicExchange(ptr, read_write>, i32) -> i32 +fn atomicExchange_e114ba() { + var arg_1 = 1; + var res: i32 = atomicExchange(&arg_0, arg_1); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicExchange_e114ba(); +} diff --git a/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.glsl new file mode 100644 index 0000000000..7eb05f37bd --- /dev/null +++ b/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.glsl @@ -0,0 +1,21 @@ +#version 310 es + +shared int arg_0; +void atomicExchange_e114ba() { + int arg_1 = 1; + int res = atomicExchange(arg_0, arg_1); +} + +void compute_main(uint local_invocation_index) { + { + atomicExchange(arg_0, 0); + } + barrier(); + atomicExchange_e114ba(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.hlsl new file mode 100644 index 0000000000..86842c2267 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.hlsl @@ -0,0 +1,27 @@ +groupshared int arg_0; + +void atomicExchange_e114ba() { + int arg_1 = 1; + int atomic_result = 0; + InterlockedExchange(arg_0, arg_1, atomic_result); + int res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicExchange_e114ba(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.msl new file mode 100644 index 0000000000..a7180f6cae --- /dev/null +++ b/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +void atomicExchange_e114ba(threadgroup atomic_int* const tint_symbol) { + int arg_1 = 1; + int res = atomic_exchange_explicit(tint_symbol, arg_1, memory_order_relaxed); +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) { + { + atomic_store_explicit(tint_symbol_1, 0, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicExchange_e114ba(tint_symbol_1); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup atomic_int tint_symbol_2; + compute_main_inner(local_invocation_index, &(tint_symbol_2)); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.spvasm new file mode 100644 index 0000000000..0e6f0a80e1 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.spvasm @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicExchange_e114ba "atomicExchange_e114ba" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %7 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %14 = OpConstantNull %int + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %21 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicExchange_e114ba = OpFunction %void None %7 + %10 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %14 + %res = OpVariable %_ptr_Function_int Function %14 + OpStore %arg_1 %int_1 + %19 = OpLoad %int %arg_1 + %15 = OpAtomicExchange %int %arg_0 %uint_2 %uint_0 %19 + OpStore %res %15 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %21 +%local_invocation_index = OpFunctionParameter %uint + %24 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %29 = OpFunctionCall %void %atomicExchange_e114ba + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %7 + %31 = OpLabel + %33 = OpLoad %uint %local_invocation_index_1 + %32 = OpFunctionCall %void %compute_main_inner %33 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.wgsl new file mode 100644 index 0000000000..4002898985 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.wgsl @@ -0,0 +1,11 @@ +var arg_0 : atomic; + +fn atomicExchange_e114ba() { + var arg_1 = 1; + var res : i32 = atomicExchange(&(arg_0), arg_1); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicExchange_e114ba(); +} diff --git a/test/tint/builtins/gen/var/atomicExchange/f2e22f.wgsl b/test/tint/builtins/gen/var/atomicExchange/f2e22f.wgsl new file mode 100644 index 0000000000..29390d087b --- /dev/null +++ b/test/tint/builtins/gen/var/atomicExchange/f2e22f.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: atomic, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn atomicExchange(ptr, read_write>, i32) -> i32 +fn atomicExchange_f2e22f() { + var arg_1 = 1; + var res: i32 = atomicExchange(&sb_rw.arg_0, arg_1); +} + +@stage(fragment) +fn fragment_main() { + atomicExchange_f2e22f(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicExchange_f2e22f(); +} diff --git a/test/tint/builtins/gen/var/atomicExchange/f2e22f.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicExchange/f2e22f.wgsl.expected.glsl new file mode 100644 index 0000000000..c74e310d92 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicExchange/f2e22f.wgsl.expected.glsl @@ -0,0 +1,46 @@ +#version 310 es +precision mediump float; + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + int arg_0; +} sb_rw; +void atomicExchange_f2e22f() { + int arg_1 = 1; + int res = atomicExchange(sb_rw.arg_0, arg_1); +} + +void fragment_main() { + atomicExchange_f2e22f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + int arg_0; +} sb_rw; +void atomicExchange_f2e22f() { + int arg_1 = 1; + int res = atomicExchange(sb_rw.arg_0, arg_1); +} + +void compute_main() { + atomicExchange_f2e22f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicExchange/f2e22f.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicExchange/f2e22f.wgsl.expected.hlsl new file mode 100644 index 0000000000..8c0fe233c1 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicExchange/f2e22f.wgsl.expected.hlsl @@ -0,0 +1,24 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicExchange(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedExchange(offset, value, original_value); + return original_value; +} + + +void atomicExchange_f2e22f() { + int arg_1 = 1; + int res = tint_atomicExchange(sb_rw, 0u, arg_1); +} + +void fragment_main() { + atomicExchange_f2e22f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicExchange_f2e22f(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicExchange/f2e22f.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicExchange/f2e22f.wgsl.expected.msl new file mode 100644 index 0000000000..e4e291f80c --- /dev/null +++ b/test/tint/builtins/gen/var/atomicExchange/f2e22f.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +struct SB_RW { + /* 0x0000 */ atomic_int arg_0; +}; + +void atomicExchange_f2e22f(device SB_RW* const tint_symbol) { + int arg_1 = 1; + int res = atomic_exchange_explicit(&((*(tint_symbol)).arg_0), arg_1, memory_order_relaxed); +} + +fragment void fragment_main(device SB_RW* tint_symbol_1 [[buffer(0)]]) { + atomicExchange_f2e22f(tint_symbol_1); + return; +} + +kernel void compute_main(device SB_RW* tint_symbol_2 [[buffer(0)]]) { + atomicExchange_f2e22f(tint_symbol_2); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicExchange/f2e22f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicExchange/f2e22f.wgsl.expected.spvasm new file mode 100644 index 0000000000..755a537b01 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicExchange/f2e22f.wgsl.expected.spvasm @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 28 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicExchange_f2e22f "atomicExchange_f2e22f" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %int = OpTypeInt 32 1 + %SB_RW = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %12 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int +%atomicExchange_f2e22f = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %12 + %res = OpVariable %_ptr_Function_int Function %12 + OpStore %arg_1 %int_1 + %19 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %20 = OpLoad %int %arg_1 + %13 = OpAtomicExchange %int %19 %uint_1 %uint_0 %20 + OpStore %res %13 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %23 = OpLabel + %24 = OpFunctionCall %void %atomicExchange_f2e22f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %26 = OpLabel + %27 = OpFunctionCall %void %atomicExchange_f2e22f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicExchange/f2e22f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicExchange/f2e22f.wgsl.expected.wgsl new file mode 100644 index 0000000000..9cb773149a --- /dev/null +++ b/test/tint/builtins/gen/var/atomicExchange/f2e22f.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +struct SB_RW { + arg_0 : atomic, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn atomicExchange_f2e22f() { + var arg_1 = 1; + var res : i32 = atomicExchange(&(sb_rw.arg_0), arg_1); +} + +@stage(fragment) +fn fragment_main() { + atomicExchange_f2e22f(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicExchange_f2e22f(); +} diff --git a/test/tint/builtins/gen/var/atomicLoad/0806ad.wgsl b/test/tint/builtins/gen/var/atomicLoad/0806ad.wgsl new file mode 100644 index 0000000000..e20d830b0e --- /dev/null +++ b/test/tint/builtins/gen/var/atomicLoad/0806ad.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: atomic, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn atomicLoad(ptr, read_write>) -> i32 +fn atomicLoad_0806ad() { + var res: i32 = atomicLoad(&sb_rw.arg_0); +} + +@stage(fragment) +fn fragment_main() { + atomicLoad_0806ad(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicLoad_0806ad(); +} diff --git a/test/tint/builtins/gen/var/atomicLoad/0806ad.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicLoad/0806ad.wgsl.expected.glsl new file mode 100644 index 0000000000..38a8c929f0 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicLoad/0806ad.wgsl.expected.glsl @@ -0,0 +1,44 @@ +#version 310 es +precision mediump float; + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + int arg_0; +} sb_rw; +void atomicLoad_0806ad() { + int res = atomicOr(sb_rw.arg_0, 0); +} + +void fragment_main() { + atomicLoad_0806ad(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + int arg_0; +} sb_rw; +void atomicLoad_0806ad() { + int res = atomicOr(sb_rw.arg_0, 0); +} + +void compute_main() { + atomicLoad_0806ad(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicLoad/0806ad.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicLoad/0806ad.wgsl.expected.hlsl new file mode 100644 index 0000000000..a278b2c16c --- /dev/null +++ b/test/tint/builtins/gen/var/atomicLoad/0806ad.wgsl.expected.hlsl @@ -0,0 +1,23 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicLoad(RWByteAddressBuffer buffer, uint offset) { + int value = 0; + buffer.InterlockedOr(offset, 0, value); + return value; +} + + +void atomicLoad_0806ad() { + int res = tint_atomicLoad(sb_rw, 0u); +} + +void fragment_main() { + atomicLoad_0806ad(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicLoad_0806ad(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicLoad/0806ad.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicLoad/0806ad.wgsl.expected.msl new file mode 100644 index 0000000000..2335d0d0df --- /dev/null +++ b/test/tint/builtins/gen/var/atomicLoad/0806ad.wgsl.expected.msl @@ -0,0 +1,21 @@ +#include + +using namespace metal; +struct SB_RW { + /* 0x0000 */ atomic_int arg_0; +}; + +void atomicLoad_0806ad(device SB_RW* const tint_symbol) { + int res = atomic_load_explicit(&((*(tint_symbol)).arg_0), memory_order_relaxed); +} + +fragment void fragment_main(device SB_RW* tint_symbol_1 [[buffer(0)]]) { + atomicLoad_0806ad(tint_symbol_1); + return; +} + +kernel void compute_main(device SB_RW* tint_symbol_2 [[buffer(0)]]) { + atomicLoad_0806ad(tint_symbol_2); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicLoad/0806ad.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicLoad/0806ad.wgsl.expected.spvasm new file mode 100644 index 0000000000..d961ea5c86 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicLoad/0806ad.wgsl.expected.spvasm @@ -0,0 +1,52 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 25 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicLoad_0806ad "atomicLoad_0806ad" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %int = OpTypeInt 32 1 + %SB_RW = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int +%_ptr_Function_int = OpTypePointer Function %int + %18 = OpConstantNull %int +%atomicLoad_0806ad = OpFunction %void None %5 + %8 = OpLabel + %res = OpVariable %_ptr_Function_int Function %18 + %15 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %9 = OpAtomicLoad %int %15 %uint_1 %uint_0 + OpStore %res %9 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %20 = OpLabel + %21 = OpFunctionCall %void %atomicLoad_0806ad + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %23 = OpLabel + %24 = OpFunctionCall %void %atomicLoad_0806ad + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicLoad/0806ad.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicLoad/0806ad.wgsl.expected.wgsl new file mode 100644 index 0000000000..e761dd984f --- /dev/null +++ b/test/tint/builtins/gen/var/atomicLoad/0806ad.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +struct SB_RW { + arg_0 : atomic, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn atomicLoad_0806ad() { + var res : i32 = atomicLoad(&(sb_rw.arg_0)); +} + +@stage(fragment) +fn fragment_main() { + atomicLoad_0806ad(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicLoad_0806ad(); +} diff --git a/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl b/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl new file mode 100644 index 0000000000..e0cc43fdb4 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl @@ -0,0 +1,35 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +var arg_0: atomic; + +// fn atomicLoad(ptr, read_write>) -> u32 +fn atomicLoad_361bf1() { + var res: u32 = atomicLoad(&arg_0); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicLoad_361bf1(); +} diff --git a/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.glsl new file mode 100644 index 0000000000..f56f5a7f6e --- /dev/null +++ b/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.glsl @@ -0,0 +1,20 @@ +#version 310 es + +shared uint arg_0; +void atomicLoad_361bf1() { + uint res = atomicOr(arg_0, 0u); +} + +void compute_main(uint local_invocation_index) { + { + atomicExchange(arg_0, 0u); + } + barrier(); + atomicLoad_361bf1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.hlsl new file mode 100644 index 0000000000..f0f031f320 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.hlsl @@ -0,0 +1,26 @@ +groupshared uint arg_0; + +void atomicLoad_361bf1() { + uint atomic_result = 0u; + InterlockedOr(arg_0, 0, atomic_result); + uint res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicLoad_361bf1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.msl new file mode 100644 index 0000000000..eedf946e10 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.msl @@ -0,0 +1,21 @@ +#include + +using namespace metal; +void atomicLoad_361bf1(threadgroup atomic_uint* const tint_symbol) { + uint res = atomic_load_explicit(tint_symbol, memory_order_relaxed); +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) { + { + atomic_store_explicit(tint_symbol_1, 0u, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicLoad_361bf1(tint_symbol_1); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup atomic_uint tint_symbol_2; + compute_main_inner(local_invocation_index, &(tint_symbol_2)); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.spvasm new file mode 100644 index 0000000000..20eeca7ef5 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.spvasm @@ -0,0 +1,51 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 30 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicLoad_361bf1 "atomicLoad_361bf1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %6 = OpTypeFunction %void + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %16 = OpConstantNull %uint + %17 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicLoad_361bf1 = OpFunction %void None %6 + %9 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %16 + %10 = OpAtomicLoad %uint %arg_0 %uint_2 %uint_0 + OpStore %res %10 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %17 +%local_invocation_index = OpFunctionParameter %uint + %20 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %16 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %25 = OpFunctionCall %void %atomicLoad_361bf1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %6 + %27 = OpLabel + %29 = OpLoad %uint %local_invocation_index_1 + %28 = OpFunctionCall %void %compute_main_inner %29 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.wgsl new file mode 100644 index 0000000000..1040bf29af --- /dev/null +++ b/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var arg_0 : atomic; + +fn atomicLoad_361bf1() { + var res : u32 = atomicLoad(&(arg_0)); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicLoad_361bf1(); +} diff --git a/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl b/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl new file mode 100644 index 0000000000..025384fc78 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl @@ -0,0 +1,35 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +var arg_0: atomic; + +// fn atomicLoad(ptr, read_write>) -> i32 +fn atomicLoad_afcc03() { + var res: i32 = atomicLoad(&arg_0); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicLoad_afcc03(); +} diff --git a/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.glsl new file mode 100644 index 0000000000..a290c99b4e --- /dev/null +++ b/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.glsl @@ -0,0 +1,20 @@ +#version 310 es + +shared int arg_0; +void atomicLoad_afcc03() { + int res = atomicOr(arg_0, 0); +} + +void compute_main(uint local_invocation_index) { + { + atomicExchange(arg_0, 0); + } + barrier(); + atomicLoad_afcc03(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.hlsl new file mode 100644 index 0000000000..adf265f6aa --- /dev/null +++ b/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.hlsl @@ -0,0 +1,26 @@ +groupshared int arg_0; + +void atomicLoad_afcc03() { + int atomic_result = 0; + InterlockedOr(arg_0, 0, atomic_result); + int res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicLoad_afcc03(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.msl new file mode 100644 index 0000000000..90d483da2f --- /dev/null +++ b/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.msl @@ -0,0 +1,21 @@ +#include + +using namespace metal; +void atomicLoad_afcc03(threadgroup atomic_int* const tint_symbol) { + int res = atomic_load_explicit(tint_symbol, memory_order_relaxed); +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) { + { + atomic_store_explicit(tint_symbol_1, 0, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicLoad_afcc03(tint_symbol_1); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup atomic_int tint_symbol_2; + compute_main_inner(local_invocation_index, &(tint_symbol_2)); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.spvasm new file mode 100644 index 0000000000..b996359601 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.spvasm @@ -0,0 +1,52 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 31 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicLoad_afcc03 "atomicLoad_afcc03" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %7 = OpTypeFunction %void + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_int = OpTypePointer Function %int + %17 = OpConstantNull %int + %18 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicLoad_afcc03 = OpFunction %void None %7 + %10 = OpLabel + %res = OpVariable %_ptr_Function_int Function %17 + %11 = OpAtomicLoad %int %arg_0 %uint_2 %uint_0 + OpStore %res %11 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %18 +%local_invocation_index = OpFunctionParameter %uint + %21 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %17 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %26 = OpFunctionCall %void %atomicLoad_afcc03 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %7 + %28 = OpLabel + %30 = OpLoad %uint %local_invocation_index_1 + %29 = OpFunctionCall %void %compute_main_inner %30 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.wgsl new file mode 100644 index 0000000000..e39317dde8 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var arg_0 : atomic; + +fn atomicLoad_afcc03() { + var res : i32 = atomicLoad(&(arg_0)); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicLoad_afcc03(); +} diff --git a/test/tint/builtins/gen/var/atomicLoad/fe6cc3.wgsl b/test/tint/builtins/gen/var/atomicLoad/fe6cc3.wgsl new file mode 100644 index 0000000000..63b1594678 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicLoad/fe6cc3.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: atomic, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn atomicLoad(ptr, read_write>) -> u32 +fn atomicLoad_fe6cc3() { + var res: u32 = atomicLoad(&sb_rw.arg_0); +} + +@stage(fragment) +fn fragment_main() { + atomicLoad_fe6cc3(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicLoad_fe6cc3(); +} diff --git a/test/tint/builtins/gen/var/atomicLoad/fe6cc3.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicLoad/fe6cc3.wgsl.expected.glsl new file mode 100644 index 0000000000..b4bd0d8472 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicLoad/fe6cc3.wgsl.expected.glsl @@ -0,0 +1,44 @@ +#version 310 es +precision mediump float; + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + uint arg_0; +} sb_rw; +void atomicLoad_fe6cc3() { + uint res = atomicOr(sb_rw.arg_0, 0u); +} + +void fragment_main() { + atomicLoad_fe6cc3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + uint arg_0; +} sb_rw; +void atomicLoad_fe6cc3() { + uint res = atomicOr(sb_rw.arg_0, 0u); +} + +void compute_main() { + atomicLoad_fe6cc3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicLoad/fe6cc3.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicLoad/fe6cc3.wgsl.expected.hlsl new file mode 100644 index 0000000000..77edab3db2 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicLoad/fe6cc3.wgsl.expected.hlsl @@ -0,0 +1,23 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicLoad(RWByteAddressBuffer buffer, uint offset) { + uint value = 0; + buffer.InterlockedOr(offset, 0, value); + return value; +} + + +void atomicLoad_fe6cc3() { + uint res = tint_atomicLoad(sb_rw, 0u); +} + +void fragment_main() { + atomicLoad_fe6cc3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicLoad_fe6cc3(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicLoad/fe6cc3.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicLoad/fe6cc3.wgsl.expected.msl new file mode 100644 index 0000000000..e78624ded8 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicLoad/fe6cc3.wgsl.expected.msl @@ -0,0 +1,21 @@ +#include + +using namespace metal; +struct SB_RW { + /* 0x0000 */ atomic_uint arg_0; +}; + +void atomicLoad_fe6cc3(device SB_RW* const tint_symbol) { + uint res = atomic_load_explicit(&((*(tint_symbol)).arg_0), memory_order_relaxed); +} + +fragment void fragment_main(device SB_RW* tint_symbol_1 [[buffer(0)]]) { + atomicLoad_fe6cc3(tint_symbol_1); + return; +} + +kernel void compute_main(device SB_RW* tint_symbol_2 [[buffer(0)]]) { + atomicLoad_fe6cc3(tint_symbol_2); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicLoad/fe6cc3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicLoad/fe6cc3.wgsl.expected.spvasm new file mode 100644 index 0000000000..776c62c09f --- /dev/null +++ b/test/tint/builtins/gen/var/atomicLoad/fe6cc3.wgsl.expected.spvasm @@ -0,0 +1,51 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 24 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicLoad_fe6cc3 "atomicLoad_fe6cc3" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %uint = OpTypeInt 32 0 + %SB_RW = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%_ptr_Function_uint = OpTypePointer Function %uint + %17 = OpConstantNull %uint +%atomicLoad_fe6cc3 = OpFunction %void None %5 + %8 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %17 + %14 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %9 = OpAtomicLoad %uint %14 %uint_1 %uint_0 + OpStore %res %9 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %19 = OpLabel + %20 = OpFunctionCall %void %atomicLoad_fe6cc3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %22 = OpLabel + %23 = OpFunctionCall %void %atomicLoad_fe6cc3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicLoad/fe6cc3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicLoad/fe6cc3.wgsl.expected.wgsl new file mode 100644 index 0000000000..f811ee370e --- /dev/null +++ b/test/tint/builtins/gen/var/atomicLoad/fe6cc3.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +struct SB_RW { + arg_0 : atomic, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn atomicLoad_fe6cc3() { + var res : u32 = atomicLoad(&(sb_rw.arg_0)); +} + +@stage(fragment) +fn fragment_main() { + atomicLoad_fe6cc3(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicLoad_fe6cc3(); +} diff --git a/test/tint/builtins/gen/var/atomicMax/51b9be.wgsl b/test/tint/builtins/gen/var/atomicMax/51b9be.wgsl new file mode 100644 index 0000000000..44209ff5c5 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMax/51b9be.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: atomic, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn atomicMax(ptr, read_write>, u32) -> u32 +fn atomicMax_51b9be() { + var arg_1 = 1u; + var res: u32 = atomicMax(&sb_rw.arg_0, arg_1); +} + +@stage(fragment) +fn fragment_main() { + atomicMax_51b9be(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicMax_51b9be(); +} diff --git a/test/tint/builtins/gen/var/atomicMax/51b9be.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicMax/51b9be.wgsl.expected.glsl new file mode 100644 index 0000000000..947c35ceaf --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMax/51b9be.wgsl.expected.glsl @@ -0,0 +1,46 @@ +#version 310 es +precision mediump float; + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + uint arg_0; +} sb_rw; +void atomicMax_51b9be() { + uint arg_1 = 1u; + uint res = atomicMax(sb_rw.arg_0, arg_1); +} + +void fragment_main() { + atomicMax_51b9be(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + uint arg_0; +} sb_rw; +void atomicMax_51b9be() { + uint arg_1 = 1u; + uint res = atomicMax(sb_rw.arg_0, arg_1); +} + +void compute_main() { + atomicMax_51b9be(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicMax/51b9be.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicMax/51b9be.wgsl.expected.hlsl new file mode 100644 index 0000000000..174521d4e0 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMax/51b9be.wgsl.expected.hlsl @@ -0,0 +1,24 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicMax(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedMax(offset, value, original_value); + return original_value; +} + + +void atomicMax_51b9be() { + uint arg_1 = 1u; + uint res = tint_atomicMax(sb_rw, 0u, arg_1); +} + +void fragment_main() { + atomicMax_51b9be(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicMax_51b9be(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicMax/51b9be.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicMax/51b9be.wgsl.expected.msl new file mode 100644 index 0000000000..71acd56b54 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMax/51b9be.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +struct SB_RW { + /* 0x0000 */ atomic_uint arg_0; +}; + +void atomicMax_51b9be(device SB_RW* const tint_symbol) { + uint arg_1 = 1u; + uint res = atomic_fetch_max_explicit(&((*(tint_symbol)).arg_0), arg_1, memory_order_relaxed); +} + +fragment void fragment_main(device SB_RW* tint_symbol_1 [[buffer(0)]]) { + atomicMax_51b9be(tint_symbol_1); + return; +} + +kernel void compute_main(device SB_RW* tint_symbol_2 [[buffer(0)]]) { + atomicMax_51b9be(tint_symbol_2); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicMax/51b9be.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicMax/51b9be.wgsl.expected.spvasm new file mode 100644 index 0000000000..97bae6a5c4 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMax/51b9be.wgsl.expected.spvasm @@ -0,0 +1,55 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicMax_51b9be "atomicMax_51b9be" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %uint = OpTypeInt 32 0 + %SB_RW = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %12 = OpConstantNull %uint + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%atomicMax_51b9be = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %12 + %res = OpVariable %_ptr_Function_uint Function %12 + OpStore %arg_1 %uint_1 + %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %18 = OpLoad %uint %arg_1 + %13 = OpAtomicUMax %uint %17 %uint_1 %uint_0 %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %21 = OpLabel + %22 = OpFunctionCall %void %atomicMax_51b9be + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %24 = OpLabel + %25 = OpFunctionCall %void %atomicMax_51b9be + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicMax/51b9be.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicMax/51b9be.wgsl.expected.wgsl new file mode 100644 index 0000000000..758c04109b --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMax/51b9be.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +struct SB_RW { + arg_0 : atomic, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn atomicMax_51b9be() { + var arg_1 = 1u; + var res : u32 = atomicMax(&(sb_rw.arg_0), arg_1); +} + +@stage(fragment) +fn fragment_main() { + atomicMax_51b9be(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicMax_51b9be(); +} diff --git a/test/tint/builtins/gen/var/atomicMax/92aa72.wgsl b/test/tint/builtins/gen/var/atomicMax/92aa72.wgsl new file mode 100644 index 0000000000..3caa15d2a9 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMax/92aa72.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: atomic, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn atomicMax(ptr, read_write>, i32) -> i32 +fn atomicMax_92aa72() { + var arg_1 = 1; + var res: i32 = atomicMax(&sb_rw.arg_0, arg_1); +} + +@stage(fragment) +fn fragment_main() { + atomicMax_92aa72(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicMax_92aa72(); +} diff --git a/test/tint/builtins/gen/var/atomicMax/92aa72.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicMax/92aa72.wgsl.expected.glsl new file mode 100644 index 0000000000..326e6edf3b --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMax/92aa72.wgsl.expected.glsl @@ -0,0 +1,46 @@ +#version 310 es +precision mediump float; + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + int arg_0; +} sb_rw; +void atomicMax_92aa72() { + int arg_1 = 1; + int res = atomicMax(sb_rw.arg_0, arg_1); +} + +void fragment_main() { + atomicMax_92aa72(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + int arg_0; +} sb_rw; +void atomicMax_92aa72() { + int arg_1 = 1; + int res = atomicMax(sb_rw.arg_0, arg_1); +} + +void compute_main() { + atomicMax_92aa72(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicMax/92aa72.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicMax/92aa72.wgsl.expected.hlsl new file mode 100644 index 0000000000..a649f98afb --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMax/92aa72.wgsl.expected.hlsl @@ -0,0 +1,24 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicMax(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedMax(offset, value, original_value); + return original_value; +} + + +void atomicMax_92aa72() { + int arg_1 = 1; + int res = tint_atomicMax(sb_rw, 0u, arg_1); +} + +void fragment_main() { + atomicMax_92aa72(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicMax_92aa72(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicMax/92aa72.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicMax/92aa72.wgsl.expected.msl new file mode 100644 index 0000000000..9fefd97c6b --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMax/92aa72.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +struct SB_RW { + /* 0x0000 */ atomic_int arg_0; +}; + +void atomicMax_92aa72(device SB_RW* const tint_symbol) { + int arg_1 = 1; + int res = atomic_fetch_max_explicit(&((*(tint_symbol)).arg_0), arg_1, memory_order_relaxed); +} + +fragment void fragment_main(device SB_RW* tint_symbol_1 [[buffer(0)]]) { + atomicMax_92aa72(tint_symbol_1); + return; +} + +kernel void compute_main(device SB_RW* tint_symbol_2 [[buffer(0)]]) { + atomicMax_92aa72(tint_symbol_2); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicMax/92aa72.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicMax/92aa72.wgsl.expected.spvasm new file mode 100644 index 0000000000..e6ff30ef3a --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMax/92aa72.wgsl.expected.spvasm @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 28 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicMax_92aa72 "atomicMax_92aa72" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %int = OpTypeInt 32 1 + %SB_RW = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %12 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int +%atomicMax_92aa72 = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %12 + %res = OpVariable %_ptr_Function_int Function %12 + OpStore %arg_1 %int_1 + %19 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %20 = OpLoad %int %arg_1 + %13 = OpAtomicSMax %int %19 %uint_1 %uint_0 %20 + OpStore %res %13 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %23 = OpLabel + %24 = OpFunctionCall %void %atomicMax_92aa72 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %26 = OpLabel + %27 = OpFunctionCall %void %atomicMax_92aa72 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicMax/92aa72.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicMax/92aa72.wgsl.expected.wgsl new file mode 100644 index 0000000000..488bf5a856 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMax/92aa72.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +struct SB_RW { + arg_0 : atomic, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn atomicMax_92aa72() { + var arg_1 = 1; + var res : i32 = atomicMax(&(sb_rw.arg_0), arg_1); +} + +@stage(fragment) +fn fragment_main() { + atomicMax_92aa72(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicMax_92aa72(); +} diff --git a/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl b/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl new file mode 100644 index 0000000000..8d3a68072e --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl @@ -0,0 +1,36 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +var arg_0: atomic; + +// fn atomicMax(ptr, read_write>, i32) -> i32 +fn atomicMax_a89cc3() { + var arg_1 = 1; + var res: i32 = atomicMax(&arg_0, arg_1); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicMax_a89cc3(); +} diff --git a/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.glsl new file mode 100644 index 0000000000..cfc9b4f608 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.glsl @@ -0,0 +1,21 @@ +#version 310 es + +shared int arg_0; +void atomicMax_a89cc3() { + int arg_1 = 1; + int res = atomicMax(arg_0, arg_1); +} + +void compute_main(uint local_invocation_index) { + { + atomicExchange(arg_0, 0); + } + barrier(); + atomicMax_a89cc3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.hlsl new file mode 100644 index 0000000000..5f4f6cb431 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.hlsl @@ -0,0 +1,27 @@ +groupshared int arg_0; + +void atomicMax_a89cc3() { + int arg_1 = 1; + int atomic_result = 0; + InterlockedMax(arg_0, arg_1, atomic_result); + int res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicMax_a89cc3(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.msl new file mode 100644 index 0000000000..a067fcd7c2 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +void atomicMax_a89cc3(threadgroup atomic_int* const tint_symbol) { + int arg_1 = 1; + int res = atomic_fetch_max_explicit(tint_symbol, arg_1, memory_order_relaxed); +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) { + { + atomic_store_explicit(tint_symbol_1, 0, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicMax_a89cc3(tint_symbol_1); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup atomic_int tint_symbol_2; + compute_main_inner(local_invocation_index, &(tint_symbol_2)); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.spvasm new file mode 100644 index 0000000000..2864a14479 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.spvasm @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicMax_a89cc3 "atomicMax_a89cc3" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %7 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %14 = OpConstantNull %int + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %21 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicMax_a89cc3 = OpFunction %void None %7 + %10 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %14 + %res = OpVariable %_ptr_Function_int Function %14 + OpStore %arg_1 %int_1 + %19 = OpLoad %int %arg_1 + %15 = OpAtomicSMax %int %arg_0 %uint_2 %uint_0 %19 + OpStore %res %15 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %21 +%local_invocation_index = OpFunctionParameter %uint + %24 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %29 = OpFunctionCall %void %atomicMax_a89cc3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %7 + %31 = OpLabel + %33 = OpLoad %uint %local_invocation_index_1 + %32 = OpFunctionCall %void %compute_main_inner %33 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.wgsl new file mode 100644 index 0000000000..73ba0bae84 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.wgsl @@ -0,0 +1,11 @@ +var arg_0 : atomic; + +fn atomicMax_a89cc3() { + var arg_1 = 1; + var res : i32 = atomicMax(&(arg_0), arg_1); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicMax_a89cc3(); +} diff --git a/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl b/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl new file mode 100644 index 0000000000..8550e0e682 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl @@ -0,0 +1,36 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +var arg_0: atomic; + +// fn atomicMax(ptr, read_write>, u32) -> u32 +fn atomicMax_beccfc() { + var arg_1 = 1u; + var res: u32 = atomicMax(&arg_0, arg_1); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicMax_beccfc(); +} diff --git a/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.glsl new file mode 100644 index 0000000000..b68a3e2163 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.glsl @@ -0,0 +1,21 @@ +#version 310 es + +shared uint arg_0; +void atomicMax_beccfc() { + uint arg_1 = 1u; + uint res = atomicMax(arg_0, arg_1); +} + +void compute_main(uint local_invocation_index) { + { + atomicExchange(arg_0, 0u); + } + barrier(); + atomicMax_beccfc(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.hlsl new file mode 100644 index 0000000000..acdda2c11f --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.hlsl @@ -0,0 +1,27 @@ +groupshared uint arg_0; + +void atomicMax_beccfc() { + uint arg_1 = 1u; + uint atomic_result = 0u; + InterlockedMax(arg_0, arg_1, atomic_result); + uint res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicMax_beccfc(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.msl new file mode 100644 index 0000000000..96c5d283a2 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +void atomicMax_beccfc(threadgroup atomic_uint* const tint_symbol) { + uint arg_1 = 1u; + uint res = atomic_fetch_max_explicit(tint_symbol, arg_1, memory_order_relaxed); +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) { + { + atomic_store_explicit(tint_symbol_1, 0u, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicMax_beccfc(tint_symbol_1); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup atomic_uint tint_symbol_2; + compute_main_inner(local_invocation_index, &(tint_symbol_2)); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.spvasm new file mode 100644 index 0000000000..03577ee568 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.spvasm @@ -0,0 +1,56 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicMax_beccfc "atomicMax_beccfc" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %6 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %13 = OpConstantNull %uint + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %20 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicMax_beccfc = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %13 + %res = OpVariable %_ptr_Function_uint Function %13 + OpStore %arg_1 %uint_1 + %18 = OpLoad %uint %arg_1 + %14 = OpAtomicUMax %uint %arg_0 %uint_2 %uint_0 %18 + OpStore %res %14 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %20 +%local_invocation_index = OpFunctionParameter %uint + %23 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %13 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %28 = OpFunctionCall %void %atomicMax_beccfc + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %6 + %30 = OpLabel + %32 = OpLoad %uint %local_invocation_index_1 + %31 = OpFunctionCall %void %compute_main_inner %32 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.wgsl new file mode 100644 index 0000000000..8faab2f6f9 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.wgsl @@ -0,0 +1,11 @@ +var arg_0 : atomic; + +fn atomicMax_beccfc() { + var arg_1 = 1u; + var res : u32 = atomicMax(&(arg_0), arg_1); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicMax_beccfc(); +} diff --git a/test/tint/builtins/gen/var/atomicMin/278235.wgsl b/test/tint/builtins/gen/var/atomicMin/278235.wgsl new file mode 100644 index 0000000000..b3f15cbc81 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMin/278235.wgsl @@ -0,0 +1,36 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +var arg_0: atomic; + +// fn atomicMin(ptr, read_write>, i32) -> i32 +fn atomicMin_278235() { + var arg_1 = 1; + var res: i32 = atomicMin(&arg_0, arg_1); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicMin_278235(); +} diff --git a/test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.glsl new file mode 100644 index 0000000000..e27c1f1348 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.glsl @@ -0,0 +1,21 @@ +#version 310 es + +shared int arg_0; +void atomicMin_278235() { + int arg_1 = 1; + int res = atomicMin(arg_0, arg_1); +} + +void compute_main(uint local_invocation_index) { + { + atomicExchange(arg_0, 0); + } + barrier(); + atomicMin_278235(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.hlsl new file mode 100644 index 0000000000..06c49cd013 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.hlsl @@ -0,0 +1,27 @@ +groupshared int arg_0; + +void atomicMin_278235() { + int arg_1 = 1; + int atomic_result = 0; + InterlockedMin(arg_0, arg_1, atomic_result); + int res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicMin_278235(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.msl new file mode 100644 index 0000000000..8443629b2a --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +void atomicMin_278235(threadgroup atomic_int* const tint_symbol) { + int arg_1 = 1; + int res = atomic_fetch_min_explicit(tint_symbol, arg_1, memory_order_relaxed); +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) { + { + atomic_store_explicit(tint_symbol_1, 0, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicMin_278235(tint_symbol_1); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup atomic_int tint_symbol_2; + compute_main_inner(local_invocation_index, &(tint_symbol_2)); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.spvasm new file mode 100644 index 0000000000..ddfa25a7f9 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.spvasm @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicMin_278235 "atomicMin_278235" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %7 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %14 = OpConstantNull %int + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %21 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicMin_278235 = OpFunction %void None %7 + %10 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %14 + %res = OpVariable %_ptr_Function_int Function %14 + OpStore %arg_1 %int_1 + %19 = OpLoad %int %arg_1 + %15 = OpAtomicSMin %int %arg_0 %uint_2 %uint_0 %19 + OpStore %res %15 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %21 +%local_invocation_index = OpFunctionParameter %uint + %24 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %29 = OpFunctionCall %void %atomicMin_278235 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %7 + %31 = OpLabel + %33 = OpLoad %uint %local_invocation_index_1 + %32 = OpFunctionCall %void %compute_main_inner %33 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.wgsl new file mode 100644 index 0000000000..b0a24df5fb --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.wgsl @@ -0,0 +1,11 @@ +var arg_0 : atomic; + +fn atomicMin_278235() { + var arg_1 = 1; + var res : i32 = atomicMin(&(arg_0), arg_1); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicMin_278235(); +} diff --git a/test/tint/builtins/gen/var/atomicMin/69d383.wgsl b/test/tint/builtins/gen/var/atomicMin/69d383.wgsl new file mode 100644 index 0000000000..c225e441cd --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMin/69d383.wgsl @@ -0,0 +1,36 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +var arg_0: atomic; + +// fn atomicMin(ptr, read_write>, u32) -> u32 +fn atomicMin_69d383() { + var arg_1 = 1u; + var res: u32 = atomicMin(&arg_0, arg_1); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicMin_69d383(); +} diff --git a/test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.glsl new file mode 100644 index 0000000000..c14fbe6b79 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.glsl @@ -0,0 +1,21 @@ +#version 310 es + +shared uint arg_0; +void atomicMin_69d383() { + uint arg_1 = 1u; + uint res = atomicMin(arg_0, arg_1); +} + +void compute_main(uint local_invocation_index) { + { + atomicExchange(arg_0, 0u); + } + barrier(); + atomicMin_69d383(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.hlsl new file mode 100644 index 0000000000..1c16fc8ba1 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.hlsl @@ -0,0 +1,27 @@ +groupshared uint arg_0; + +void atomicMin_69d383() { + uint arg_1 = 1u; + uint atomic_result = 0u; + InterlockedMin(arg_0, arg_1, atomic_result); + uint res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicMin_69d383(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.msl new file mode 100644 index 0000000000..c04290f7a2 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +void atomicMin_69d383(threadgroup atomic_uint* const tint_symbol) { + uint arg_1 = 1u; + uint res = atomic_fetch_min_explicit(tint_symbol, arg_1, memory_order_relaxed); +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) { + { + atomic_store_explicit(tint_symbol_1, 0u, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicMin_69d383(tint_symbol_1); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup atomic_uint tint_symbol_2; + compute_main_inner(local_invocation_index, &(tint_symbol_2)); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.spvasm new file mode 100644 index 0000000000..784a0143e3 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.spvasm @@ -0,0 +1,56 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicMin_69d383 "atomicMin_69d383" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %6 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %13 = OpConstantNull %uint + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %20 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicMin_69d383 = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %13 + %res = OpVariable %_ptr_Function_uint Function %13 + OpStore %arg_1 %uint_1 + %18 = OpLoad %uint %arg_1 + %14 = OpAtomicUMin %uint %arg_0 %uint_2 %uint_0 %18 + OpStore %res %14 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %20 +%local_invocation_index = OpFunctionParameter %uint + %23 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %13 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %28 = OpFunctionCall %void %atomicMin_69d383 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %6 + %30 = OpLabel + %32 = OpLoad %uint %local_invocation_index_1 + %31 = OpFunctionCall %void %compute_main_inner %32 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.wgsl new file mode 100644 index 0000000000..319c9cd06b --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.wgsl @@ -0,0 +1,11 @@ +var arg_0 : atomic; + +fn atomicMin_69d383() { + var arg_1 = 1u; + var res : u32 = atomicMin(&(arg_0), arg_1); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicMin_69d383(); +} diff --git a/test/tint/builtins/gen/var/atomicMin/8e38dc.wgsl b/test/tint/builtins/gen/var/atomicMin/8e38dc.wgsl new file mode 100644 index 0000000000..283645af35 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMin/8e38dc.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: atomic, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn atomicMin(ptr, read_write>, i32) -> i32 +fn atomicMin_8e38dc() { + var arg_1 = 1; + var res: i32 = atomicMin(&sb_rw.arg_0, arg_1); +} + +@stage(fragment) +fn fragment_main() { + atomicMin_8e38dc(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicMin_8e38dc(); +} diff --git a/test/tint/builtins/gen/var/atomicMin/8e38dc.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicMin/8e38dc.wgsl.expected.glsl new file mode 100644 index 0000000000..215a335101 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMin/8e38dc.wgsl.expected.glsl @@ -0,0 +1,46 @@ +#version 310 es +precision mediump float; + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + int arg_0; +} sb_rw; +void atomicMin_8e38dc() { + int arg_1 = 1; + int res = atomicMin(sb_rw.arg_0, arg_1); +} + +void fragment_main() { + atomicMin_8e38dc(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + int arg_0; +} sb_rw; +void atomicMin_8e38dc() { + int arg_1 = 1; + int res = atomicMin(sb_rw.arg_0, arg_1); +} + +void compute_main() { + atomicMin_8e38dc(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicMin/8e38dc.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicMin/8e38dc.wgsl.expected.hlsl new file mode 100644 index 0000000000..ff4793b2c5 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMin/8e38dc.wgsl.expected.hlsl @@ -0,0 +1,24 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicMin(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedMin(offset, value, original_value); + return original_value; +} + + +void atomicMin_8e38dc() { + int arg_1 = 1; + int res = tint_atomicMin(sb_rw, 0u, arg_1); +} + +void fragment_main() { + atomicMin_8e38dc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicMin_8e38dc(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicMin/8e38dc.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicMin/8e38dc.wgsl.expected.msl new file mode 100644 index 0000000000..d670f6f671 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMin/8e38dc.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +struct SB_RW { + /* 0x0000 */ atomic_int arg_0; +}; + +void atomicMin_8e38dc(device SB_RW* const tint_symbol) { + int arg_1 = 1; + int res = atomic_fetch_min_explicit(&((*(tint_symbol)).arg_0), arg_1, memory_order_relaxed); +} + +fragment void fragment_main(device SB_RW* tint_symbol_1 [[buffer(0)]]) { + atomicMin_8e38dc(tint_symbol_1); + return; +} + +kernel void compute_main(device SB_RW* tint_symbol_2 [[buffer(0)]]) { + atomicMin_8e38dc(tint_symbol_2); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicMin/8e38dc.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicMin/8e38dc.wgsl.expected.spvasm new file mode 100644 index 0000000000..f2ca9b8e59 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMin/8e38dc.wgsl.expected.spvasm @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 28 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicMin_8e38dc "atomicMin_8e38dc" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %int = OpTypeInt 32 1 + %SB_RW = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %12 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int +%atomicMin_8e38dc = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %12 + %res = OpVariable %_ptr_Function_int Function %12 + OpStore %arg_1 %int_1 + %19 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %20 = OpLoad %int %arg_1 + %13 = OpAtomicSMin %int %19 %uint_1 %uint_0 %20 + OpStore %res %13 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %23 = OpLabel + %24 = OpFunctionCall %void %atomicMin_8e38dc + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %26 = OpLabel + %27 = OpFunctionCall %void %atomicMin_8e38dc + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicMin/8e38dc.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicMin/8e38dc.wgsl.expected.wgsl new file mode 100644 index 0000000000..20955bd4f9 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMin/8e38dc.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +struct SB_RW { + arg_0 : atomic, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn atomicMin_8e38dc() { + var arg_1 = 1; + var res : i32 = atomicMin(&(sb_rw.arg_0), arg_1); +} + +@stage(fragment) +fn fragment_main() { + atomicMin_8e38dc(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicMin_8e38dc(); +} diff --git a/test/tint/builtins/gen/var/atomicMin/c67a74.wgsl b/test/tint/builtins/gen/var/atomicMin/c67a74.wgsl new file mode 100644 index 0000000000..6975d3dbf2 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMin/c67a74.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: atomic, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn atomicMin(ptr, read_write>, u32) -> u32 +fn atomicMin_c67a74() { + var arg_1 = 1u; + var res: u32 = atomicMin(&sb_rw.arg_0, arg_1); +} + +@stage(fragment) +fn fragment_main() { + atomicMin_c67a74(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicMin_c67a74(); +} diff --git a/test/tint/builtins/gen/var/atomicMin/c67a74.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicMin/c67a74.wgsl.expected.glsl new file mode 100644 index 0000000000..4d5b79bf23 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMin/c67a74.wgsl.expected.glsl @@ -0,0 +1,46 @@ +#version 310 es +precision mediump float; + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + uint arg_0; +} sb_rw; +void atomicMin_c67a74() { + uint arg_1 = 1u; + uint res = atomicMin(sb_rw.arg_0, arg_1); +} + +void fragment_main() { + atomicMin_c67a74(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + uint arg_0; +} sb_rw; +void atomicMin_c67a74() { + uint arg_1 = 1u; + uint res = atomicMin(sb_rw.arg_0, arg_1); +} + +void compute_main() { + atomicMin_c67a74(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicMin/c67a74.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicMin/c67a74.wgsl.expected.hlsl new file mode 100644 index 0000000000..ae974e3f7a --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMin/c67a74.wgsl.expected.hlsl @@ -0,0 +1,24 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicMin(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedMin(offset, value, original_value); + return original_value; +} + + +void atomicMin_c67a74() { + uint arg_1 = 1u; + uint res = tint_atomicMin(sb_rw, 0u, arg_1); +} + +void fragment_main() { + atomicMin_c67a74(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicMin_c67a74(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicMin/c67a74.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicMin/c67a74.wgsl.expected.msl new file mode 100644 index 0000000000..86f2cf2db9 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMin/c67a74.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +struct SB_RW { + /* 0x0000 */ atomic_uint arg_0; +}; + +void atomicMin_c67a74(device SB_RW* const tint_symbol) { + uint arg_1 = 1u; + uint res = atomic_fetch_min_explicit(&((*(tint_symbol)).arg_0), arg_1, memory_order_relaxed); +} + +fragment void fragment_main(device SB_RW* tint_symbol_1 [[buffer(0)]]) { + atomicMin_c67a74(tint_symbol_1); + return; +} + +kernel void compute_main(device SB_RW* tint_symbol_2 [[buffer(0)]]) { + atomicMin_c67a74(tint_symbol_2); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicMin/c67a74.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicMin/c67a74.wgsl.expected.spvasm new file mode 100644 index 0000000000..f3cc67b6e6 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMin/c67a74.wgsl.expected.spvasm @@ -0,0 +1,55 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicMin_c67a74 "atomicMin_c67a74" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %uint = OpTypeInt 32 0 + %SB_RW = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %12 = OpConstantNull %uint + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%atomicMin_c67a74 = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %12 + %res = OpVariable %_ptr_Function_uint Function %12 + OpStore %arg_1 %uint_1 + %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %18 = OpLoad %uint %arg_1 + %13 = OpAtomicUMin %uint %17 %uint_1 %uint_0 %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %21 = OpLabel + %22 = OpFunctionCall %void %atomicMin_c67a74 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %24 = OpLabel + %25 = OpFunctionCall %void %atomicMin_c67a74 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicMin/c67a74.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicMin/c67a74.wgsl.expected.wgsl new file mode 100644 index 0000000000..eeb2d0ec33 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMin/c67a74.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +struct SB_RW { + arg_0 : atomic, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn atomicMin_c67a74() { + var arg_1 = 1u; + var res : u32 = atomicMin(&(sb_rw.arg_0), arg_1); +} + +@stage(fragment) +fn fragment_main() { + atomicMin_c67a74(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicMin_c67a74(); +} diff --git a/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl b/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl new file mode 100644 index 0000000000..e6ca7e85f2 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl @@ -0,0 +1,36 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +var arg_0: atomic; + +// fn atomicOr(ptr, read_write>, u32) -> u32 +fn atomicOr_5e3d61() { + var arg_1 = 1u; + var res: u32 = atomicOr(&arg_0, arg_1); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicOr_5e3d61(); +} diff --git a/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.glsl new file mode 100644 index 0000000000..23ddd2e722 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.glsl @@ -0,0 +1,21 @@ +#version 310 es + +shared uint arg_0; +void atomicOr_5e3d61() { + uint arg_1 = 1u; + uint res = atomicOr(arg_0, arg_1); +} + +void compute_main(uint local_invocation_index) { + { + atomicExchange(arg_0, 0u); + } + barrier(); + atomicOr_5e3d61(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.hlsl new file mode 100644 index 0000000000..80cf20e811 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.hlsl @@ -0,0 +1,27 @@ +groupshared uint arg_0; + +void atomicOr_5e3d61() { + uint arg_1 = 1u; + uint atomic_result = 0u; + InterlockedOr(arg_0, arg_1, atomic_result); + uint res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicOr_5e3d61(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.msl new file mode 100644 index 0000000000..0801fc9e4e --- /dev/null +++ b/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +void atomicOr_5e3d61(threadgroup atomic_uint* const tint_symbol) { + uint arg_1 = 1u; + uint res = atomic_fetch_or_explicit(tint_symbol, arg_1, memory_order_relaxed); +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) { + { + atomic_store_explicit(tint_symbol_1, 0u, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicOr_5e3d61(tint_symbol_1); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup atomic_uint tint_symbol_2; + compute_main_inner(local_invocation_index, &(tint_symbol_2)); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.spvasm new file mode 100644 index 0000000000..9db7191d2f --- /dev/null +++ b/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.spvasm @@ -0,0 +1,56 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicOr_5e3d61 "atomicOr_5e3d61" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %6 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %13 = OpConstantNull %uint + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %20 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicOr_5e3d61 = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %13 + %res = OpVariable %_ptr_Function_uint Function %13 + OpStore %arg_1 %uint_1 + %18 = OpLoad %uint %arg_1 + %14 = OpAtomicOr %uint %arg_0 %uint_2 %uint_0 %18 + OpStore %res %14 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %20 +%local_invocation_index = OpFunctionParameter %uint + %23 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %13 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %28 = OpFunctionCall %void %atomicOr_5e3d61 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %6 + %30 = OpLabel + %32 = OpLoad %uint %local_invocation_index_1 + %31 = OpFunctionCall %void %compute_main_inner %32 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.wgsl new file mode 100644 index 0000000000..e1b1d1c924 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.wgsl @@ -0,0 +1,11 @@ +var arg_0 : atomic; + +fn atomicOr_5e3d61() { + var arg_1 = 1u; + var res : u32 = atomicOr(&(arg_0), arg_1); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicOr_5e3d61(); +} diff --git a/test/tint/builtins/gen/var/atomicOr/5e95d4.wgsl b/test/tint/builtins/gen/var/atomicOr/5e95d4.wgsl new file mode 100644 index 0000000000..874d94a4b7 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicOr/5e95d4.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: atomic, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn atomicOr(ptr, read_write>, u32) -> u32 +fn atomicOr_5e95d4() { + var arg_1 = 1u; + var res: u32 = atomicOr(&sb_rw.arg_0, arg_1); +} + +@stage(fragment) +fn fragment_main() { + atomicOr_5e95d4(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicOr_5e95d4(); +} diff --git a/test/tint/builtins/gen/var/atomicOr/5e95d4.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicOr/5e95d4.wgsl.expected.glsl new file mode 100644 index 0000000000..ddd41fedb0 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicOr/5e95d4.wgsl.expected.glsl @@ -0,0 +1,46 @@ +#version 310 es +precision mediump float; + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + uint arg_0; +} sb_rw; +void atomicOr_5e95d4() { + uint arg_1 = 1u; + uint res = atomicOr(sb_rw.arg_0, arg_1); +} + +void fragment_main() { + atomicOr_5e95d4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + uint arg_0; +} sb_rw; +void atomicOr_5e95d4() { + uint arg_1 = 1u; + uint res = atomicOr(sb_rw.arg_0, arg_1); +} + +void compute_main() { + atomicOr_5e95d4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicOr/5e95d4.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicOr/5e95d4.wgsl.expected.hlsl new file mode 100644 index 0000000000..2df87d268b --- /dev/null +++ b/test/tint/builtins/gen/var/atomicOr/5e95d4.wgsl.expected.hlsl @@ -0,0 +1,24 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicOr(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedOr(offset, value, original_value); + return original_value; +} + + +void atomicOr_5e95d4() { + uint arg_1 = 1u; + uint res = tint_atomicOr(sb_rw, 0u, arg_1); +} + +void fragment_main() { + atomicOr_5e95d4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicOr_5e95d4(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicOr/5e95d4.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicOr/5e95d4.wgsl.expected.msl new file mode 100644 index 0000000000..f6a899e24b --- /dev/null +++ b/test/tint/builtins/gen/var/atomicOr/5e95d4.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +struct SB_RW { + /* 0x0000 */ atomic_uint arg_0; +}; + +void atomicOr_5e95d4(device SB_RW* const tint_symbol) { + uint arg_1 = 1u; + uint res = atomic_fetch_or_explicit(&((*(tint_symbol)).arg_0), arg_1, memory_order_relaxed); +} + +fragment void fragment_main(device SB_RW* tint_symbol_1 [[buffer(0)]]) { + atomicOr_5e95d4(tint_symbol_1); + return; +} + +kernel void compute_main(device SB_RW* tint_symbol_2 [[buffer(0)]]) { + atomicOr_5e95d4(tint_symbol_2); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicOr/5e95d4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicOr/5e95d4.wgsl.expected.spvasm new file mode 100644 index 0000000000..c38fc528ec --- /dev/null +++ b/test/tint/builtins/gen/var/atomicOr/5e95d4.wgsl.expected.spvasm @@ -0,0 +1,55 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicOr_5e95d4 "atomicOr_5e95d4" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %uint = OpTypeInt 32 0 + %SB_RW = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %12 = OpConstantNull %uint + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%atomicOr_5e95d4 = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %12 + %res = OpVariable %_ptr_Function_uint Function %12 + OpStore %arg_1 %uint_1 + %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %18 = OpLoad %uint %arg_1 + %13 = OpAtomicOr %uint %17 %uint_1 %uint_0 %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %21 = OpLabel + %22 = OpFunctionCall %void %atomicOr_5e95d4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %24 = OpLabel + %25 = OpFunctionCall %void %atomicOr_5e95d4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicOr/5e95d4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicOr/5e95d4.wgsl.expected.wgsl new file mode 100644 index 0000000000..c4407a3431 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicOr/5e95d4.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +struct SB_RW { + arg_0 : atomic, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn atomicOr_5e95d4() { + var arg_1 = 1u; + var res : u32 = atomicOr(&(sb_rw.arg_0), arg_1); +} + +@stage(fragment) +fn fragment_main() { + atomicOr_5e95d4(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicOr_5e95d4(); +} diff --git a/test/tint/builtins/gen/var/atomicOr/8d96a0.wgsl b/test/tint/builtins/gen/var/atomicOr/8d96a0.wgsl new file mode 100644 index 0000000000..80c6328e19 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicOr/8d96a0.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: atomic, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn atomicOr(ptr, read_write>, i32) -> i32 +fn atomicOr_8d96a0() { + var arg_1 = 1; + var res: i32 = atomicOr(&sb_rw.arg_0, arg_1); +} + +@stage(fragment) +fn fragment_main() { + atomicOr_8d96a0(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicOr_8d96a0(); +} diff --git a/test/tint/builtins/gen/var/atomicOr/8d96a0.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicOr/8d96a0.wgsl.expected.glsl new file mode 100644 index 0000000000..237e6b0b54 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicOr/8d96a0.wgsl.expected.glsl @@ -0,0 +1,46 @@ +#version 310 es +precision mediump float; + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + int arg_0; +} sb_rw; +void atomicOr_8d96a0() { + int arg_1 = 1; + int res = atomicOr(sb_rw.arg_0, arg_1); +} + +void fragment_main() { + atomicOr_8d96a0(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + int arg_0; +} sb_rw; +void atomicOr_8d96a0() { + int arg_1 = 1; + int res = atomicOr(sb_rw.arg_0, arg_1); +} + +void compute_main() { + atomicOr_8d96a0(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicOr/8d96a0.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicOr/8d96a0.wgsl.expected.hlsl new file mode 100644 index 0000000000..b3d4bb9f5d --- /dev/null +++ b/test/tint/builtins/gen/var/atomicOr/8d96a0.wgsl.expected.hlsl @@ -0,0 +1,24 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicOr(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedOr(offset, value, original_value); + return original_value; +} + + +void atomicOr_8d96a0() { + int arg_1 = 1; + int res = tint_atomicOr(sb_rw, 0u, arg_1); +} + +void fragment_main() { + atomicOr_8d96a0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicOr_8d96a0(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicOr/8d96a0.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicOr/8d96a0.wgsl.expected.msl new file mode 100644 index 0000000000..e21e22d1a8 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicOr/8d96a0.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +struct SB_RW { + /* 0x0000 */ atomic_int arg_0; +}; + +void atomicOr_8d96a0(device SB_RW* const tint_symbol) { + int arg_1 = 1; + int res = atomic_fetch_or_explicit(&((*(tint_symbol)).arg_0), arg_1, memory_order_relaxed); +} + +fragment void fragment_main(device SB_RW* tint_symbol_1 [[buffer(0)]]) { + atomicOr_8d96a0(tint_symbol_1); + return; +} + +kernel void compute_main(device SB_RW* tint_symbol_2 [[buffer(0)]]) { + atomicOr_8d96a0(tint_symbol_2); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicOr/8d96a0.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicOr/8d96a0.wgsl.expected.spvasm new file mode 100644 index 0000000000..978e4ad7b2 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicOr/8d96a0.wgsl.expected.spvasm @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 28 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicOr_8d96a0 "atomicOr_8d96a0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %int = OpTypeInt 32 1 + %SB_RW = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %12 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int +%atomicOr_8d96a0 = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %12 + %res = OpVariable %_ptr_Function_int Function %12 + OpStore %arg_1 %int_1 + %19 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %20 = OpLoad %int %arg_1 + %13 = OpAtomicOr %int %19 %uint_1 %uint_0 %20 + OpStore %res %13 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %23 = OpLabel + %24 = OpFunctionCall %void %atomicOr_8d96a0 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %26 = OpLabel + %27 = OpFunctionCall %void %atomicOr_8d96a0 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicOr/8d96a0.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicOr/8d96a0.wgsl.expected.wgsl new file mode 100644 index 0000000000..44a5caa696 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicOr/8d96a0.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +struct SB_RW { + arg_0 : atomic, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn atomicOr_8d96a0() { + var arg_1 = 1; + var res : i32 = atomicOr(&(sb_rw.arg_0), arg_1); +} + +@stage(fragment) +fn fragment_main() { + atomicOr_8d96a0(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicOr_8d96a0(); +} diff --git a/test/tint/builtins/gen/var/atomicOr/d09248.wgsl b/test/tint/builtins/gen/var/atomicOr/d09248.wgsl new file mode 100644 index 0000000000..08cbf8921d --- /dev/null +++ b/test/tint/builtins/gen/var/atomicOr/d09248.wgsl @@ -0,0 +1,36 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +var arg_0: atomic; + +// fn atomicOr(ptr, read_write>, i32) -> i32 +fn atomicOr_d09248() { + var arg_1 = 1; + var res: i32 = atomicOr(&arg_0, arg_1); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicOr_d09248(); +} diff --git a/test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.glsl new file mode 100644 index 0000000000..d601550281 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.glsl @@ -0,0 +1,21 @@ +#version 310 es + +shared int arg_0; +void atomicOr_d09248() { + int arg_1 = 1; + int res = atomicOr(arg_0, arg_1); +} + +void compute_main(uint local_invocation_index) { + { + atomicExchange(arg_0, 0); + } + barrier(); + atomicOr_d09248(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.hlsl new file mode 100644 index 0000000000..04e7f92200 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.hlsl @@ -0,0 +1,27 @@ +groupshared int arg_0; + +void atomicOr_d09248() { + int arg_1 = 1; + int atomic_result = 0; + InterlockedOr(arg_0, arg_1, atomic_result); + int res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicOr_d09248(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.msl new file mode 100644 index 0000000000..7569a487d4 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +void atomicOr_d09248(threadgroup atomic_int* const tint_symbol) { + int arg_1 = 1; + int res = atomic_fetch_or_explicit(tint_symbol, arg_1, memory_order_relaxed); +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) { + { + atomic_store_explicit(tint_symbol_1, 0, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicOr_d09248(tint_symbol_1); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup atomic_int tint_symbol_2; + compute_main_inner(local_invocation_index, &(tint_symbol_2)); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.spvasm new file mode 100644 index 0000000000..6a5541c37d --- /dev/null +++ b/test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.spvasm @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicOr_d09248 "atomicOr_d09248" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %7 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %14 = OpConstantNull %int + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %21 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicOr_d09248 = OpFunction %void None %7 + %10 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %14 + %res = OpVariable %_ptr_Function_int Function %14 + OpStore %arg_1 %int_1 + %19 = OpLoad %int %arg_1 + %15 = OpAtomicOr %int %arg_0 %uint_2 %uint_0 %19 + OpStore %res %15 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %21 +%local_invocation_index = OpFunctionParameter %uint + %24 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %29 = OpFunctionCall %void %atomicOr_d09248 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %7 + %31 = OpLabel + %33 = OpLoad %uint %local_invocation_index_1 + %32 = OpFunctionCall %void %compute_main_inner %33 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.wgsl new file mode 100644 index 0000000000..e5d8f51192 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.wgsl @@ -0,0 +1,11 @@ +var arg_0 : atomic; + +fn atomicOr_d09248() { + var arg_1 = 1; + var res : i32 = atomicOr(&(arg_0), arg_1); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicOr_d09248(); +} diff --git a/test/tint/builtins/gen/var/atomicStore/726882.wgsl b/test/tint/builtins/gen/var/atomicStore/726882.wgsl new file mode 100644 index 0000000000..64735cb7bc --- /dev/null +++ b/test/tint/builtins/gen/var/atomicStore/726882.wgsl @@ -0,0 +1,36 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +var arg_0: atomic; + +// fn atomicStore(ptr, read_write>, u32) +fn atomicStore_726882() { + var arg_1 = 1u; + atomicStore(&arg_0, arg_1); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicStore_726882(); +} diff --git a/test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.glsl new file mode 100644 index 0000000000..96fecad817 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.glsl @@ -0,0 +1,21 @@ +#version 310 es + +shared uint arg_0; +void atomicStore_726882() { + uint arg_1 = 1u; + atomicExchange(arg_0, arg_1); +} + +void compute_main(uint local_invocation_index) { + { + atomicExchange(arg_0, 0u); + } + barrier(); + atomicStore_726882(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.hlsl new file mode 100644 index 0000000000..4bff9093d2 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.hlsl @@ -0,0 +1,26 @@ +groupshared uint arg_0; + +void atomicStore_726882() { + uint arg_1 = 1u; + uint atomic_result = 0u; + InterlockedExchange(arg_0, arg_1, atomic_result); +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicStore_726882(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.msl new file mode 100644 index 0000000000..a6a35a9da2 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +void atomicStore_726882(threadgroup atomic_uint* const tint_symbol) { + uint arg_1 = 1u; + atomic_store_explicit(tint_symbol, arg_1, memory_order_relaxed); +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) { + { + atomic_store_explicit(tint_symbol_1, 0u, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicStore_726882(tint_symbol_1); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup atomic_uint tint_symbol_2; + compute_main_inner(local_invocation_index, &(tint_symbol_2)); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.spvasm new file mode 100644 index 0000000000..72d2c5fc56 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.spvasm @@ -0,0 +1,53 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicStore_726882 "atomicStore_726882" + OpName %arg_1 "arg_1" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %6 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %13 = OpConstantNull %uint + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %19 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicStore_726882 = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %13 + OpStore %arg_1 %uint_1 + %18 = OpLoad %uint %arg_1 + OpAtomicStore %arg_0 %uint_2 %uint_0 %18 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %19 +%local_invocation_index = OpFunctionParameter %uint + %22 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %13 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %27 = OpFunctionCall %void %atomicStore_726882 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %6 + %29 = OpLabel + %31 = OpLoad %uint %local_invocation_index_1 + %30 = OpFunctionCall %void %compute_main_inner %31 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.wgsl new file mode 100644 index 0000000000..178d798dc7 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.wgsl @@ -0,0 +1,11 @@ +var arg_0 : atomic; + +fn atomicStore_726882() { + var arg_1 = 1u; + atomicStore(&(arg_0), arg_1); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicStore_726882(); +} diff --git a/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl b/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl new file mode 100644 index 0000000000..38caf4fc02 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl @@ -0,0 +1,36 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +var arg_0: atomic; + +// fn atomicStore(ptr, read_write>, i32) +fn atomicStore_8bea94() { + var arg_1 = 1; + atomicStore(&arg_0, arg_1); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicStore_8bea94(); +} diff --git a/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.glsl new file mode 100644 index 0000000000..c0d2497a4e --- /dev/null +++ b/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.glsl @@ -0,0 +1,21 @@ +#version 310 es + +shared int arg_0; +void atomicStore_8bea94() { + int arg_1 = 1; + atomicExchange(arg_0, arg_1); +} + +void compute_main(uint local_invocation_index) { + { + atomicExchange(arg_0, 0); + } + barrier(); + atomicStore_8bea94(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.hlsl new file mode 100644 index 0000000000..35781aba87 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.hlsl @@ -0,0 +1,26 @@ +groupshared int arg_0; + +void atomicStore_8bea94() { + int arg_1 = 1; + int atomic_result = 0; + InterlockedExchange(arg_0, arg_1, atomic_result); +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicStore_8bea94(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.msl new file mode 100644 index 0000000000..7a984c2a55 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +void atomicStore_8bea94(threadgroup atomic_int* const tint_symbol) { + int arg_1 = 1; + atomic_store_explicit(tint_symbol, arg_1, memory_order_relaxed); +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) { + { + atomic_store_explicit(tint_symbol_1, 0, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicStore_8bea94(tint_symbol_1); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup atomic_int tint_symbol_2; + compute_main_inner(local_invocation_index, &(tint_symbol_2)); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.spvasm new file mode 100644 index 0000000000..a0c7fb72f9 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.spvasm @@ -0,0 +1,54 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicStore_8bea94 "atomicStore_8bea94" + OpName %arg_1 "arg_1" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %7 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %14 = OpConstantNull %int + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %20 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicStore_8bea94 = OpFunction %void None %7 + %10 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %14 + OpStore %arg_1 %int_1 + %19 = OpLoad %int %arg_1 + OpAtomicStore %arg_0 %uint_2 %uint_0 %19 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %20 +%local_invocation_index = OpFunctionParameter %uint + %23 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %28 = OpFunctionCall %void %atomicStore_8bea94 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %7 + %30 = OpLabel + %32 = OpLoad %uint %local_invocation_index_1 + %31 = OpFunctionCall %void %compute_main_inner %32 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.wgsl new file mode 100644 index 0000000000..d68247e903 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.wgsl @@ -0,0 +1,11 @@ +var arg_0 : atomic; + +fn atomicStore_8bea94() { + var arg_1 = 1; + atomicStore(&(arg_0), arg_1); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicStore_8bea94(); +} diff --git a/test/tint/builtins/gen/var/atomicStore/cdc29e.wgsl b/test/tint/builtins/gen/var/atomicStore/cdc29e.wgsl new file mode 100644 index 0000000000..51e7e1cf39 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicStore/cdc29e.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: atomic, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn atomicStore(ptr, read_write>, u32) +fn atomicStore_cdc29e() { + var arg_1 = 1u; + atomicStore(&sb_rw.arg_0, arg_1); +} + +@stage(fragment) +fn fragment_main() { + atomicStore_cdc29e(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicStore_cdc29e(); +} diff --git a/test/tint/builtins/gen/var/atomicStore/cdc29e.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicStore/cdc29e.wgsl.expected.glsl new file mode 100644 index 0000000000..22fd7a19f1 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicStore/cdc29e.wgsl.expected.glsl @@ -0,0 +1,46 @@ +#version 310 es +precision mediump float; + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + uint arg_0; +} sb_rw; +void atomicStore_cdc29e() { + uint arg_1 = 1u; + atomicExchange(sb_rw.arg_0, arg_1); +} + +void fragment_main() { + atomicStore_cdc29e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + uint arg_0; +} sb_rw; +void atomicStore_cdc29e() { + uint arg_1 = 1u; + atomicExchange(sb_rw.arg_0, arg_1); +} + +void compute_main() { + atomicStore_cdc29e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicStore/cdc29e.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicStore/cdc29e.wgsl.expected.hlsl new file mode 100644 index 0000000000..253ad312c0 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicStore/cdc29e.wgsl.expected.hlsl @@ -0,0 +1,23 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +void tint_atomicStore(RWByteAddressBuffer buffer, uint offset, uint value) { + uint ignored; + buffer.InterlockedExchange(offset, value, ignored); +} + + +void atomicStore_cdc29e() { + uint arg_1 = 1u; + tint_atomicStore(sb_rw, 0u, arg_1); +} + +void fragment_main() { + atomicStore_cdc29e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicStore_cdc29e(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicStore/cdc29e.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicStore/cdc29e.wgsl.expected.msl new file mode 100644 index 0000000000..be5057e21f --- /dev/null +++ b/test/tint/builtins/gen/var/atomicStore/cdc29e.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +struct SB_RW { + /* 0x0000 */ atomic_uint arg_0; +}; + +void atomicStore_cdc29e(device SB_RW* const tint_symbol) { + uint arg_1 = 1u; + atomic_store_explicit(&((*(tint_symbol)).arg_0), arg_1, memory_order_relaxed); +} + +fragment void fragment_main(device SB_RW* tint_symbol_1 [[buffer(0)]]) { + atomicStore_cdc29e(tint_symbol_1); + return; +} + +kernel void compute_main(device SB_RW* tint_symbol_2 [[buffer(0)]]) { + atomicStore_cdc29e(tint_symbol_2); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicStore/cdc29e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicStore/cdc29e.wgsl.expected.spvasm new file mode 100644 index 0000000000..f0d74fe1cf --- /dev/null +++ b/test/tint/builtins/gen/var/atomicStore/cdc29e.wgsl.expected.spvasm @@ -0,0 +1,52 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 25 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicStore_cdc29e "atomicStore_cdc29e" + OpName %arg_1 "arg_1" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %uint = OpTypeInt 32 0 + %SB_RW = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %12 = OpConstantNull %uint + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%atomicStore_cdc29e = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %12 + OpStore %arg_1 %uint_1 + %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %18 = OpLoad %uint %arg_1 + OpAtomicStore %17 %uint_1 %uint_0 %18 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %20 = OpLabel + %21 = OpFunctionCall %void %atomicStore_cdc29e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %23 = OpLabel + %24 = OpFunctionCall %void %atomicStore_cdc29e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicStore/cdc29e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicStore/cdc29e.wgsl.expected.wgsl new file mode 100644 index 0000000000..32a546ba2a --- /dev/null +++ b/test/tint/builtins/gen/var/atomicStore/cdc29e.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +struct SB_RW { + arg_0 : atomic, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn atomicStore_cdc29e() { + var arg_1 = 1u; + atomicStore(&(sb_rw.arg_0), arg_1); +} + +@stage(fragment) +fn fragment_main() { + atomicStore_cdc29e(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicStore_cdc29e(); +} diff --git a/test/tint/builtins/gen/var/atomicStore/d1e9a6.wgsl b/test/tint/builtins/gen/var/atomicStore/d1e9a6.wgsl new file mode 100644 index 0000000000..80db8961f2 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicStore/d1e9a6.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: atomic, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn atomicStore(ptr, read_write>, i32) +fn atomicStore_d1e9a6() { + var arg_1 = 1; + atomicStore(&sb_rw.arg_0, arg_1); +} + +@stage(fragment) +fn fragment_main() { + atomicStore_d1e9a6(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicStore_d1e9a6(); +} diff --git a/test/tint/builtins/gen/var/atomicStore/d1e9a6.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicStore/d1e9a6.wgsl.expected.glsl new file mode 100644 index 0000000000..f5e52e4b19 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicStore/d1e9a6.wgsl.expected.glsl @@ -0,0 +1,46 @@ +#version 310 es +precision mediump float; + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + int arg_0; +} sb_rw; +void atomicStore_d1e9a6() { + int arg_1 = 1; + atomicExchange(sb_rw.arg_0, arg_1); +} + +void fragment_main() { + atomicStore_d1e9a6(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + int arg_0; +} sb_rw; +void atomicStore_d1e9a6() { + int arg_1 = 1; + atomicExchange(sb_rw.arg_0, arg_1); +} + +void compute_main() { + atomicStore_d1e9a6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicStore/d1e9a6.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicStore/d1e9a6.wgsl.expected.hlsl new file mode 100644 index 0000000000..bb02128e2d --- /dev/null +++ b/test/tint/builtins/gen/var/atomicStore/d1e9a6.wgsl.expected.hlsl @@ -0,0 +1,23 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +void tint_atomicStore(RWByteAddressBuffer buffer, uint offset, int value) { + int ignored; + buffer.InterlockedExchange(offset, value, ignored); +} + + +void atomicStore_d1e9a6() { + int arg_1 = 1; + tint_atomicStore(sb_rw, 0u, arg_1); +} + +void fragment_main() { + atomicStore_d1e9a6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicStore_d1e9a6(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicStore/d1e9a6.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicStore/d1e9a6.wgsl.expected.msl new file mode 100644 index 0000000000..9ef1a4f620 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicStore/d1e9a6.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +struct SB_RW { + /* 0x0000 */ atomic_int arg_0; +}; + +void atomicStore_d1e9a6(device SB_RW* const tint_symbol) { + int arg_1 = 1; + atomic_store_explicit(&((*(tint_symbol)).arg_0), arg_1, memory_order_relaxed); +} + +fragment void fragment_main(device SB_RW* tint_symbol_1 [[buffer(0)]]) { + atomicStore_d1e9a6(tint_symbol_1); + return; +} + +kernel void compute_main(device SB_RW* tint_symbol_2 [[buffer(0)]]) { + atomicStore_d1e9a6(tint_symbol_2); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicStore/d1e9a6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicStore/d1e9a6.wgsl.expected.spvasm new file mode 100644 index 0000000000..5d03e4ee54 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicStore/d1e9a6.wgsl.expected.spvasm @@ -0,0 +1,54 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 27 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicStore_d1e9a6 "atomicStore_d1e9a6" + OpName %arg_1 "arg_1" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %int = OpTypeInt 32 1 + %SB_RW = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %12 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int +%atomicStore_d1e9a6 = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %12 + OpStore %arg_1 %int_1 + %19 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %20 = OpLoad %int %arg_1 + OpAtomicStore %19 %uint_1 %uint_0 %20 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %22 = OpLabel + %23 = OpFunctionCall %void %atomicStore_d1e9a6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %25 = OpLabel + %26 = OpFunctionCall %void %atomicStore_d1e9a6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicStore/d1e9a6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicStore/d1e9a6.wgsl.expected.wgsl new file mode 100644 index 0000000000..cd1a3a77a5 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicStore/d1e9a6.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +struct SB_RW { + arg_0 : atomic, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn atomicStore_d1e9a6() { + var arg_1 = 1; + atomicStore(&(sb_rw.arg_0), arg_1); +} + +@stage(fragment) +fn fragment_main() { + atomicStore_d1e9a6(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicStore_d1e9a6(); +} diff --git a/test/tint/builtins/gen/var/atomicSub/051100.wgsl b/test/tint/builtins/gen/var/atomicSub/051100.wgsl new file mode 100644 index 0000000000..71c55601d2 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicSub/051100.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: atomic, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn atomicSub(ptr, read_write>, i32) -> i32 +fn atomicSub_051100() { + var arg_1 = 1; + var res: i32 = atomicSub(&sb_rw.arg_0, arg_1); +} + +@stage(fragment) +fn fragment_main() { + atomicSub_051100(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicSub_051100(); +} diff --git a/test/tint/builtins/gen/var/atomicSub/051100.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicSub/051100.wgsl.expected.glsl new file mode 100644 index 0000000000..25f8eba74f --- /dev/null +++ b/test/tint/builtins/gen/var/atomicSub/051100.wgsl.expected.glsl @@ -0,0 +1,46 @@ +#version 310 es +precision mediump float; + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + int arg_0; +} sb_rw; +void atomicSub_051100() { + int arg_1 = 1; + int res = atomicAdd(sb_rw.arg_0, arg_1); +} + +void fragment_main() { + atomicSub_051100(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + int arg_0; +} sb_rw; +void atomicSub_051100() { + int arg_1 = 1; + int res = atomicAdd(sb_rw.arg_0, arg_1); +} + +void compute_main() { + atomicSub_051100(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicSub/051100.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicSub/051100.wgsl.expected.hlsl new file mode 100644 index 0000000000..eac50d325c --- /dev/null +++ b/test/tint/builtins/gen/var/atomicSub/051100.wgsl.expected.hlsl @@ -0,0 +1,24 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicSub(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedAdd(offset, -value, original_value); + return original_value; +} + + +void atomicSub_051100() { + int arg_1 = 1; + int res = tint_atomicSub(sb_rw, 0u, arg_1); +} + +void fragment_main() { + atomicSub_051100(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicSub_051100(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicSub/051100.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicSub/051100.wgsl.expected.msl new file mode 100644 index 0000000000..695c08502c --- /dev/null +++ b/test/tint/builtins/gen/var/atomicSub/051100.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +struct SB_RW { + /* 0x0000 */ atomic_int arg_0; +}; + +void atomicSub_051100(device SB_RW* const tint_symbol) { + int arg_1 = 1; + int res = atomic_fetch_sub_explicit(&((*(tint_symbol)).arg_0), arg_1, memory_order_relaxed); +} + +fragment void fragment_main(device SB_RW* tint_symbol_1 [[buffer(0)]]) { + atomicSub_051100(tint_symbol_1); + return; +} + +kernel void compute_main(device SB_RW* tint_symbol_2 [[buffer(0)]]) { + atomicSub_051100(tint_symbol_2); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicSub/051100.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicSub/051100.wgsl.expected.spvasm new file mode 100644 index 0000000000..3bbf26a4b0 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicSub/051100.wgsl.expected.spvasm @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 28 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicSub_051100 "atomicSub_051100" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %int = OpTypeInt 32 1 + %SB_RW = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %12 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int +%atomicSub_051100 = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %12 + %res = OpVariable %_ptr_Function_int Function %12 + OpStore %arg_1 %int_1 + %19 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %20 = OpLoad %int %arg_1 + %13 = OpAtomicISub %int %19 %uint_1 %uint_0 %20 + OpStore %res %13 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %23 = OpLabel + %24 = OpFunctionCall %void %atomicSub_051100 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %26 = OpLabel + %27 = OpFunctionCall %void %atomicSub_051100 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicSub/051100.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicSub/051100.wgsl.expected.wgsl new file mode 100644 index 0000000000..eb4964846b --- /dev/null +++ b/test/tint/builtins/gen/var/atomicSub/051100.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +struct SB_RW { + arg_0 : atomic, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn atomicSub_051100() { + var arg_1 = 1; + var res : i32 = atomicSub(&(sb_rw.arg_0), arg_1); +} + +@stage(fragment) +fn fragment_main() { + atomicSub_051100(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicSub_051100(); +} diff --git a/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl b/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl new file mode 100644 index 0000000000..09c7895d89 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl @@ -0,0 +1,36 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +var arg_0: atomic; + +// fn atomicSub(ptr, read_write>, u32) -> u32 +fn atomicSub_0d26c2() { + var arg_1 = 1u; + var res: u32 = atomicSub(&arg_0, arg_1); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicSub_0d26c2(); +} diff --git a/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.glsl new file mode 100644 index 0000000000..739fc9e262 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.glsl @@ -0,0 +1,21 @@ +#version 310 es + +shared uint arg_0; +void atomicSub_0d26c2() { + uint arg_1 = 1u; + uint res = atomicAdd(arg_0, arg_1); +} + +void compute_main(uint local_invocation_index) { + { + atomicExchange(arg_0, 0u); + } + barrier(); + atomicSub_0d26c2(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.hlsl new file mode 100644 index 0000000000..abced13695 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.hlsl @@ -0,0 +1,27 @@ +groupshared uint arg_0; + +void atomicSub_0d26c2() { + uint arg_1 = 1u; + uint atomic_result = 0u; + InterlockedAdd(arg_0, -arg_1, atomic_result); + uint res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicSub_0d26c2(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.msl new file mode 100644 index 0000000000..2f510de4d8 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +void atomicSub_0d26c2(threadgroup atomic_uint* const tint_symbol) { + uint arg_1 = 1u; + uint res = atomic_fetch_sub_explicit(tint_symbol, arg_1, memory_order_relaxed); +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) { + { + atomic_store_explicit(tint_symbol_1, 0u, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicSub_0d26c2(tint_symbol_1); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup atomic_uint tint_symbol_2; + compute_main_inner(local_invocation_index, &(tint_symbol_2)); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.spvasm new file mode 100644 index 0000000000..2c6b98e511 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.spvasm @@ -0,0 +1,56 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicSub_0d26c2 "atomicSub_0d26c2" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %6 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %13 = OpConstantNull %uint + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %20 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicSub_0d26c2 = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %13 + %res = OpVariable %_ptr_Function_uint Function %13 + OpStore %arg_1 %uint_1 + %18 = OpLoad %uint %arg_1 + %14 = OpAtomicISub %uint %arg_0 %uint_2 %uint_0 %18 + OpStore %res %14 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %20 +%local_invocation_index = OpFunctionParameter %uint + %23 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %13 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %28 = OpFunctionCall %void %atomicSub_0d26c2 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %6 + %30 = OpLabel + %32 = OpLoad %uint %local_invocation_index_1 + %31 = OpFunctionCall %void %compute_main_inner %32 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.wgsl new file mode 100644 index 0000000000..d907bfba6b --- /dev/null +++ b/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.wgsl @@ -0,0 +1,11 @@ +var arg_0 : atomic; + +fn atomicSub_0d26c2() { + var arg_1 = 1u; + var res : u32 = atomicSub(&(arg_0), arg_1); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicSub_0d26c2(); +} diff --git a/test/tint/builtins/gen/var/atomicSub/15bfc9.wgsl b/test/tint/builtins/gen/var/atomicSub/15bfc9.wgsl new file mode 100644 index 0000000000..9caf71e073 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicSub/15bfc9.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: atomic, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn atomicSub(ptr, read_write>, u32) -> u32 +fn atomicSub_15bfc9() { + var arg_1 = 1u; + var res: u32 = atomicSub(&sb_rw.arg_0, arg_1); +} + +@stage(fragment) +fn fragment_main() { + atomicSub_15bfc9(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicSub_15bfc9(); +} diff --git a/test/tint/builtins/gen/var/atomicSub/15bfc9.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicSub/15bfc9.wgsl.expected.glsl new file mode 100644 index 0000000000..c21f8f7cd7 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicSub/15bfc9.wgsl.expected.glsl @@ -0,0 +1,46 @@ +#version 310 es +precision mediump float; + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + uint arg_0; +} sb_rw; +void atomicSub_15bfc9() { + uint arg_1 = 1u; + uint res = atomicAdd(sb_rw.arg_0, arg_1); +} + +void fragment_main() { + atomicSub_15bfc9(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + uint arg_0; +} sb_rw; +void atomicSub_15bfc9() { + uint arg_1 = 1u; + uint res = atomicAdd(sb_rw.arg_0, arg_1); +} + +void compute_main() { + atomicSub_15bfc9(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicSub/15bfc9.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicSub/15bfc9.wgsl.expected.hlsl new file mode 100644 index 0000000000..166f709699 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicSub/15bfc9.wgsl.expected.hlsl @@ -0,0 +1,24 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicSub(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedAdd(offset, -value, original_value); + return original_value; +} + + +void atomicSub_15bfc9() { + uint arg_1 = 1u; + uint res = tint_atomicSub(sb_rw, 0u, arg_1); +} + +void fragment_main() { + atomicSub_15bfc9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicSub_15bfc9(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicSub/15bfc9.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicSub/15bfc9.wgsl.expected.msl new file mode 100644 index 0000000000..c664e5a307 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicSub/15bfc9.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +struct SB_RW { + /* 0x0000 */ atomic_uint arg_0; +}; + +void atomicSub_15bfc9(device SB_RW* const tint_symbol) { + uint arg_1 = 1u; + uint res = atomic_fetch_sub_explicit(&((*(tint_symbol)).arg_0), arg_1, memory_order_relaxed); +} + +fragment void fragment_main(device SB_RW* tint_symbol_1 [[buffer(0)]]) { + atomicSub_15bfc9(tint_symbol_1); + return; +} + +kernel void compute_main(device SB_RW* tint_symbol_2 [[buffer(0)]]) { + atomicSub_15bfc9(tint_symbol_2); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicSub/15bfc9.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicSub/15bfc9.wgsl.expected.spvasm new file mode 100644 index 0000000000..4d20c6d426 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicSub/15bfc9.wgsl.expected.spvasm @@ -0,0 +1,55 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicSub_15bfc9 "atomicSub_15bfc9" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %uint = OpTypeInt 32 0 + %SB_RW = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %12 = OpConstantNull %uint + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%atomicSub_15bfc9 = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %12 + %res = OpVariable %_ptr_Function_uint Function %12 + OpStore %arg_1 %uint_1 + %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %18 = OpLoad %uint %arg_1 + %13 = OpAtomicISub %uint %17 %uint_1 %uint_0 %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %21 = OpLabel + %22 = OpFunctionCall %void %atomicSub_15bfc9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %24 = OpLabel + %25 = OpFunctionCall %void %atomicSub_15bfc9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicSub/15bfc9.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicSub/15bfc9.wgsl.expected.wgsl new file mode 100644 index 0000000000..a48de0750c --- /dev/null +++ b/test/tint/builtins/gen/var/atomicSub/15bfc9.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +struct SB_RW { + arg_0 : atomic, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn atomicSub_15bfc9() { + var arg_1 = 1u; + var res : u32 = atomicSub(&(sb_rw.arg_0), arg_1); +} + +@stage(fragment) +fn fragment_main() { + atomicSub_15bfc9(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicSub_15bfc9(); +} diff --git a/test/tint/builtins/gen/var/atomicSub/77883a.wgsl b/test/tint/builtins/gen/var/atomicSub/77883a.wgsl new file mode 100644 index 0000000000..685ed0abc5 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicSub/77883a.wgsl @@ -0,0 +1,36 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +var arg_0: atomic; + +// fn atomicSub(ptr, read_write>, i32) -> i32 +fn atomicSub_77883a() { + var arg_1 = 1; + var res: i32 = atomicSub(&arg_0, arg_1); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicSub_77883a(); +} diff --git a/test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.glsl new file mode 100644 index 0000000000..02de7e66d0 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.glsl @@ -0,0 +1,21 @@ +#version 310 es + +shared int arg_0; +void atomicSub_77883a() { + int arg_1 = 1; + int res = atomicAdd(arg_0, arg_1); +} + +void compute_main(uint local_invocation_index) { + { + atomicExchange(arg_0, 0); + } + barrier(); + atomicSub_77883a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.hlsl new file mode 100644 index 0000000000..dcc2e250ba --- /dev/null +++ b/test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.hlsl @@ -0,0 +1,27 @@ +groupshared int arg_0; + +void atomicSub_77883a() { + int arg_1 = 1; + int atomic_result = 0; + InterlockedAdd(arg_0, -arg_1, atomic_result); + int res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicSub_77883a(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.msl new file mode 100644 index 0000000000..2e54b645c7 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +void atomicSub_77883a(threadgroup atomic_int* const tint_symbol) { + int arg_1 = 1; + int res = atomic_fetch_sub_explicit(tint_symbol, arg_1, memory_order_relaxed); +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) { + { + atomic_store_explicit(tint_symbol_1, 0, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicSub_77883a(tint_symbol_1); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup atomic_int tint_symbol_2; + compute_main_inner(local_invocation_index, &(tint_symbol_2)); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.spvasm new file mode 100644 index 0000000000..d96432dd36 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.spvasm @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicSub_77883a "atomicSub_77883a" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %7 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %14 = OpConstantNull %int + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %21 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicSub_77883a = OpFunction %void None %7 + %10 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %14 + %res = OpVariable %_ptr_Function_int Function %14 + OpStore %arg_1 %int_1 + %19 = OpLoad %int %arg_1 + %15 = OpAtomicISub %int %arg_0 %uint_2 %uint_0 %19 + OpStore %res %15 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %21 +%local_invocation_index = OpFunctionParameter %uint + %24 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %29 = OpFunctionCall %void %atomicSub_77883a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %7 + %31 = OpLabel + %33 = OpLoad %uint %local_invocation_index_1 + %32 = OpFunctionCall %void %compute_main_inner %33 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.wgsl new file mode 100644 index 0000000000..8603aaba94 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.wgsl @@ -0,0 +1,11 @@ +var arg_0 : atomic; + +fn atomicSub_77883a() { + var arg_1 = 1; + var res : i32 = atomicSub(&(arg_0), arg_1); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicSub_77883a(); +} diff --git a/test/tint/builtins/gen/var/atomicXor/54510e.wgsl b/test/tint/builtins/gen/var/atomicXor/54510e.wgsl new file mode 100644 index 0000000000..e2285df5eb --- /dev/null +++ b/test/tint/builtins/gen/var/atomicXor/54510e.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: atomic, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn atomicXor(ptr, read_write>, u32) -> u32 +fn atomicXor_54510e() { + var arg_1 = 1u; + var res: u32 = atomicXor(&sb_rw.arg_0, arg_1); +} + +@stage(fragment) +fn fragment_main() { + atomicXor_54510e(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicXor_54510e(); +} diff --git a/test/tint/builtins/gen/var/atomicXor/54510e.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicXor/54510e.wgsl.expected.glsl new file mode 100644 index 0000000000..7ac44209ed --- /dev/null +++ b/test/tint/builtins/gen/var/atomicXor/54510e.wgsl.expected.glsl @@ -0,0 +1,46 @@ +#version 310 es +precision mediump float; + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + uint arg_0; +} sb_rw; +void atomicXor_54510e() { + uint arg_1 = 1u; + uint res = atomicXor(sb_rw.arg_0, arg_1); +} + +void fragment_main() { + atomicXor_54510e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + uint arg_0; +} sb_rw; +void atomicXor_54510e() { + uint arg_1 = 1u; + uint res = atomicXor(sb_rw.arg_0, arg_1); +} + +void compute_main() { + atomicXor_54510e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicXor/54510e.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicXor/54510e.wgsl.expected.hlsl new file mode 100644 index 0000000000..d745f1232c --- /dev/null +++ b/test/tint/builtins/gen/var/atomicXor/54510e.wgsl.expected.hlsl @@ -0,0 +1,24 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicXor(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedXor(offset, value, original_value); + return original_value; +} + + +void atomicXor_54510e() { + uint arg_1 = 1u; + uint res = tint_atomicXor(sb_rw, 0u, arg_1); +} + +void fragment_main() { + atomicXor_54510e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicXor_54510e(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicXor/54510e.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicXor/54510e.wgsl.expected.msl new file mode 100644 index 0000000000..fc578f9d66 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicXor/54510e.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +struct SB_RW { + /* 0x0000 */ atomic_uint arg_0; +}; + +void atomicXor_54510e(device SB_RW* const tint_symbol) { + uint arg_1 = 1u; + uint res = atomic_fetch_xor_explicit(&((*(tint_symbol)).arg_0), arg_1, memory_order_relaxed); +} + +fragment void fragment_main(device SB_RW* tint_symbol_1 [[buffer(0)]]) { + atomicXor_54510e(tint_symbol_1); + return; +} + +kernel void compute_main(device SB_RW* tint_symbol_2 [[buffer(0)]]) { + atomicXor_54510e(tint_symbol_2); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicXor/54510e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicXor/54510e.wgsl.expected.spvasm new file mode 100644 index 0000000000..a16daff5f6 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicXor/54510e.wgsl.expected.spvasm @@ -0,0 +1,55 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicXor_54510e "atomicXor_54510e" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %uint = OpTypeInt 32 0 + %SB_RW = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %12 = OpConstantNull %uint + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%atomicXor_54510e = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %12 + %res = OpVariable %_ptr_Function_uint Function %12 + OpStore %arg_1 %uint_1 + %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %18 = OpLoad %uint %arg_1 + %13 = OpAtomicXor %uint %17 %uint_1 %uint_0 %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %21 = OpLabel + %22 = OpFunctionCall %void %atomicXor_54510e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %24 = OpLabel + %25 = OpFunctionCall %void %atomicXor_54510e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicXor/54510e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicXor/54510e.wgsl.expected.wgsl new file mode 100644 index 0000000000..fa8ead85d8 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicXor/54510e.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +struct SB_RW { + arg_0 : atomic, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn atomicXor_54510e() { + var arg_1 = 1u; + var res : u32 = atomicXor(&(sb_rw.arg_0), arg_1); +} + +@stage(fragment) +fn fragment_main() { + atomicXor_54510e(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicXor_54510e(); +} diff --git a/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl b/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl new file mode 100644 index 0000000000..55a28e5625 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl @@ -0,0 +1,36 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +var arg_0: atomic; + +// fn atomicXor(ptr, read_write>, i32) -> i32 +fn atomicXor_75dc95() { + var arg_1 = 1; + var res: i32 = atomicXor(&arg_0, arg_1); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicXor_75dc95(); +} diff --git a/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.glsl new file mode 100644 index 0000000000..207bfd41b3 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.glsl @@ -0,0 +1,21 @@ +#version 310 es + +shared int arg_0; +void atomicXor_75dc95() { + int arg_1 = 1; + int res = atomicXor(arg_0, arg_1); +} + +void compute_main(uint local_invocation_index) { + { + atomicExchange(arg_0, 0); + } + barrier(); + atomicXor_75dc95(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.hlsl new file mode 100644 index 0000000000..a93c5dc2fb --- /dev/null +++ b/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.hlsl @@ -0,0 +1,27 @@ +groupshared int arg_0; + +void atomicXor_75dc95() { + int arg_1 = 1; + int atomic_result = 0; + InterlockedXor(arg_0, arg_1, atomic_result); + int res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicXor_75dc95(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.msl new file mode 100644 index 0000000000..afad14bc2e --- /dev/null +++ b/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +void atomicXor_75dc95(threadgroup atomic_int* const tint_symbol) { + int arg_1 = 1; + int res = atomic_fetch_xor_explicit(tint_symbol, arg_1, memory_order_relaxed); +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) { + { + atomic_store_explicit(tint_symbol_1, 0, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicXor_75dc95(tint_symbol_1); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup atomic_int tint_symbol_2; + compute_main_inner(local_invocation_index, &(tint_symbol_2)); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.spvasm new file mode 100644 index 0000000000..62e03513cf --- /dev/null +++ b/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.spvasm @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicXor_75dc95 "atomicXor_75dc95" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %7 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %14 = OpConstantNull %int + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %21 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicXor_75dc95 = OpFunction %void None %7 + %10 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %14 + %res = OpVariable %_ptr_Function_int Function %14 + OpStore %arg_1 %int_1 + %19 = OpLoad %int %arg_1 + %15 = OpAtomicXor %int %arg_0 %uint_2 %uint_0 %19 + OpStore %res %15 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %21 +%local_invocation_index = OpFunctionParameter %uint + %24 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %29 = OpFunctionCall %void %atomicXor_75dc95 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %7 + %31 = OpLabel + %33 = OpLoad %uint %local_invocation_index_1 + %32 = OpFunctionCall %void %compute_main_inner %33 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.wgsl new file mode 100644 index 0000000000..cdba5abfe7 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.wgsl @@ -0,0 +1,11 @@ +var arg_0 : atomic; + +fn atomicXor_75dc95() { + var arg_1 = 1; + var res : i32 = atomicXor(&(arg_0), arg_1); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicXor_75dc95(); +} diff --git a/test/tint/builtins/gen/var/atomicXor/c1b78c.wgsl b/test/tint/builtins/gen/var/atomicXor/c1b78c.wgsl new file mode 100644 index 0000000000..05bd6f2eac --- /dev/null +++ b/test/tint/builtins/gen/var/atomicXor/c1b78c.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: atomic, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn atomicXor(ptr, read_write>, i32) -> i32 +fn atomicXor_c1b78c() { + var arg_1 = 1; + var res: i32 = atomicXor(&sb_rw.arg_0, arg_1); +} + +@stage(fragment) +fn fragment_main() { + atomicXor_c1b78c(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicXor_c1b78c(); +} diff --git a/test/tint/builtins/gen/var/atomicXor/c1b78c.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicXor/c1b78c.wgsl.expected.glsl new file mode 100644 index 0000000000..3f8236cd0a --- /dev/null +++ b/test/tint/builtins/gen/var/atomicXor/c1b78c.wgsl.expected.glsl @@ -0,0 +1,46 @@ +#version 310 es +precision mediump float; + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + int arg_0; +} sb_rw; +void atomicXor_c1b78c() { + int arg_1 = 1; + int res = atomicXor(sb_rw.arg_0, arg_1); +} + +void fragment_main() { + atomicXor_c1b78c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + int arg_0; +} sb_rw; +void atomicXor_c1b78c() { + int arg_1 = 1; + int res = atomicXor(sb_rw.arg_0, arg_1); +} + +void compute_main() { + atomicXor_c1b78c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicXor/c1b78c.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicXor/c1b78c.wgsl.expected.hlsl new file mode 100644 index 0000000000..df83cd93d1 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicXor/c1b78c.wgsl.expected.hlsl @@ -0,0 +1,24 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicXor(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedXor(offset, value, original_value); + return original_value; +} + + +void atomicXor_c1b78c() { + int arg_1 = 1; + int res = tint_atomicXor(sb_rw, 0u, arg_1); +} + +void fragment_main() { + atomicXor_c1b78c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicXor_c1b78c(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicXor/c1b78c.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicXor/c1b78c.wgsl.expected.msl new file mode 100644 index 0000000000..1dba5012bc --- /dev/null +++ b/test/tint/builtins/gen/var/atomicXor/c1b78c.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +struct SB_RW { + /* 0x0000 */ atomic_int arg_0; +}; + +void atomicXor_c1b78c(device SB_RW* const tint_symbol) { + int arg_1 = 1; + int res = atomic_fetch_xor_explicit(&((*(tint_symbol)).arg_0), arg_1, memory_order_relaxed); +} + +fragment void fragment_main(device SB_RW* tint_symbol_1 [[buffer(0)]]) { + atomicXor_c1b78c(tint_symbol_1); + return; +} + +kernel void compute_main(device SB_RW* tint_symbol_2 [[buffer(0)]]) { + atomicXor_c1b78c(tint_symbol_2); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicXor/c1b78c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicXor/c1b78c.wgsl.expected.spvasm new file mode 100644 index 0000000000..cff5564090 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicXor/c1b78c.wgsl.expected.spvasm @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 28 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicXor_c1b78c "atomicXor_c1b78c" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %int = OpTypeInt 32 1 + %SB_RW = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %12 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int +%atomicXor_c1b78c = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %12 + %res = OpVariable %_ptr_Function_int Function %12 + OpStore %arg_1 %int_1 + %19 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %20 = OpLoad %int %arg_1 + %13 = OpAtomicXor %int %19 %uint_1 %uint_0 %20 + OpStore %res %13 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %23 = OpLabel + %24 = OpFunctionCall %void %atomicXor_c1b78c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %26 = OpLabel + %27 = OpFunctionCall %void %atomicXor_c1b78c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicXor/c1b78c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicXor/c1b78c.wgsl.expected.wgsl new file mode 100644 index 0000000000..af253cabd5 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicXor/c1b78c.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +struct SB_RW { + arg_0 : atomic, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn atomicXor_c1b78c() { + var arg_1 = 1; + var res : i32 = atomicXor(&(sb_rw.arg_0), arg_1); +} + +@stage(fragment) +fn fragment_main() { + atomicXor_c1b78c(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicXor_c1b78c(); +} diff --git a/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl b/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl new file mode 100644 index 0000000000..14a7921c29 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl @@ -0,0 +1,36 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +var arg_0: atomic; + +// fn atomicXor(ptr, read_write>, u32) -> u32 +fn atomicXor_c8e6be() { + var arg_1 = 1u; + var res: u32 = atomicXor(&arg_0, arg_1); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicXor_c8e6be(); +} diff --git a/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.glsl new file mode 100644 index 0000000000..36660a3903 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.glsl @@ -0,0 +1,21 @@ +#version 310 es + +shared uint arg_0; +void atomicXor_c8e6be() { + uint arg_1 = 1u; + uint res = atomicXor(arg_0, arg_1); +} + +void compute_main(uint local_invocation_index) { + { + atomicExchange(arg_0, 0u); + } + barrier(); + atomicXor_c8e6be(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.hlsl new file mode 100644 index 0000000000..18b6de75b7 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.hlsl @@ -0,0 +1,27 @@ +groupshared uint arg_0; + +void atomicXor_c8e6be() { + uint arg_1 = 1u; + uint atomic_result = 0u; + InterlockedXor(arg_0, arg_1, atomic_result); + uint res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicXor_c8e6be(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.msl new file mode 100644 index 0000000000..0f81e1e78b --- /dev/null +++ b/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +void atomicXor_c8e6be(threadgroup atomic_uint* const tint_symbol) { + uint arg_1 = 1u; + uint res = atomic_fetch_xor_explicit(tint_symbol, arg_1, memory_order_relaxed); +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) { + { + atomic_store_explicit(tint_symbol_1, 0u, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicXor_c8e6be(tint_symbol_1); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup atomic_uint tint_symbol_2; + compute_main_inner(local_invocation_index, &(tint_symbol_2)); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.spvasm new file mode 100644 index 0000000000..ba98e8dc4e --- /dev/null +++ b/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.spvasm @@ -0,0 +1,56 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicXor_c8e6be "atomicXor_c8e6be" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %6 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %13 = OpConstantNull %uint + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %20 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicXor_c8e6be = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %13 + %res = OpVariable %_ptr_Function_uint Function %13 + OpStore %arg_1 %uint_1 + %18 = OpLoad %uint %arg_1 + %14 = OpAtomicXor %uint %arg_0 %uint_2 %uint_0 %18 + OpStore %res %14 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %20 +%local_invocation_index = OpFunctionParameter %uint + %23 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %13 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %28 = OpFunctionCall %void %atomicXor_c8e6be + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %6 + %30 = OpLabel + %32 = OpLoad %uint %local_invocation_index_1 + %31 = OpFunctionCall %void %compute_main_inner %32 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.wgsl new file mode 100644 index 0000000000..7474f6a22e --- /dev/null +++ b/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.wgsl @@ -0,0 +1,11 @@ +var arg_0 : atomic; + +fn atomicXor_c8e6be() { + var arg_1 = 1u; + var res : u32 = atomicXor(&(arg_0), arg_1); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + atomicXor_c8e6be(); +} diff --git a/test/tint/builtins/gen/var/ceil/34064b.wgsl b/test/tint/builtins/gen/var/ceil/34064b.wgsl new file mode 100644 index 0000000000..3c62e9823f --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/34064b.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn ceil(vec<3, f32>) -> vec<3, f32> +fn ceil_34064b() { + var arg_0 = vec3(); + var res: vec3 = ceil(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + ceil_34064b(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + ceil_34064b(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + ceil_34064b(); +} diff --git a/test/tint/builtins/gen/var/ceil/34064b.wgsl.expected.glsl b/test/tint/builtins/gen/var/ceil/34064b.wgsl.expected.glsl new file mode 100644 index 0000000000..0ec90dac8a --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/34064b.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void ceil_34064b() { + vec3 arg_0 = vec3(0.0f); + vec3 res = ceil(arg_0); +} + +vec4 vertex_main() { + ceil_34064b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void ceil_34064b() { + vec3 arg_0 = vec3(0.0f); + vec3 res = ceil(arg_0); +} + +void fragment_main() { + ceil_34064b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void ceil_34064b() { + vec3 arg_0 = vec3(0.0f); + vec3 res = ceil(arg_0); +} + +void compute_main() { + ceil_34064b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/ceil/34064b.wgsl.expected.hlsl b/test/tint/builtins/gen/var/ceil/34064b.wgsl.expected.hlsl new file mode 100644 index 0000000000..3e070fef0c --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/34064b.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void ceil_34064b() { + float3 arg_0 = (0.0f).xxx; + float3 res = ceil(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ceil_34064b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ceil_34064b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ceil_34064b(); + return; +} diff --git a/test/tint/builtins/gen/var/ceil/34064b.wgsl.expected.msl b/test/tint/builtins/gen/var/ceil/34064b.wgsl.expected.msl new file mode 100644 index 0000000000..4861263d95 --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/34064b.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void ceil_34064b() { + float3 arg_0 = float3(0.0f); + float3 res = ceil(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + ceil_34064b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + ceil_34064b(); + return; +} + +kernel void compute_main() { + ceil_34064b(); + return; +} + diff --git a/test/tint/builtins/gen/var/ceil/34064b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/ceil/34064b.wgsl.expected.spvasm new file mode 100644 index 0000000000..c66ed701c6 --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/34064b.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %ceil_34064b "ceil_34064b" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %14 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%ceil_34064b = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %14 + %res = OpVariable %_ptr_Function_v3float Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %v3float %arg_0 + %17 = OpExtInst %v3float %18 Ceil %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %ceil_34064b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %ceil_34064b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %ceil_34064b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/ceil/34064b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/ceil/34064b.wgsl.expected.wgsl new file mode 100644 index 0000000000..39d0feeded --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/34064b.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn ceil_34064b() { + var arg_0 = vec3(); + var res : vec3 = ceil(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + ceil_34064b(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + ceil_34064b(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + ceil_34064b(); +} diff --git a/test/tint/builtins/gen/var/ceil/678655.wgsl b/test/tint/builtins/gen/var/ceil/678655.wgsl new file mode 100644 index 0000000000..33d78f2cb9 --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/678655.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn ceil(f32) -> f32 +fn ceil_678655() { + var arg_0 = 1.0; + var res: f32 = ceil(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + ceil_678655(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + ceil_678655(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + ceil_678655(); +} diff --git a/test/tint/builtins/gen/var/ceil/678655.wgsl.expected.glsl b/test/tint/builtins/gen/var/ceil/678655.wgsl.expected.glsl new file mode 100644 index 0000000000..56f09a6e13 --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/678655.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void ceil_678655() { + float arg_0 = 1.0f; + float res = ceil(arg_0); +} + +vec4 vertex_main() { + ceil_678655(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void ceil_678655() { + float arg_0 = 1.0f; + float res = ceil(arg_0); +} + +void fragment_main() { + ceil_678655(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void ceil_678655() { + float arg_0 = 1.0f; + float res = ceil(arg_0); +} + +void compute_main() { + ceil_678655(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/ceil/678655.wgsl.expected.hlsl b/test/tint/builtins/gen/var/ceil/678655.wgsl.expected.hlsl new file mode 100644 index 0000000000..61f3dc0d3c --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/678655.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void ceil_678655() { + float arg_0 = 1.0f; + float res = ceil(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ceil_678655(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ceil_678655(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ceil_678655(); + return; +} diff --git a/test/tint/builtins/gen/var/ceil/678655.wgsl.expected.msl b/test/tint/builtins/gen/var/ceil/678655.wgsl.expected.msl new file mode 100644 index 0000000000..8714a884f9 --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/678655.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void ceil_678655() { + float arg_0 = 1.0f; + float res = ceil(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + ceil_678655(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + ceil_678655(); + return; +} + +kernel void compute_main() { + ceil_678655(); + return; +} + diff --git a/test/tint/builtins/gen/var/ceil/678655.wgsl.expected.spvasm b/test/tint/builtins/gen/var/ceil/678655.wgsl.expected.spvasm new file mode 100644 index 0000000000..465ddd442a --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/678655.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %ceil_678655 "ceil_678655" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %20 = OpTypeFunction %v4float +%ceil_678655 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + %18 = OpLoad %float %arg_0 + %16 = OpExtInst %float %17 Ceil %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %ceil_678655 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %ceil_678655 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %ceil_678655 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/ceil/678655.wgsl.expected.wgsl b/test/tint/builtins/gen/var/ceil/678655.wgsl.expected.wgsl new file mode 100644 index 0000000000..5a86a3280a --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/678655.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn ceil_678655() { + var arg_0 = 1.0; + var res : f32 = ceil(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + ceil_678655(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + ceil_678655(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + ceil_678655(); +} diff --git a/test/tint/builtins/gen/var/ceil/96f597.wgsl b/test/tint/builtins/gen/var/ceil/96f597.wgsl new file mode 100644 index 0000000000..71d5cab50f --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/96f597.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn ceil(vec<2, f32>) -> vec<2, f32> +fn ceil_96f597() { + var arg_0 = vec2(); + var res: vec2 = ceil(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + ceil_96f597(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + ceil_96f597(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + ceil_96f597(); +} diff --git a/test/tint/builtins/gen/var/ceil/96f597.wgsl.expected.glsl b/test/tint/builtins/gen/var/ceil/96f597.wgsl.expected.glsl new file mode 100644 index 0000000000..391c9e876d --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/96f597.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void ceil_96f597() { + vec2 arg_0 = vec2(0.0f); + vec2 res = ceil(arg_0); +} + +vec4 vertex_main() { + ceil_96f597(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void ceil_96f597() { + vec2 arg_0 = vec2(0.0f); + vec2 res = ceil(arg_0); +} + +void fragment_main() { + ceil_96f597(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void ceil_96f597() { + vec2 arg_0 = vec2(0.0f); + vec2 res = ceil(arg_0); +} + +void compute_main() { + ceil_96f597(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/ceil/96f597.wgsl.expected.hlsl b/test/tint/builtins/gen/var/ceil/96f597.wgsl.expected.hlsl new file mode 100644 index 0000000000..828c98abda --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/96f597.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void ceil_96f597() { + float2 arg_0 = (0.0f).xx; + float2 res = ceil(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ceil_96f597(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ceil_96f597(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ceil_96f597(); + return; +} diff --git a/test/tint/builtins/gen/var/ceil/96f597.wgsl.expected.msl b/test/tint/builtins/gen/var/ceil/96f597.wgsl.expected.msl new file mode 100644 index 0000000000..c7c020053f --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/96f597.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void ceil_96f597() { + float2 arg_0 = float2(0.0f); + float2 res = ceil(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + ceil_96f597(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + ceil_96f597(); + return; +} + +kernel void compute_main() { + ceil_96f597(); + return; +} + diff --git a/test/tint/builtins/gen/var/ceil/96f597.wgsl.expected.spvasm b/test/tint/builtins/gen/var/ceil/96f597.wgsl.expected.spvasm new file mode 100644 index 0000000000..e78d1d248b --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/96f597.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %ceil_96f597 "ceil_96f597" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %14 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%ceil_96f597 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %14 + %res = OpVariable %_ptr_Function_v2float Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %v2float %arg_0 + %17 = OpExtInst %v2float %18 Ceil %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %ceil_96f597 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %ceil_96f597 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %ceil_96f597 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/ceil/96f597.wgsl.expected.wgsl b/test/tint/builtins/gen/var/ceil/96f597.wgsl.expected.wgsl new file mode 100644 index 0000000000..a7a79c206c --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/96f597.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn ceil_96f597() { + var arg_0 = vec2(); + var res : vec2 = ceil(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + ceil_96f597(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + ceil_96f597(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + ceil_96f597(); +} diff --git a/test/tint/builtins/gen/var/ceil/b74c16.wgsl b/test/tint/builtins/gen/var/ceil/b74c16.wgsl new file mode 100644 index 0000000000..7b74614b91 --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/b74c16.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn ceil(vec<4, f32>) -> vec<4, f32> +fn ceil_b74c16() { + var arg_0 = vec4(); + var res: vec4 = ceil(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + ceil_b74c16(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + ceil_b74c16(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + ceil_b74c16(); +} diff --git a/test/tint/builtins/gen/var/ceil/b74c16.wgsl.expected.glsl b/test/tint/builtins/gen/var/ceil/b74c16.wgsl.expected.glsl new file mode 100644 index 0000000000..3d4f524d75 --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/b74c16.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void ceil_b74c16() { + vec4 arg_0 = vec4(0.0f); + vec4 res = ceil(arg_0); +} + +vec4 vertex_main() { + ceil_b74c16(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void ceil_b74c16() { + vec4 arg_0 = vec4(0.0f); + vec4 res = ceil(arg_0); +} + +void fragment_main() { + ceil_b74c16(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void ceil_b74c16() { + vec4 arg_0 = vec4(0.0f); + vec4 res = ceil(arg_0); +} + +void compute_main() { + ceil_b74c16(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/ceil/b74c16.wgsl.expected.hlsl b/test/tint/builtins/gen/var/ceil/b74c16.wgsl.expected.hlsl new file mode 100644 index 0000000000..f660b33e57 --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/b74c16.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void ceil_b74c16() { + float4 arg_0 = (0.0f).xxxx; + float4 res = ceil(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ceil_b74c16(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ceil_b74c16(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ceil_b74c16(); + return; +} diff --git a/test/tint/builtins/gen/var/ceil/b74c16.wgsl.expected.msl b/test/tint/builtins/gen/var/ceil/b74c16.wgsl.expected.msl new file mode 100644 index 0000000000..cb59b28556 --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/b74c16.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void ceil_b74c16() { + float4 arg_0 = float4(0.0f); + float4 res = ceil(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + ceil_b74c16(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + ceil_b74c16(); + return; +} + +kernel void compute_main() { + ceil_b74c16(); + return; +} + diff --git a/test/tint/builtins/gen/var/ceil/b74c16.wgsl.expected.spvasm b/test/tint/builtins/gen/var/ceil/b74c16.wgsl.expected.spvasm new file mode 100644 index 0000000000..745b300e18 --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/b74c16.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %ceil_b74c16 "ceil_b74c16" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%ceil_b74c16 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %5 + %17 = OpLoad %v4float %arg_0 + %15 = OpExtInst %v4float %16 Ceil %17 + OpStore %res %15 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %ceil_b74c16 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %ceil_b74c16 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %ceil_b74c16 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/ceil/b74c16.wgsl.expected.wgsl b/test/tint/builtins/gen/var/ceil/b74c16.wgsl.expected.wgsl new file mode 100644 index 0000000000..2b573f8fb1 --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/b74c16.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn ceil_b74c16() { + var arg_0 = vec4(); + var res : vec4 = ceil(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + ceil_b74c16(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + ceil_b74c16(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + ceil_b74c16(); +} diff --git a/test/tint/builtins/gen/var/clamp/0acf8f.wgsl b/test/tint/builtins/gen/var/clamp/0acf8f.wgsl new file mode 100644 index 0000000000..314ca1a5c2 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/0acf8f.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn clamp(vec<2, f32>, vec<2, f32>, vec<2, f32>) -> vec<2, f32> +fn clamp_0acf8f() { + var arg_0 = vec2(); + var arg_1 = vec2(); + var arg_2 = vec2(); + var res: vec2 = clamp(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + clamp_0acf8f(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + clamp_0acf8f(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + clamp_0acf8f(); +} diff --git a/test/tint/builtins/gen/var/clamp/0acf8f.wgsl.expected.glsl b/test/tint/builtins/gen/var/clamp/0acf8f.wgsl.expected.glsl new file mode 100644 index 0000000000..c2877d749a --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/0acf8f.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void clamp_0acf8f() { + vec2 arg_0 = vec2(0.0f); + vec2 arg_1 = vec2(0.0f); + vec2 arg_2 = vec2(0.0f); + vec2 res = clamp(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + clamp_0acf8f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void clamp_0acf8f() { + vec2 arg_0 = vec2(0.0f); + vec2 arg_1 = vec2(0.0f); + vec2 arg_2 = vec2(0.0f); + vec2 res = clamp(arg_0, arg_1, arg_2); +} + +void fragment_main() { + clamp_0acf8f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void clamp_0acf8f() { + vec2 arg_0 = vec2(0.0f); + vec2 arg_1 = vec2(0.0f); + vec2 arg_2 = vec2(0.0f); + vec2 res = clamp(arg_0, arg_1, arg_2); +} + +void compute_main() { + clamp_0acf8f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/0acf8f.wgsl.expected.hlsl b/test/tint/builtins/gen/var/clamp/0acf8f.wgsl.expected.hlsl new file mode 100644 index 0000000000..439c442216 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/0acf8f.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +void clamp_0acf8f() { + float2 arg_0 = (0.0f).xx; + float2 arg_1 = (0.0f).xx; + float2 arg_2 = (0.0f).xx; + float2 res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_0acf8f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_0acf8f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_0acf8f(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/0acf8f.wgsl.expected.msl b/test/tint/builtins/gen/var/clamp/0acf8f.wgsl.expected.msl new file mode 100644 index 0000000000..99108a06bc --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/0acf8f.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void clamp_0acf8f() { + float2 arg_0 = float2(0.0f); + float2 arg_1 = float2(0.0f); + float2 arg_2 = float2(0.0f); + float2 res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + clamp_0acf8f(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + clamp_0acf8f(); + return; +} + +kernel void compute_main() { + clamp_0acf8f(); + return; +} + diff --git a/test/tint/builtins/gen/var/clamp/0acf8f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/clamp/0acf8f.wgsl.expected.spvasm new file mode 100644 index 0000000000..0b65aa7381 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/0acf8f.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %clamp_0acf8f "clamp_0acf8f" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %14 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%clamp_0acf8f = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %14 + %arg_1 = OpVariable %_ptr_Function_v2float Function %14 + %arg_2 = OpVariable %_ptr_Function_v2float Function %14 + %res = OpVariable %_ptr_Function_v2float Function %14 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + OpStore %arg_2 %14 + %21 = OpLoad %v2float %arg_0 + %22 = OpLoad %v2float %arg_1 + %23 = OpLoad %v2float %arg_2 + %19 = OpExtInst %v2float %20 NClamp %21 %22 %23 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %clamp_0acf8f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %clamp_0acf8f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %clamp_0acf8f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/clamp/0acf8f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/clamp/0acf8f.wgsl.expected.wgsl new file mode 100644 index 0000000000..9f954b4399 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/0acf8f.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn clamp_0acf8f() { + var arg_0 = vec2(); + var arg_1 = vec2(); + var arg_2 = vec2(); + var res : vec2 = clamp(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + clamp_0acf8f(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + clamp_0acf8f(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + clamp_0acf8f(); +} diff --git a/test/tint/builtins/gen/var/clamp/1a32e3.wgsl b/test/tint/builtins/gen/var/clamp/1a32e3.wgsl new file mode 100644 index 0000000000..52ae09cf86 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/1a32e3.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn clamp(vec<4, i32>, vec<4, i32>, vec<4, i32>) -> vec<4, i32> +fn clamp_1a32e3() { + var arg_0 = vec4(); + var arg_1 = vec4(); + var arg_2 = vec4(); + var res: vec4 = clamp(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + clamp_1a32e3(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + clamp_1a32e3(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + clamp_1a32e3(); +} diff --git a/test/tint/builtins/gen/var/clamp/1a32e3.wgsl.expected.glsl b/test/tint/builtins/gen/var/clamp/1a32e3.wgsl.expected.glsl new file mode 100644 index 0000000000..72345f9bda --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/1a32e3.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void clamp_1a32e3() { + ivec4 arg_0 = ivec4(0); + ivec4 arg_1 = ivec4(0); + ivec4 arg_2 = ivec4(0); + ivec4 res = clamp(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + clamp_1a32e3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void clamp_1a32e3() { + ivec4 arg_0 = ivec4(0); + ivec4 arg_1 = ivec4(0); + ivec4 arg_2 = ivec4(0); + ivec4 res = clamp(arg_0, arg_1, arg_2); +} + +void fragment_main() { + clamp_1a32e3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void clamp_1a32e3() { + ivec4 arg_0 = ivec4(0); + ivec4 arg_1 = ivec4(0); + ivec4 arg_2 = ivec4(0); + ivec4 res = clamp(arg_0, arg_1, arg_2); +} + +void compute_main() { + clamp_1a32e3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/1a32e3.wgsl.expected.hlsl b/test/tint/builtins/gen/var/clamp/1a32e3.wgsl.expected.hlsl new file mode 100644 index 0000000000..824f7f2f6b --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/1a32e3.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +void clamp_1a32e3() { + int4 arg_0 = (0).xxxx; + int4 arg_1 = (0).xxxx; + int4 arg_2 = (0).xxxx; + int4 res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_1a32e3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_1a32e3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_1a32e3(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/1a32e3.wgsl.expected.msl b/test/tint/builtins/gen/var/clamp/1a32e3.wgsl.expected.msl new file mode 100644 index 0000000000..18046667a5 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/1a32e3.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void clamp_1a32e3() { + int4 arg_0 = int4(0); + int4 arg_1 = int4(0); + int4 arg_2 = int4(0); + int4 res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + clamp_1a32e3(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + clamp_1a32e3(); + return; +} + +kernel void compute_main() { + clamp_1a32e3(); + return; +} + diff --git a/test/tint/builtins/gen/var/clamp/1a32e3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/clamp/1a32e3.wgsl.expected.spvasm new file mode 100644 index 0000000000..576948f324 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/1a32e3.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + %21 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %clamp_1a32e3 "clamp_1a32e3" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %15 = OpConstantNull %v4int +%_ptr_Function_v4int = OpTypePointer Function %v4int + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%clamp_1a32e3 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4int Function %15 + %arg_1 = OpVariable %_ptr_Function_v4int Function %15 + %arg_2 = OpVariable %_ptr_Function_v4int Function %15 + %res = OpVariable %_ptr_Function_v4int Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %15 + %22 = OpLoad %v4int %arg_0 + %23 = OpLoad %v4int %arg_1 + %24 = OpLoad %v4int %arg_2 + %20 = OpExtInst %v4int %21 SClamp %22 %23 %24 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %clamp_1a32e3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %clamp_1a32e3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %clamp_1a32e3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/clamp/1a32e3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/clamp/1a32e3.wgsl.expected.wgsl new file mode 100644 index 0000000000..6c2345ea37 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/1a32e3.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn clamp_1a32e3() { + var arg_0 = vec4(); + var arg_1 = vec4(); + var arg_2 = vec4(); + var res : vec4 = clamp(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + clamp_1a32e3(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + clamp_1a32e3(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + clamp_1a32e3(); +} diff --git a/test/tint/builtins/gen/var/clamp/2bd567.wgsl b/test/tint/builtins/gen/var/clamp/2bd567.wgsl new file mode 100644 index 0000000000..8c1abc8db6 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/2bd567.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn clamp(f32, f32, f32) -> f32 +fn clamp_2bd567() { + var arg_0 = 1.0; + var arg_1 = 1.0; + var arg_2 = 1.0; + var res: f32 = clamp(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + clamp_2bd567(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + clamp_2bd567(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + clamp_2bd567(); +} diff --git a/test/tint/builtins/gen/var/clamp/2bd567.wgsl.expected.glsl b/test/tint/builtins/gen/var/clamp/2bd567.wgsl.expected.glsl new file mode 100644 index 0000000000..a152ab211e --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/2bd567.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void clamp_2bd567() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float arg_2 = 1.0f; + float res = clamp(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + clamp_2bd567(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void clamp_2bd567() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float arg_2 = 1.0f; + float res = clamp(arg_0, arg_1, arg_2); +} + +void fragment_main() { + clamp_2bd567(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void clamp_2bd567() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float arg_2 = 1.0f; + float res = clamp(arg_0, arg_1, arg_2); +} + +void compute_main() { + clamp_2bd567(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/2bd567.wgsl.expected.hlsl b/test/tint/builtins/gen/var/clamp/2bd567.wgsl.expected.hlsl new file mode 100644 index 0000000000..658444791b --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/2bd567.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +void clamp_2bd567() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float arg_2 = 1.0f; + float res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_2bd567(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_2bd567(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_2bd567(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/2bd567.wgsl.expected.msl b/test/tint/builtins/gen/var/clamp/2bd567.wgsl.expected.msl new file mode 100644 index 0000000000..033fc2aebb --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/2bd567.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void clamp_2bd567() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float arg_2 = 1.0f; + float res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + clamp_2bd567(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + clamp_2bd567(); + return; +} + +kernel void compute_main() { + clamp_2bd567(); + return; +} + diff --git a/test/tint/builtins/gen/var/clamp/2bd567.wgsl.expected.spvasm b/test/tint/builtins/gen/var/clamp/2bd567.wgsl.expected.spvasm new file mode 100644 index 0000000000..0319b1f7c2 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/2bd567.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %clamp_2bd567 "clamp_2bd567" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %24 = OpTypeFunction %v4float +%clamp_2bd567 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %arg_1 = OpVariable %_ptr_Function_float Function %8 + %arg_2 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + OpStore %arg_1 %float_1 + OpStore %arg_2 %float_1 + %20 = OpLoad %float %arg_0 + %21 = OpLoad %float %arg_1 + %22 = OpLoad %float %arg_2 + %18 = OpExtInst %float %19 NClamp %20 %21 %22 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %clamp_2bd567 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %clamp_2bd567 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %clamp_2bd567 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/clamp/2bd567.wgsl.expected.wgsl b/test/tint/builtins/gen/var/clamp/2bd567.wgsl.expected.wgsl new file mode 100644 index 0000000000..44a3ecd99a --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/2bd567.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn clamp_2bd567() { + var arg_0 = 1.0; + var arg_1 = 1.0; + var arg_2 = 1.0; + var res : f32 = clamp(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + clamp_2bd567(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + clamp_2bd567(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + clamp_2bd567(); +} diff --git a/test/tint/builtins/gen/var/clamp/2bde41.wgsl b/test/tint/builtins/gen/var/clamp/2bde41.wgsl new file mode 100644 index 0000000000..f542172eaa --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/2bde41.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn clamp(vec<4, f32>, vec<4, f32>, vec<4, f32>) -> vec<4, f32> +fn clamp_2bde41() { + var arg_0 = vec4(); + var arg_1 = vec4(); + var arg_2 = vec4(); + var res: vec4 = clamp(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + clamp_2bde41(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + clamp_2bde41(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + clamp_2bde41(); +} diff --git a/test/tint/builtins/gen/var/clamp/2bde41.wgsl.expected.glsl b/test/tint/builtins/gen/var/clamp/2bde41.wgsl.expected.glsl new file mode 100644 index 0000000000..d8b0d40e6e --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/2bde41.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void clamp_2bde41() { + vec4 arg_0 = vec4(0.0f); + vec4 arg_1 = vec4(0.0f); + vec4 arg_2 = vec4(0.0f); + vec4 res = clamp(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + clamp_2bde41(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void clamp_2bde41() { + vec4 arg_0 = vec4(0.0f); + vec4 arg_1 = vec4(0.0f); + vec4 arg_2 = vec4(0.0f); + vec4 res = clamp(arg_0, arg_1, arg_2); +} + +void fragment_main() { + clamp_2bde41(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void clamp_2bde41() { + vec4 arg_0 = vec4(0.0f); + vec4 arg_1 = vec4(0.0f); + vec4 arg_2 = vec4(0.0f); + vec4 res = clamp(arg_0, arg_1, arg_2); +} + +void compute_main() { + clamp_2bde41(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/2bde41.wgsl.expected.hlsl b/test/tint/builtins/gen/var/clamp/2bde41.wgsl.expected.hlsl new file mode 100644 index 0000000000..d7d8d5438a --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/2bde41.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +void clamp_2bde41() { + float4 arg_0 = (0.0f).xxxx; + float4 arg_1 = (0.0f).xxxx; + float4 arg_2 = (0.0f).xxxx; + float4 res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_2bde41(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_2bde41(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_2bde41(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/2bde41.wgsl.expected.msl b/test/tint/builtins/gen/var/clamp/2bde41.wgsl.expected.msl new file mode 100644 index 0000000000..c116dd7d72 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/2bde41.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void clamp_2bde41() { + float4 arg_0 = float4(0.0f); + float4 arg_1 = float4(0.0f); + float4 arg_2 = float4(0.0f); + float4 res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + clamp_2bde41(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + clamp_2bde41(); + return; +} + +kernel void compute_main() { + clamp_2bde41(); + return; +} + diff --git a/test/tint/builtins/gen/var/clamp/2bde41.wgsl.expected.spvasm b/test/tint/builtins/gen/var/clamp/2bde41.wgsl.expected.spvasm new file mode 100644 index 0000000000..f8b46a3caf --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/2bde41.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %clamp_2bde41 "clamp_2bde41" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%clamp_2bde41 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %arg_1 = OpVariable %_ptr_Function_v4float Function %5 + %arg_2 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %5 + OpStore %arg_1 %5 + OpStore %arg_2 %5 + %19 = OpLoad %v4float %arg_0 + %20 = OpLoad %v4float %arg_1 + %21 = OpLoad %v4float %arg_2 + %17 = OpExtInst %v4float %18 NClamp %19 %20 %21 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %clamp_2bde41 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %clamp_2bde41 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %clamp_2bde41 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/clamp/2bde41.wgsl.expected.wgsl b/test/tint/builtins/gen/var/clamp/2bde41.wgsl.expected.wgsl new file mode 100644 index 0000000000..2a3dcf57e9 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/2bde41.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn clamp_2bde41() { + var arg_0 = vec4(); + var arg_1 = vec4(); + var arg_2 = vec4(); + var res : vec4 = clamp(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + clamp_2bde41(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + clamp_2bde41(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + clamp_2bde41(); +} diff --git a/test/tint/builtins/gen/var/clamp/548fc7.wgsl b/test/tint/builtins/gen/var/clamp/548fc7.wgsl new file mode 100644 index 0000000000..9ea35b0327 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/548fc7.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn clamp(vec<3, u32>, vec<3, u32>, vec<3, u32>) -> vec<3, u32> +fn clamp_548fc7() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var arg_2 = vec3(); + var res: vec3 = clamp(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + clamp_548fc7(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + clamp_548fc7(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + clamp_548fc7(); +} diff --git a/test/tint/builtins/gen/var/clamp/548fc7.wgsl.expected.glsl b/test/tint/builtins/gen/var/clamp/548fc7.wgsl.expected.glsl new file mode 100644 index 0000000000..96687576d7 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/548fc7.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void clamp_548fc7() { + uvec3 arg_0 = uvec3(0u); + uvec3 arg_1 = uvec3(0u); + uvec3 arg_2 = uvec3(0u); + uvec3 res = clamp(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + clamp_548fc7(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void clamp_548fc7() { + uvec3 arg_0 = uvec3(0u); + uvec3 arg_1 = uvec3(0u); + uvec3 arg_2 = uvec3(0u); + uvec3 res = clamp(arg_0, arg_1, arg_2); +} + +void fragment_main() { + clamp_548fc7(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void clamp_548fc7() { + uvec3 arg_0 = uvec3(0u); + uvec3 arg_1 = uvec3(0u); + uvec3 arg_2 = uvec3(0u); + uvec3 res = clamp(arg_0, arg_1, arg_2); +} + +void compute_main() { + clamp_548fc7(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/548fc7.wgsl.expected.hlsl b/test/tint/builtins/gen/var/clamp/548fc7.wgsl.expected.hlsl new file mode 100644 index 0000000000..e74913b434 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/548fc7.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +void clamp_548fc7() { + uint3 arg_0 = (0u).xxx; + uint3 arg_1 = (0u).xxx; + uint3 arg_2 = (0u).xxx; + uint3 res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_548fc7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_548fc7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_548fc7(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/548fc7.wgsl.expected.msl b/test/tint/builtins/gen/var/clamp/548fc7.wgsl.expected.msl new file mode 100644 index 0000000000..b1b67365bb --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/548fc7.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void clamp_548fc7() { + uint3 arg_0 = uint3(0u); + uint3 arg_1 = uint3(0u); + uint3 arg_2 = uint3(0u); + uint3 res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + clamp_548fc7(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + clamp_548fc7(); + return; +} + +kernel void compute_main() { + clamp_548fc7(); + return; +} + diff --git a/test/tint/builtins/gen/var/clamp/548fc7.wgsl.expected.spvasm b/test/tint/builtins/gen/var/clamp/548fc7.wgsl.expected.spvasm new file mode 100644 index 0000000000..80218b99e5 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/548fc7.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + %21 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %clamp_548fc7 "clamp_548fc7" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %15 = OpConstantNull %v3uint +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%clamp_548fc7 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3uint Function %15 + %arg_1 = OpVariable %_ptr_Function_v3uint Function %15 + %arg_2 = OpVariable %_ptr_Function_v3uint Function %15 + %res = OpVariable %_ptr_Function_v3uint Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %15 + %22 = OpLoad %v3uint %arg_0 + %23 = OpLoad %v3uint %arg_1 + %24 = OpLoad %v3uint %arg_2 + %20 = OpExtInst %v3uint %21 UClamp %22 %23 %24 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %clamp_548fc7 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %clamp_548fc7 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %clamp_548fc7 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/clamp/548fc7.wgsl.expected.wgsl b/test/tint/builtins/gen/var/clamp/548fc7.wgsl.expected.wgsl new file mode 100644 index 0000000000..bf9f086f9a --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/548fc7.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn clamp_548fc7() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var arg_2 = vec3(); + var res : vec3 = clamp(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + clamp_548fc7(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + clamp_548fc7(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + clamp_548fc7(); +} diff --git a/test/tint/builtins/gen/var/clamp/5f0819.wgsl b/test/tint/builtins/gen/var/clamp/5f0819.wgsl new file mode 100644 index 0000000000..96b23a5502 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/5f0819.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn clamp(vec<3, i32>, vec<3, i32>, vec<3, i32>) -> vec<3, i32> +fn clamp_5f0819() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var arg_2 = vec3(); + var res: vec3 = clamp(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + clamp_5f0819(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + clamp_5f0819(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + clamp_5f0819(); +} diff --git a/test/tint/builtins/gen/var/clamp/5f0819.wgsl.expected.glsl b/test/tint/builtins/gen/var/clamp/5f0819.wgsl.expected.glsl new file mode 100644 index 0000000000..c33d7f6702 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/5f0819.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void clamp_5f0819() { + ivec3 arg_0 = ivec3(0); + ivec3 arg_1 = ivec3(0); + ivec3 arg_2 = ivec3(0); + ivec3 res = clamp(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + clamp_5f0819(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void clamp_5f0819() { + ivec3 arg_0 = ivec3(0); + ivec3 arg_1 = ivec3(0); + ivec3 arg_2 = ivec3(0); + ivec3 res = clamp(arg_0, arg_1, arg_2); +} + +void fragment_main() { + clamp_5f0819(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void clamp_5f0819() { + ivec3 arg_0 = ivec3(0); + ivec3 arg_1 = ivec3(0); + ivec3 arg_2 = ivec3(0); + ivec3 res = clamp(arg_0, arg_1, arg_2); +} + +void compute_main() { + clamp_5f0819(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/5f0819.wgsl.expected.hlsl b/test/tint/builtins/gen/var/clamp/5f0819.wgsl.expected.hlsl new file mode 100644 index 0000000000..b09cac0f90 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/5f0819.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +void clamp_5f0819() { + int3 arg_0 = (0).xxx; + int3 arg_1 = (0).xxx; + int3 arg_2 = (0).xxx; + int3 res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_5f0819(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_5f0819(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_5f0819(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/5f0819.wgsl.expected.msl b/test/tint/builtins/gen/var/clamp/5f0819.wgsl.expected.msl new file mode 100644 index 0000000000..dee705b7a2 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/5f0819.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void clamp_5f0819() { + int3 arg_0 = int3(0); + int3 arg_1 = int3(0); + int3 arg_2 = int3(0); + int3 res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + clamp_5f0819(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + clamp_5f0819(); + return; +} + +kernel void compute_main() { + clamp_5f0819(); + return; +} + diff --git a/test/tint/builtins/gen/var/clamp/5f0819.wgsl.expected.spvasm b/test/tint/builtins/gen/var/clamp/5f0819.wgsl.expected.spvasm new file mode 100644 index 0000000000..9006081021 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/5f0819.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + %21 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %clamp_5f0819 "clamp_5f0819" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %15 = OpConstantNull %v3int +%_ptr_Function_v3int = OpTypePointer Function %v3int + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%clamp_5f0819 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3int Function %15 + %arg_1 = OpVariable %_ptr_Function_v3int Function %15 + %arg_2 = OpVariable %_ptr_Function_v3int Function %15 + %res = OpVariable %_ptr_Function_v3int Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %15 + %22 = OpLoad %v3int %arg_0 + %23 = OpLoad %v3int %arg_1 + %24 = OpLoad %v3int %arg_2 + %20 = OpExtInst %v3int %21 SClamp %22 %23 %24 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %clamp_5f0819 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %clamp_5f0819 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %clamp_5f0819 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/clamp/5f0819.wgsl.expected.wgsl b/test/tint/builtins/gen/var/clamp/5f0819.wgsl.expected.wgsl new file mode 100644 index 0000000000..8a70766f49 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/5f0819.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn clamp_5f0819() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var arg_2 = vec3(); + var res : vec3 = clamp(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + clamp_5f0819(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + clamp_5f0819(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + clamp_5f0819(); +} diff --git a/test/tint/builtins/gen/var/clamp/6c1749.wgsl b/test/tint/builtins/gen/var/clamp/6c1749.wgsl new file mode 100644 index 0000000000..fdb16e616f --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/6c1749.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn clamp(vec<2, i32>, vec<2, i32>, vec<2, i32>) -> vec<2, i32> +fn clamp_6c1749() { + var arg_0 = vec2(); + var arg_1 = vec2(); + var arg_2 = vec2(); + var res: vec2 = clamp(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + clamp_6c1749(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + clamp_6c1749(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + clamp_6c1749(); +} diff --git a/test/tint/builtins/gen/var/clamp/6c1749.wgsl.expected.glsl b/test/tint/builtins/gen/var/clamp/6c1749.wgsl.expected.glsl new file mode 100644 index 0000000000..f1d0fbfc83 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/6c1749.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void clamp_6c1749() { + ivec2 arg_0 = ivec2(0); + ivec2 arg_1 = ivec2(0); + ivec2 arg_2 = ivec2(0); + ivec2 res = clamp(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + clamp_6c1749(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void clamp_6c1749() { + ivec2 arg_0 = ivec2(0); + ivec2 arg_1 = ivec2(0); + ivec2 arg_2 = ivec2(0); + ivec2 res = clamp(arg_0, arg_1, arg_2); +} + +void fragment_main() { + clamp_6c1749(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void clamp_6c1749() { + ivec2 arg_0 = ivec2(0); + ivec2 arg_1 = ivec2(0); + ivec2 arg_2 = ivec2(0); + ivec2 res = clamp(arg_0, arg_1, arg_2); +} + +void compute_main() { + clamp_6c1749(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/6c1749.wgsl.expected.hlsl b/test/tint/builtins/gen/var/clamp/6c1749.wgsl.expected.hlsl new file mode 100644 index 0000000000..934e1d44c1 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/6c1749.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +void clamp_6c1749() { + int2 arg_0 = (0).xx; + int2 arg_1 = (0).xx; + int2 arg_2 = (0).xx; + int2 res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_6c1749(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_6c1749(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_6c1749(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/6c1749.wgsl.expected.msl b/test/tint/builtins/gen/var/clamp/6c1749.wgsl.expected.msl new file mode 100644 index 0000000000..0faacb464f --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/6c1749.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void clamp_6c1749() { + int2 arg_0 = int2(0); + int2 arg_1 = int2(0); + int2 arg_2 = int2(0); + int2 res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + clamp_6c1749(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + clamp_6c1749(); + return; +} + +kernel void compute_main() { + clamp_6c1749(); + return; +} + diff --git a/test/tint/builtins/gen/var/clamp/6c1749.wgsl.expected.spvasm b/test/tint/builtins/gen/var/clamp/6c1749.wgsl.expected.spvasm new file mode 100644 index 0000000000..643fab2c9a --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/6c1749.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + %21 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %clamp_6c1749 "clamp_6c1749" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %15 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%clamp_6c1749 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2int Function %15 + %arg_1 = OpVariable %_ptr_Function_v2int Function %15 + %arg_2 = OpVariable %_ptr_Function_v2int Function %15 + %res = OpVariable %_ptr_Function_v2int Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %15 + %22 = OpLoad %v2int %arg_0 + %23 = OpLoad %v2int %arg_1 + %24 = OpLoad %v2int %arg_2 + %20 = OpExtInst %v2int %21 SClamp %22 %23 %24 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %clamp_6c1749 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %clamp_6c1749 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %clamp_6c1749 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/clamp/6c1749.wgsl.expected.wgsl b/test/tint/builtins/gen/var/clamp/6c1749.wgsl.expected.wgsl new file mode 100644 index 0000000000..f2882ec941 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/6c1749.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn clamp_6c1749() { + var arg_0 = vec2(); + var arg_1 = vec2(); + var arg_2 = vec2(); + var res : vec2 = clamp(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + clamp_6c1749(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + clamp_6c1749(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + clamp_6c1749(); +} diff --git a/test/tint/builtins/gen/var/clamp/7706d7.wgsl b/test/tint/builtins/gen/var/clamp/7706d7.wgsl new file mode 100644 index 0000000000..c708aeb4ef --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/7706d7.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn clamp(vec<2, u32>, vec<2, u32>, vec<2, u32>) -> vec<2, u32> +fn clamp_7706d7() { + var arg_0 = vec2(); + var arg_1 = vec2(); + var arg_2 = vec2(); + var res: vec2 = clamp(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + clamp_7706d7(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + clamp_7706d7(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + clamp_7706d7(); +} diff --git a/test/tint/builtins/gen/var/clamp/7706d7.wgsl.expected.glsl b/test/tint/builtins/gen/var/clamp/7706d7.wgsl.expected.glsl new file mode 100644 index 0000000000..643a5533d8 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/7706d7.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void clamp_7706d7() { + uvec2 arg_0 = uvec2(0u); + uvec2 arg_1 = uvec2(0u); + uvec2 arg_2 = uvec2(0u); + uvec2 res = clamp(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + clamp_7706d7(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void clamp_7706d7() { + uvec2 arg_0 = uvec2(0u); + uvec2 arg_1 = uvec2(0u); + uvec2 arg_2 = uvec2(0u); + uvec2 res = clamp(arg_0, arg_1, arg_2); +} + +void fragment_main() { + clamp_7706d7(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void clamp_7706d7() { + uvec2 arg_0 = uvec2(0u); + uvec2 arg_1 = uvec2(0u); + uvec2 arg_2 = uvec2(0u); + uvec2 res = clamp(arg_0, arg_1, arg_2); +} + +void compute_main() { + clamp_7706d7(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/7706d7.wgsl.expected.hlsl b/test/tint/builtins/gen/var/clamp/7706d7.wgsl.expected.hlsl new file mode 100644 index 0000000000..89aea9d0f7 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/7706d7.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +void clamp_7706d7() { + uint2 arg_0 = (0u).xx; + uint2 arg_1 = (0u).xx; + uint2 arg_2 = (0u).xx; + uint2 res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_7706d7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_7706d7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_7706d7(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/7706d7.wgsl.expected.msl b/test/tint/builtins/gen/var/clamp/7706d7.wgsl.expected.msl new file mode 100644 index 0000000000..1655a2b622 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/7706d7.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void clamp_7706d7() { + uint2 arg_0 = uint2(0u); + uint2 arg_1 = uint2(0u); + uint2 arg_2 = uint2(0u); + uint2 res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + clamp_7706d7(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + clamp_7706d7(); + return; +} + +kernel void compute_main() { + clamp_7706d7(); + return; +} + diff --git a/test/tint/builtins/gen/var/clamp/7706d7.wgsl.expected.spvasm b/test/tint/builtins/gen/var/clamp/7706d7.wgsl.expected.spvasm new file mode 100644 index 0000000000..8f20ceae7c --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/7706d7.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + %21 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %clamp_7706d7 "clamp_7706d7" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %15 = OpConstantNull %v2uint +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%clamp_7706d7 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2uint Function %15 + %arg_1 = OpVariable %_ptr_Function_v2uint Function %15 + %arg_2 = OpVariable %_ptr_Function_v2uint Function %15 + %res = OpVariable %_ptr_Function_v2uint Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %15 + %22 = OpLoad %v2uint %arg_0 + %23 = OpLoad %v2uint %arg_1 + %24 = OpLoad %v2uint %arg_2 + %20 = OpExtInst %v2uint %21 UClamp %22 %23 %24 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %clamp_7706d7 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %clamp_7706d7 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %clamp_7706d7 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/clamp/7706d7.wgsl.expected.wgsl b/test/tint/builtins/gen/var/clamp/7706d7.wgsl.expected.wgsl new file mode 100644 index 0000000000..cde513dd5a --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/7706d7.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn clamp_7706d7() { + var arg_0 = vec2(); + var arg_1 = vec2(); + var arg_2 = vec2(); + var res : vec2 = clamp(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + clamp_7706d7(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + clamp_7706d7(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + clamp_7706d7(); +} diff --git a/test/tint/builtins/gen/var/clamp/867397.wgsl b/test/tint/builtins/gen/var/clamp/867397.wgsl new file mode 100644 index 0000000000..8b545a0808 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/867397.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn clamp(vec<3, f32>, vec<3, f32>, vec<3, f32>) -> vec<3, f32> +fn clamp_867397() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var arg_2 = vec3(); + var res: vec3 = clamp(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + clamp_867397(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + clamp_867397(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + clamp_867397(); +} diff --git a/test/tint/builtins/gen/var/clamp/867397.wgsl.expected.glsl b/test/tint/builtins/gen/var/clamp/867397.wgsl.expected.glsl new file mode 100644 index 0000000000..73c0f824c1 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/867397.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void clamp_867397() { + vec3 arg_0 = vec3(0.0f); + vec3 arg_1 = vec3(0.0f); + vec3 arg_2 = vec3(0.0f); + vec3 res = clamp(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + clamp_867397(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void clamp_867397() { + vec3 arg_0 = vec3(0.0f); + vec3 arg_1 = vec3(0.0f); + vec3 arg_2 = vec3(0.0f); + vec3 res = clamp(arg_0, arg_1, arg_2); +} + +void fragment_main() { + clamp_867397(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void clamp_867397() { + vec3 arg_0 = vec3(0.0f); + vec3 arg_1 = vec3(0.0f); + vec3 arg_2 = vec3(0.0f); + vec3 res = clamp(arg_0, arg_1, arg_2); +} + +void compute_main() { + clamp_867397(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/867397.wgsl.expected.hlsl b/test/tint/builtins/gen/var/clamp/867397.wgsl.expected.hlsl new file mode 100644 index 0000000000..5a3607e2dc --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/867397.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +void clamp_867397() { + float3 arg_0 = (0.0f).xxx; + float3 arg_1 = (0.0f).xxx; + float3 arg_2 = (0.0f).xxx; + float3 res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_867397(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_867397(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_867397(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/867397.wgsl.expected.msl b/test/tint/builtins/gen/var/clamp/867397.wgsl.expected.msl new file mode 100644 index 0000000000..b722368891 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/867397.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void clamp_867397() { + float3 arg_0 = float3(0.0f); + float3 arg_1 = float3(0.0f); + float3 arg_2 = float3(0.0f); + float3 res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + clamp_867397(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + clamp_867397(); + return; +} + +kernel void compute_main() { + clamp_867397(); + return; +} + diff --git a/test/tint/builtins/gen/var/clamp/867397.wgsl.expected.spvasm b/test/tint/builtins/gen/var/clamp/867397.wgsl.expected.spvasm new file mode 100644 index 0000000000..a27fcf4c44 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/867397.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %clamp_867397 "clamp_867397" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %14 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%clamp_867397 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %14 + %arg_1 = OpVariable %_ptr_Function_v3float Function %14 + %arg_2 = OpVariable %_ptr_Function_v3float Function %14 + %res = OpVariable %_ptr_Function_v3float Function %14 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + OpStore %arg_2 %14 + %21 = OpLoad %v3float %arg_0 + %22 = OpLoad %v3float %arg_1 + %23 = OpLoad %v3float %arg_2 + %19 = OpExtInst %v3float %20 NClamp %21 %22 %23 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %clamp_867397 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %clamp_867397 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %clamp_867397 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/clamp/867397.wgsl.expected.wgsl b/test/tint/builtins/gen/var/clamp/867397.wgsl.expected.wgsl new file mode 100644 index 0000000000..a175b663f6 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/867397.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn clamp_867397() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var arg_2 = vec3(); + var res : vec3 = clamp(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + clamp_867397(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + clamp_867397(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + clamp_867397(); +} diff --git a/test/tint/builtins/gen/var/clamp/a2de25.wgsl b/test/tint/builtins/gen/var/clamp/a2de25.wgsl new file mode 100644 index 0000000000..76d9689f40 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/a2de25.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn clamp(u32, u32, u32) -> u32 +fn clamp_a2de25() { + var arg_0 = 1u; + var arg_1 = 1u; + var arg_2 = 1u; + var res: u32 = clamp(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + clamp_a2de25(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + clamp_a2de25(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + clamp_a2de25(); +} diff --git a/test/tint/builtins/gen/var/clamp/a2de25.wgsl.expected.glsl b/test/tint/builtins/gen/var/clamp/a2de25.wgsl.expected.glsl new file mode 100644 index 0000000000..93c876b3fe --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/a2de25.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void clamp_a2de25() { + uint arg_0 = 1u; + uint arg_1 = 1u; + uint arg_2 = 1u; + uint res = clamp(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + clamp_a2de25(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void clamp_a2de25() { + uint arg_0 = 1u; + uint arg_1 = 1u; + uint arg_2 = 1u; + uint res = clamp(arg_0, arg_1, arg_2); +} + +void fragment_main() { + clamp_a2de25(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void clamp_a2de25() { + uint arg_0 = 1u; + uint arg_1 = 1u; + uint arg_2 = 1u; + uint res = clamp(arg_0, arg_1, arg_2); +} + +void compute_main() { + clamp_a2de25(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/a2de25.wgsl.expected.hlsl b/test/tint/builtins/gen/var/clamp/a2de25.wgsl.expected.hlsl new file mode 100644 index 0000000000..ec730dace5 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/a2de25.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +void clamp_a2de25() { + uint arg_0 = 1u; + uint arg_1 = 1u; + uint arg_2 = 1u; + uint res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_a2de25(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_a2de25(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_a2de25(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/a2de25.wgsl.expected.msl b/test/tint/builtins/gen/var/clamp/a2de25.wgsl.expected.msl new file mode 100644 index 0000000000..e22ed1be47 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/a2de25.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void clamp_a2de25() { + uint arg_0 = 1u; + uint arg_1 = 1u; + uint arg_2 = 1u; + uint res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + clamp_a2de25(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + clamp_a2de25(); + return; +} + +kernel void compute_main() { + clamp_a2de25(); + return; +} + diff --git a/test/tint/builtins/gen/var/clamp/a2de25.wgsl.expected.spvasm b/test/tint/builtins/gen/var/clamp/a2de25.wgsl.expected.spvasm new file mode 100644 index 0000000000..3e53f306ad --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/a2de25.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + %21 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %clamp_a2de25 "clamp_a2de25" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %17 = OpConstantNull %uint + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%clamp_a2de25 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_uint Function %17 + %arg_1 = OpVariable %_ptr_Function_uint Function %17 + %arg_2 = OpVariable %_ptr_Function_uint Function %17 + %res = OpVariable %_ptr_Function_uint Function %17 + OpStore %arg_0 %uint_1 + OpStore %arg_1 %uint_1 + OpStore %arg_2 %uint_1 + %22 = OpLoad %uint %arg_0 + %23 = OpLoad %uint %arg_1 + %24 = OpLoad %uint %arg_2 + %20 = OpExtInst %uint %21 UClamp %22 %23 %24 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %clamp_a2de25 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %clamp_a2de25 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %clamp_a2de25 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/clamp/a2de25.wgsl.expected.wgsl b/test/tint/builtins/gen/var/clamp/a2de25.wgsl.expected.wgsl new file mode 100644 index 0000000000..33b39e682a --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/a2de25.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn clamp_a2de25() { + var arg_0 = 1u; + var arg_1 = 1u; + var arg_2 = 1u; + var res : u32 = clamp(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + clamp_a2de25(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + clamp_a2de25(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + clamp_a2de25(); +} diff --git a/test/tint/builtins/gen/var/clamp/b07c65.wgsl b/test/tint/builtins/gen/var/clamp/b07c65.wgsl new file mode 100644 index 0000000000..be73d24f20 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/b07c65.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn clamp(i32, i32, i32) -> i32 +fn clamp_b07c65() { + var arg_0 = 1; + var arg_1 = 1; + var arg_2 = 1; + var res: i32 = clamp(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + clamp_b07c65(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + clamp_b07c65(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + clamp_b07c65(); +} diff --git a/test/tint/builtins/gen/var/clamp/b07c65.wgsl.expected.glsl b/test/tint/builtins/gen/var/clamp/b07c65.wgsl.expected.glsl new file mode 100644 index 0000000000..4e79afee70 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/b07c65.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void clamp_b07c65() { + int arg_0 = 1; + int arg_1 = 1; + int arg_2 = 1; + int res = clamp(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + clamp_b07c65(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void clamp_b07c65() { + int arg_0 = 1; + int arg_1 = 1; + int arg_2 = 1; + int res = clamp(arg_0, arg_1, arg_2); +} + +void fragment_main() { + clamp_b07c65(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void clamp_b07c65() { + int arg_0 = 1; + int arg_1 = 1; + int arg_2 = 1; + int res = clamp(arg_0, arg_1, arg_2); +} + +void compute_main() { + clamp_b07c65(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/b07c65.wgsl.expected.hlsl b/test/tint/builtins/gen/var/clamp/b07c65.wgsl.expected.hlsl new file mode 100644 index 0000000000..42208eb360 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/b07c65.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +void clamp_b07c65() { + int arg_0 = 1; + int arg_1 = 1; + int arg_2 = 1; + int res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_b07c65(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_b07c65(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_b07c65(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/b07c65.wgsl.expected.msl b/test/tint/builtins/gen/var/clamp/b07c65.wgsl.expected.msl new file mode 100644 index 0000000000..90b191c737 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/b07c65.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void clamp_b07c65() { + int arg_0 = 1; + int arg_1 = 1; + int arg_2 = 1; + int res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + clamp_b07c65(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + clamp_b07c65(); + return; +} + +kernel void compute_main() { + clamp_b07c65(); + return; +} + diff --git a/test/tint/builtins/gen/var/clamp/b07c65.wgsl.expected.spvasm b/test/tint/builtins/gen/var/clamp/b07c65.wgsl.expected.spvasm new file mode 100644 index 0000000000..e5935027da --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/b07c65.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + %21 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %clamp_b07c65 "clamp_b07c65" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %17 = OpConstantNull %int + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%clamp_b07c65 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_int Function %17 + %arg_1 = OpVariable %_ptr_Function_int Function %17 + %arg_2 = OpVariable %_ptr_Function_int Function %17 + %res = OpVariable %_ptr_Function_int Function %17 + OpStore %arg_0 %int_1 + OpStore %arg_1 %int_1 + OpStore %arg_2 %int_1 + %22 = OpLoad %int %arg_0 + %23 = OpLoad %int %arg_1 + %24 = OpLoad %int %arg_2 + %20 = OpExtInst %int %21 SClamp %22 %23 %24 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %clamp_b07c65 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %clamp_b07c65 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %clamp_b07c65 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/clamp/b07c65.wgsl.expected.wgsl b/test/tint/builtins/gen/var/clamp/b07c65.wgsl.expected.wgsl new file mode 100644 index 0000000000..7e9b627164 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/b07c65.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn clamp_b07c65() { + var arg_0 = 1; + var arg_1 = 1; + var arg_2 = 1; + var res : i32 = clamp(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + clamp_b07c65(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + clamp_b07c65(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + clamp_b07c65(); +} diff --git a/test/tint/builtins/gen/var/clamp/bd43ce.wgsl b/test/tint/builtins/gen/var/clamp/bd43ce.wgsl new file mode 100644 index 0000000000..1c3d30035f --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/bd43ce.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn clamp(vec<4, u32>, vec<4, u32>, vec<4, u32>) -> vec<4, u32> +fn clamp_bd43ce() { + var arg_0 = vec4(); + var arg_1 = vec4(); + var arg_2 = vec4(); + var res: vec4 = clamp(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + clamp_bd43ce(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + clamp_bd43ce(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + clamp_bd43ce(); +} diff --git a/test/tint/builtins/gen/var/clamp/bd43ce.wgsl.expected.glsl b/test/tint/builtins/gen/var/clamp/bd43ce.wgsl.expected.glsl new file mode 100644 index 0000000000..37aca593ba --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/bd43ce.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void clamp_bd43ce() { + uvec4 arg_0 = uvec4(0u); + uvec4 arg_1 = uvec4(0u); + uvec4 arg_2 = uvec4(0u); + uvec4 res = clamp(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + clamp_bd43ce(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void clamp_bd43ce() { + uvec4 arg_0 = uvec4(0u); + uvec4 arg_1 = uvec4(0u); + uvec4 arg_2 = uvec4(0u); + uvec4 res = clamp(arg_0, arg_1, arg_2); +} + +void fragment_main() { + clamp_bd43ce(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void clamp_bd43ce() { + uvec4 arg_0 = uvec4(0u); + uvec4 arg_1 = uvec4(0u); + uvec4 arg_2 = uvec4(0u); + uvec4 res = clamp(arg_0, arg_1, arg_2); +} + +void compute_main() { + clamp_bd43ce(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/bd43ce.wgsl.expected.hlsl b/test/tint/builtins/gen/var/clamp/bd43ce.wgsl.expected.hlsl new file mode 100644 index 0000000000..44a95928e3 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/bd43ce.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +void clamp_bd43ce() { + uint4 arg_0 = (0u).xxxx; + uint4 arg_1 = (0u).xxxx; + uint4 arg_2 = (0u).xxxx; + uint4 res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_bd43ce(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_bd43ce(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_bd43ce(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/bd43ce.wgsl.expected.msl b/test/tint/builtins/gen/var/clamp/bd43ce.wgsl.expected.msl new file mode 100644 index 0000000000..a20ab6d0ba --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/bd43ce.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void clamp_bd43ce() { + uint4 arg_0 = uint4(0u); + uint4 arg_1 = uint4(0u); + uint4 arg_2 = uint4(0u); + uint4 res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + clamp_bd43ce(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + clamp_bd43ce(); + return; +} + +kernel void compute_main() { + clamp_bd43ce(); + return; +} + diff --git a/test/tint/builtins/gen/var/clamp/bd43ce.wgsl.expected.spvasm b/test/tint/builtins/gen/var/clamp/bd43ce.wgsl.expected.spvasm new file mode 100644 index 0000000000..c4c81a1ea5 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/bd43ce.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + %21 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %clamp_bd43ce "clamp_bd43ce" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + %15 = OpConstantNull %v4uint +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%clamp_bd43ce = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4uint Function %15 + %arg_1 = OpVariable %_ptr_Function_v4uint Function %15 + %arg_2 = OpVariable %_ptr_Function_v4uint Function %15 + %res = OpVariable %_ptr_Function_v4uint Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %15 + %22 = OpLoad %v4uint %arg_0 + %23 = OpLoad %v4uint %arg_1 + %24 = OpLoad %v4uint %arg_2 + %20 = OpExtInst %v4uint %21 UClamp %22 %23 %24 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %clamp_bd43ce + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %clamp_bd43ce + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %clamp_bd43ce + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/clamp/bd43ce.wgsl.expected.wgsl b/test/tint/builtins/gen/var/clamp/bd43ce.wgsl.expected.wgsl new file mode 100644 index 0000000000..e3cd79c2a2 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/bd43ce.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn clamp_bd43ce() { + var arg_0 = vec4(); + var arg_1 = vec4(); + var arg_2 = vec4(); + var res : vec4 = clamp(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + clamp_bd43ce(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + clamp_bd43ce(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + clamp_bd43ce(); +} diff --git a/test/tint/builtins/gen/var/cos/16dc15.wgsl b/test/tint/builtins/gen/var/cos/16dc15.wgsl new file mode 100644 index 0000000000..05cfa561d5 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/16dc15.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn cos(vec<3, f32>) -> vec<3, f32> +fn cos_16dc15() { + var arg_0 = vec3(); + var res: vec3 = cos(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + cos_16dc15(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + cos_16dc15(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + cos_16dc15(); +} diff --git a/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.glsl b/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.glsl new file mode 100644 index 0000000000..21b1448297 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void cos_16dc15() { + vec3 arg_0 = vec3(0.0f); + vec3 res = cos(arg_0); +} + +vec4 vertex_main() { + cos_16dc15(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void cos_16dc15() { + vec3 arg_0 = vec3(0.0f); + vec3 res = cos(arg_0); +} + +void fragment_main() { + cos_16dc15(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void cos_16dc15() { + vec3 arg_0 = vec3(0.0f); + vec3 res = cos(arg_0); +} + +void compute_main() { + cos_16dc15(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.hlsl b/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.hlsl new file mode 100644 index 0000000000..73f5a2f83e --- /dev/null +++ b/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void cos_16dc15() { + float3 arg_0 = (0.0f).xxx; + float3 res = cos(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cos_16dc15(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cos_16dc15(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cos_16dc15(); + return; +} diff --git a/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.msl b/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.msl new file mode 100644 index 0000000000..a93875edd9 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void cos_16dc15() { + float3 arg_0 = float3(0.0f); + float3 res = cos(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cos_16dc15(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cos_16dc15(); + return; +} + +kernel void compute_main() { + cos_16dc15(); + return; +} + diff --git a/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.spvasm b/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.spvasm new file mode 100644 index 0000000000..d2308306e0 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cos_16dc15 "cos_16dc15" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %14 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %cos_16dc15 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %14 + %res = OpVariable %_ptr_Function_v3float Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %v3float %arg_0 + %17 = OpExtInst %v3float %18 Cos %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %cos_16dc15 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %cos_16dc15 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %cos_16dc15 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.wgsl b/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.wgsl new file mode 100644 index 0000000000..9c71b8699e --- /dev/null +++ b/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn cos_16dc15() { + var arg_0 = vec3(); + var res : vec3 = cos(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + cos_16dc15(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + cos_16dc15(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + cos_16dc15(); +} diff --git a/test/tint/builtins/gen/var/cos/29d66d.wgsl b/test/tint/builtins/gen/var/cos/29d66d.wgsl new file mode 100644 index 0000000000..9490acc5f6 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/29d66d.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn cos(vec<4, f32>) -> vec<4, f32> +fn cos_29d66d() { + var arg_0 = vec4(); + var res: vec4 = cos(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + cos_29d66d(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + cos_29d66d(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + cos_29d66d(); +} diff --git a/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.glsl b/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.glsl new file mode 100644 index 0000000000..65c80351d2 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void cos_29d66d() { + vec4 arg_0 = vec4(0.0f); + vec4 res = cos(arg_0); +} + +vec4 vertex_main() { + cos_29d66d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void cos_29d66d() { + vec4 arg_0 = vec4(0.0f); + vec4 res = cos(arg_0); +} + +void fragment_main() { + cos_29d66d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void cos_29d66d() { + vec4 arg_0 = vec4(0.0f); + vec4 res = cos(arg_0); +} + +void compute_main() { + cos_29d66d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.hlsl b/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.hlsl new file mode 100644 index 0000000000..9a9e05eb3b --- /dev/null +++ b/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void cos_29d66d() { + float4 arg_0 = (0.0f).xxxx; + float4 res = cos(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cos_29d66d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cos_29d66d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cos_29d66d(); + return; +} diff --git a/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.msl b/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.msl new file mode 100644 index 0000000000..6f3ca2bb1b --- /dev/null +++ b/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void cos_29d66d() { + float4 arg_0 = float4(0.0f); + float4 res = cos(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cos_29d66d(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cos_29d66d(); + return; +} + +kernel void compute_main() { + cos_29d66d(); + return; +} + diff --git a/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.spvasm new file mode 100644 index 0000000000..8c921e770a --- /dev/null +++ b/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cos_29d66d "cos_29d66d" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %cos_29d66d = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %5 + %17 = OpLoad %v4float %arg_0 + %15 = OpExtInst %v4float %16 Cos %17 + OpStore %res %15 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %cos_29d66d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %cos_29d66d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %cos_29d66d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.wgsl new file mode 100644 index 0000000000..7d9b60e828 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn cos_29d66d() { + var arg_0 = vec4(); + var res : vec4 = cos(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + cos_29d66d(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + cos_29d66d(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + cos_29d66d(); +} diff --git a/test/tint/builtins/gen/var/cos/c3b486.wgsl b/test/tint/builtins/gen/var/cos/c3b486.wgsl new file mode 100644 index 0000000000..263bdecc59 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/c3b486.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn cos(vec<2, f32>) -> vec<2, f32> +fn cos_c3b486() { + var arg_0 = vec2(); + var res: vec2 = cos(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + cos_c3b486(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + cos_c3b486(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + cos_c3b486(); +} diff --git a/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.glsl b/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.glsl new file mode 100644 index 0000000000..03fb395b16 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void cos_c3b486() { + vec2 arg_0 = vec2(0.0f); + vec2 res = cos(arg_0); +} + +vec4 vertex_main() { + cos_c3b486(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void cos_c3b486() { + vec2 arg_0 = vec2(0.0f); + vec2 res = cos(arg_0); +} + +void fragment_main() { + cos_c3b486(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void cos_c3b486() { + vec2 arg_0 = vec2(0.0f); + vec2 res = cos(arg_0); +} + +void compute_main() { + cos_c3b486(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.hlsl b/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.hlsl new file mode 100644 index 0000000000..cd82afc767 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void cos_c3b486() { + float2 arg_0 = (0.0f).xx; + float2 res = cos(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cos_c3b486(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cos_c3b486(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cos_c3b486(); + return; +} diff --git a/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.msl b/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.msl new file mode 100644 index 0000000000..4e0e3b4a08 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void cos_c3b486() { + float2 arg_0 = float2(0.0f); + float2 res = cos(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cos_c3b486(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cos_c3b486(); + return; +} + +kernel void compute_main() { + cos_c3b486(); + return; +} + diff --git a/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.spvasm b/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.spvasm new file mode 100644 index 0000000000..a4bb57fde2 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cos_c3b486 "cos_c3b486" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %14 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %cos_c3b486 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %14 + %res = OpVariable %_ptr_Function_v2float Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %v2float %arg_0 + %17 = OpExtInst %v2float %18 Cos %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %cos_c3b486 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %cos_c3b486 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %cos_c3b486 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.wgsl b/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.wgsl new file mode 100644 index 0000000000..fab94dacc7 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn cos_c3b486() { + var arg_0 = vec2(); + var res : vec2 = cos(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + cos_c3b486(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + cos_c3b486(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + cos_c3b486(); +} diff --git a/test/tint/builtins/gen/var/cos/c5c28e.wgsl b/test/tint/builtins/gen/var/cos/c5c28e.wgsl new file mode 100644 index 0000000000..b94af0365b --- /dev/null +++ b/test/tint/builtins/gen/var/cos/c5c28e.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn cos(f32) -> f32 +fn cos_c5c28e() { + var arg_0 = 1.0; + var res: f32 = cos(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + cos_c5c28e(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + cos_c5c28e(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + cos_c5c28e(); +} diff --git a/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.glsl b/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.glsl new file mode 100644 index 0000000000..cb5df10552 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void cos_c5c28e() { + float arg_0 = 1.0f; + float res = cos(arg_0); +} + +vec4 vertex_main() { + cos_c5c28e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void cos_c5c28e() { + float arg_0 = 1.0f; + float res = cos(arg_0); +} + +void fragment_main() { + cos_c5c28e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void cos_c5c28e() { + float arg_0 = 1.0f; + float res = cos(arg_0); +} + +void compute_main() { + cos_c5c28e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.hlsl b/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.hlsl new file mode 100644 index 0000000000..d5e81f65c6 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void cos_c5c28e() { + float arg_0 = 1.0f; + float res = cos(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cos_c5c28e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cos_c5c28e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cos_c5c28e(); + return; +} diff --git a/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.msl b/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.msl new file mode 100644 index 0000000000..2eeca23185 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void cos_c5c28e() { + float arg_0 = 1.0f; + float res = cos(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cos_c5c28e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cos_c5c28e(); + return; +} + +kernel void compute_main() { + cos_c5c28e(); + return; +} + diff --git a/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.spvasm new file mode 100644 index 0000000000..e1091134ca --- /dev/null +++ b/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cos_c5c28e "cos_c5c28e" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %20 = OpTypeFunction %v4float + %cos_c5c28e = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + %18 = OpLoad %float %arg_0 + %16 = OpExtInst %float %17 Cos %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %cos_c5c28e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %cos_c5c28e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %cos_c5c28e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.wgsl new file mode 100644 index 0000000000..c6854ffe48 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn cos_c5c28e() { + var arg_0 = 1.0; + var res : f32 = cos(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + cos_c5c28e(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + cos_c5c28e(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + cos_c5c28e(); +} diff --git a/test/tint/builtins/gen/var/cosh/377652.wgsl b/test/tint/builtins/gen/var/cosh/377652.wgsl new file mode 100644 index 0000000000..b6fdb2ef63 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/377652.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn cosh(vec<3, f32>) -> vec<3, f32> +fn cosh_377652() { + var arg_0 = vec3(); + var res: vec3 = cosh(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + cosh_377652(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + cosh_377652(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + cosh_377652(); +} diff --git a/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.glsl b/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.glsl new file mode 100644 index 0000000000..bd306d800b --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void cosh_377652() { + vec3 arg_0 = vec3(0.0f); + vec3 res = cosh(arg_0); +} + +vec4 vertex_main() { + cosh_377652(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void cosh_377652() { + vec3 arg_0 = vec3(0.0f); + vec3 res = cosh(arg_0); +} + +void fragment_main() { + cosh_377652(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void cosh_377652() { + vec3 arg_0 = vec3(0.0f); + vec3 res = cosh(arg_0); +} + +void compute_main() { + cosh_377652(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.hlsl b/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.hlsl new file mode 100644 index 0000000000..4b6ec3e6ab --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void cosh_377652() { + float3 arg_0 = (0.0f).xxx; + float3 res = cosh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cosh_377652(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cosh_377652(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cosh_377652(); + return; +} diff --git a/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.msl b/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.msl new file mode 100644 index 0000000000..e177d54dbc --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void cosh_377652() { + float3 arg_0 = float3(0.0f); + float3 res = cosh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cosh_377652(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cosh_377652(); + return; +} + +kernel void compute_main() { + cosh_377652(); + return; +} + diff --git a/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.spvasm b/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.spvasm new file mode 100644 index 0000000000..4007fb3c59 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cosh_377652 "cosh_377652" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %14 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%cosh_377652 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %14 + %res = OpVariable %_ptr_Function_v3float Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %v3float %arg_0 + %17 = OpExtInst %v3float %18 Cosh %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %cosh_377652 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %cosh_377652 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %cosh_377652 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.wgsl b/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.wgsl new file mode 100644 index 0000000000..308581e53d --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn cosh_377652() { + var arg_0 = vec3(); + var res : vec3 = cosh(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + cosh_377652(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + cosh_377652(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + cosh_377652(); +} diff --git a/test/tint/builtins/gen/var/cosh/c13756.wgsl b/test/tint/builtins/gen/var/cosh/c13756.wgsl new file mode 100644 index 0000000000..898d074978 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/c13756.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn cosh(vec<2, f32>) -> vec<2, f32> +fn cosh_c13756() { + var arg_0 = vec2(); + var res: vec2 = cosh(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + cosh_c13756(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + cosh_c13756(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + cosh_c13756(); +} diff --git a/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.glsl b/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.glsl new file mode 100644 index 0000000000..4d9ef69341 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void cosh_c13756() { + vec2 arg_0 = vec2(0.0f); + vec2 res = cosh(arg_0); +} + +vec4 vertex_main() { + cosh_c13756(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void cosh_c13756() { + vec2 arg_0 = vec2(0.0f); + vec2 res = cosh(arg_0); +} + +void fragment_main() { + cosh_c13756(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void cosh_c13756() { + vec2 arg_0 = vec2(0.0f); + vec2 res = cosh(arg_0); +} + +void compute_main() { + cosh_c13756(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.hlsl b/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.hlsl new file mode 100644 index 0000000000..1c53a74ef4 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void cosh_c13756() { + float2 arg_0 = (0.0f).xx; + float2 res = cosh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cosh_c13756(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cosh_c13756(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cosh_c13756(); + return; +} diff --git a/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.msl b/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.msl new file mode 100644 index 0000000000..4ce9fd6e1a --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void cosh_c13756() { + float2 arg_0 = float2(0.0f); + float2 res = cosh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cosh_c13756(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cosh_c13756(); + return; +} + +kernel void compute_main() { + cosh_c13756(); + return; +} + diff --git a/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.spvasm b/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.spvasm new file mode 100644 index 0000000000..faad53484f --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cosh_c13756 "cosh_c13756" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %14 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%cosh_c13756 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %14 + %res = OpVariable %_ptr_Function_v2float Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %v2float %arg_0 + %17 = OpExtInst %v2float %18 Cosh %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %cosh_c13756 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %cosh_c13756 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %cosh_c13756 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.wgsl b/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.wgsl new file mode 100644 index 0000000000..41a6061df6 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn cosh_c13756() { + var arg_0 = vec2(); + var res : vec2 = cosh(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + cosh_c13756(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + cosh_c13756(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + cosh_c13756(); +} diff --git a/test/tint/builtins/gen/var/cosh/da92dd.wgsl b/test/tint/builtins/gen/var/cosh/da92dd.wgsl new file mode 100644 index 0000000000..fc2f3a6529 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/da92dd.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn cosh(f32) -> f32 +fn cosh_da92dd() { + var arg_0 = 1.0; + var res: f32 = cosh(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + cosh_da92dd(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + cosh_da92dd(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + cosh_da92dd(); +} diff --git a/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.glsl b/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.glsl new file mode 100644 index 0000000000..f87144f079 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void cosh_da92dd() { + float arg_0 = 1.0f; + float res = cosh(arg_0); +} + +vec4 vertex_main() { + cosh_da92dd(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void cosh_da92dd() { + float arg_0 = 1.0f; + float res = cosh(arg_0); +} + +void fragment_main() { + cosh_da92dd(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void cosh_da92dd() { + float arg_0 = 1.0f; + float res = cosh(arg_0); +} + +void compute_main() { + cosh_da92dd(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.hlsl b/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.hlsl new file mode 100644 index 0000000000..657c3dd842 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void cosh_da92dd() { + float arg_0 = 1.0f; + float res = cosh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cosh_da92dd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cosh_da92dd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cosh_da92dd(); + return; +} diff --git a/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.msl b/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.msl new file mode 100644 index 0000000000..ed4cc477f5 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void cosh_da92dd() { + float arg_0 = 1.0f; + float res = cosh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cosh_da92dd(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cosh_da92dd(); + return; +} + +kernel void compute_main() { + cosh_da92dd(); + return; +} + diff --git a/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.spvasm b/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.spvasm new file mode 100644 index 0000000000..c82b34fb4c --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cosh_da92dd "cosh_da92dd" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %20 = OpTypeFunction %v4float +%cosh_da92dd = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + %18 = OpLoad %float %arg_0 + %16 = OpExtInst %float %17 Cosh %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %cosh_da92dd + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %cosh_da92dd + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %cosh_da92dd + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.wgsl b/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.wgsl new file mode 100644 index 0000000000..5a09829866 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn cosh_da92dd() { + var arg_0 = 1.0; + var res : f32 = cosh(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + cosh_da92dd(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + cosh_da92dd(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + cosh_da92dd(); +} diff --git a/test/tint/builtins/gen/var/cosh/e0c1de.wgsl b/test/tint/builtins/gen/var/cosh/e0c1de.wgsl new file mode 100644 index 0000000000..926fd6771b --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/e0c1de.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn cosh(vec<4, f32>) -> vec<4, f32> +fn cosh_e0c1de() { + var arg_0 = vec4(); + var res: vec4 = cosh(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + cosh_e0c1de(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + cosh_e0c1de(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + cosh_e0c1de(); +} diff --git a/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.glsl b/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.glsl new file mode 100644 index 0000000000..713d23de4f --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void cosh_e0c1de() { + vec4 arg_0 = vec4(0.0f); + vec4 res = cosh(arg_0); +} + +vec4 vertex_main() { + cosh_e0c1de(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void cosh_e0c1de() { + vec4 arg_0 = vec4(0.0f); + vec4 res = cosh(arg_0); +} + +void fragment_main() { + cosh_e0c1de(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void cosh_e0c1de() { + vec4 arg_0 = vec4(0.0f); + vec4 res = cosh(arg_0); +} + +void compute_main() { + cosh_e0c1de(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.hlsl b/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.hlsl new file mode 100644 index 0000000000..57edfcd129 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void cosh_e0c1de() { + float4 arg_0 = (0.0f).xxxx; + float4 res = cosh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cosh_e0c1de(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cosh_e0c1de(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cosh_e0c1de(); + return; +} diff --git a/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.msl b/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.msl new file mode 100644 index 0000000000..dba84b5ff0 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void cosh_e0c1de() { + float4 arg_0 = float4(0.0f); + float4 res = cosh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cosh_e0c1de(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cosh_e0c1de(); + return; +} + +kernel void compute_main() { + cosh_e0c1de(); + return; +} + diff --git a/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.spvasm b/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.spvasm new file mode 100644 index 0000000000..b788bac726 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cosh_e0c1de "cosh_e0c1de" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%cosh_e0c1de = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %5 + %17 = OpLoad %v4float %arg_0 + %15 = OpExtInst %v4float %16 Cosh %17 + OpStore %res %15 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %cosh_e0c1de + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %cosh_e0c1de + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %cosh_e0c1de + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.wgsl b/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.wgsl new file mode 100644 index 0000000000..51b4fd511b --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn cosh_e0c1de() { + var arg_0 = vec4(); + var res : vec4 = cosh(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + cosh_e0c1de(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + cosh_e0c1de(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + cosh_e0c1de(); +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/208d46.wgsl b/test/tint/builtins/gen/var/countLeadingZeros/208d46.wgsl new file mode 100644 index 0000000000..40b1848062 --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/208d46.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countLeadingZeros(u32) -> u32 +fn countLeadingZeros_208d46() { + var arg_0 = 1u; + var res: u32 = countLeadingZeros(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + countLeadingZeros_208d46(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + countLeadingZeros_208d46(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + countLeadingZeros_208d46(); +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/208d46.wgsl.expected.glsl b/test/tint/builtins/gen/var/countLeadingZeros/208d46.wgsl.expected.glsl new file mode 100644 index 0000000000..d416594795 --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/208d46.wgsl.expected.glsl @@ -0,0 +1,97 @@ +#version 310 es + +uint tint_count_leading_zeros(uint v) { + uint x = uint(v); + uint b16 = ((x <= 65535u) ? 16u : 0u); + x = (x << b16); + uint b8 = ((x <= 16777215u) ? 8u : 0u); + x = (x << b8); + uint b4 = ((x <= 268435455u) ? 4u : 0u); + x = (x << b4); + uint b2 = ((x <= 1073741823u) ? 2u : 0u); + x = (x << b2); + uint b1 = ((x <= 2147483647u) ? 1u : 0u); + uint is_zero = ((x == 0u) ? 1u : 0u); + return uint((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_208d46() { + uint arg_0 = 1u; + uint res = tint_count_leading_zeros(arg_0); +} + +vec4 vertex_main() { + countLeadingZeros_208d46(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uint tint_count_leading_zeros(uint v) { + uint x = uint(v); + uint b16 = ((x <= 65535u) ? 16u : 0u); + x = (x << b16); + uint b8 = ((x <= 16777215u) ? 8u : 0u); + x = (x << b8); + uint b4 = ((x <= 268435455u) ? 4u : 0u); + x = (x << b4); + uint b2 = ((x <= 1073741823u) ? 2u : 0u); + x = (x << b2); + uint b1 = ((x <= 2147483647u) ? 1u : 0u); + uint is_zero = ((x == 0u) ? 1u : 0u); + return uint((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_208d46() { + uint arg_0 = 1u; + uint res = tint_count_leading_zeros(arg_0); +} + +void fragment_main() { + countLeadingZeros_208d46(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uint tint_count_leading_zeros(uint v) { + uint x = uint(v); + uint b16 = ((x <= 65535u) ? 16u : 0u); + x = (x << b16); + uint b8 = ((x <= 16777215u) ? 8u : 0u); + x = (x << b8); + uint b4 = ((x <= 268435455u) ? 4u : 0u); + x = (x << b4); + uint b2 = ((x <= 1073741823u) ? 2u : 0u); + x = (x << b2); + uint b1 = ((x <= 2147483647u) ? 1u : 0u); + uint is_zero = ((x == 0u) ? 1u : 0u); + return uint((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_208d46() { + uint arg_0 = 1u; + uint res = tint_count_leading_zeros(arg_0); +} + +void compute_main() { + countLeadingZeros_208d46(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/208d46.wgsl.expected.hlsl b/test/tint/builtins/gen/var/countLeadingZeros/208d46.wgsl.expected.hlsl new file mode 100644 index 0000000000..65bbec9d87 --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/208d46.wgsl.expected.hlsl @@ -0,0 +1,46 @@ +uint tint_count_leading_zeros(uint v) { + uint x = uint(v); + const uint b16 = ((x <= 65535u) ? 16u : 0u); + x = (x << b16); + const uint b8 = ((x <= 16777215u) ? 8u : 0u); + x = (x << b8); + const uint b4 = ((x <= 268435455u) ? 4u : 0u); + x = (x << b4); + const uint b2 = ((x <= 1073741823u) ? 2u : 0u); + x = (x << b2); + const uint b1 = ((x <= 2147483647u) ? 1u : 0u); + const uint is_zero = ((x == 0u) ? 1u : 0u); + return uint((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_208d46() { + uint arg_0 = 1u; + uint res = tint_count_leading_zeros(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countLeadingZeros_208d46(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countLeadingZeros_208d46(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countLeadingZeros_208d46(); + return; +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/208d46.wgsl.expected.msl b/test/tint/builtins/gen/var/countLeadingZeros/208d46.wgsl.expected.msl new file mode 100644 index 0000000000..545a925403 --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/208d46.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void countLeadingZeros_208d46() { + uint arg_0 = 1u; + uint res = clz(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countLeadingZeros_208d46(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countLeadingZeros_208d46(); + return; +} + +kernel void compute_main() { + countLeadingZeros_208d46(); + return; +} + diff --git a/test/tint/builtins/gen/var/countLeadingZeros/208d46.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countLeadingZeros/208d46.wgsl.expected.spvasm new file mode 100644 index 0000000000..8fb26d7b2d --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/208d46.wgsl.expected.spvasm @@ -0,0 +1,127 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 83 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_count_leading_zeros "tint_count_leading_zeros" + OpName %v "v" + OpName %x "x" + OpName %countLeadingZeros_208d46 "countLeadingZeros_208d46" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %9 = OpTypeFunction %uint %uint +%_ptr_Function_uint = OpTypePointer Function %uint + %17 = OpConstantNull %uint + %uint_65535 = OpConstant %uint 65535 + %bool = OpTypeBool + %uint_16 = OpConstant %uint 16 +%uint_16777215 = OpConstant %uint 16777215 + %uint_8 = OpConstant %uint 8 +%uint_268435455 = OpConstant %uint 268435455 + %uint_4 = OpConstant %uint 4 +%uint_1073741823 = OpConstant %uint 1073741823 + %uint_2 = OpConstant %uint 2 +%uint_2147483647 = OpConstant %uint 2147483647 + %uint_1 = OpConstant %uint 1 + %void = OpTypeVoid + %61 = OpTypeFunction %void + %69 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_count_leading_zeros = OpFunction %uint None %9 + %v = OpFunctionParameter %uint + %13 = OpLabel + %x = OpVariable %_ptr_Function_uint Function %17 + OpStore %x %v + %19 = OpLoad %uint %x + %21 = OpULessThanEqual %bool %19 %uint_65535 + %18 = OpSelect %uint %21 %uint_16 %17 + %24 = OpLoad %uint %x + %25 = OpShiftLeftLogical %uint %24 %18 + OpStore %x %25 + %27 = OpLoad %uint %x + %29 = OpULessThanEqual %bool %27 %uint_16777215 + %26 = OpSelect %uint %29 %uint_8 %17 + %31 = OpLoad %uint %x + %32 = OpShiftLeftLogical %uint %31 %26 + OpStore %x %32 + %34 = OpLoad %uint %x + %36 = OpULessThanEqual %bool %34 %uint_268435455 + %33 = OpSelect %uint %36 %uint_4 %17 + %38 = OpLoad %uint %x + %39 = OpShiftLeftLogical %uint %38 %33 + OpStore %x %39 + %41 = OpLoad %uint %x + %43 = OpULessThanEqual %bool %41 %uint_1073741823 + %40 = OpSelect %uint %43 %uint_2 %17 + %45 = OpLoad %uint %x + %46 = OpShiftLeftLogical %uint %45 %40 + OpStore %x %46 + %48 = OpLoad %uint %x + %50 = OpULessThanEqual %bool %48 %uint_2147483647 + %47 = OpSelect %uint %50 %uint_1 %17 + %53 = OpLoad %uint %x + %54 = OpIEqual %bool %53 %17 + %52 = OpSelect %uint %54 %uint_1 %17 + %56 = OpBitwiseOr %uint %18 %26 + %57 = OpBitwiseOr %uint %56 %33 + %58 = OpBitwiseOr %uint %57 %40 + %59 = OpBitwiseOr %uint %58 %47 + %60 = OpIAdd %uint %59 %52 + OpReturnValue %60 + OpFunctionEnd +%countLeadingZeros_208d46 = OpFunction %void None %61 + %64 = OpLabel + %arg_0 = OpVariable %_ptr_Function_uint Function %17 + %res = OpVariable %_ptr_Function_uint Function %17 + OpStore %arg_0 %uint_1 + %67 = OpLoad %uint %arg_0 + %66 = OpFunctionCall %uint %tint_count_leading_zeros %67 + OpStore %res %66 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %69 + %71 = OpLabel + %72 = OpFunctionCall %void %countLeadingZeros_208d46 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %61 + %74 = OpLabel + %75 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %75 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %61 + %78 = OpLabel + %79 = OpFunctionCall %void %countLeadingZeros_208d46 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %61 + %81 = OpLabel + %82 = OpFunctionCall %void %countLeadingZeros_208d46 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/countLeadingZeros/208d46.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countLeadingZeros/208d46.wgsl.expected.wgsl new file mode 100644 index 0000000000..052dd97129 --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/208d46.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn countLeadingZeros_208d46() { + var arg_0 = 1u; + var res : u32 = countLeadingZeros(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + countLeadingZeros_208d46(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + countLeadingZeros_208d46(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + countLeadingZeros_208d46(); +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/6d4656.wgsl b/test/tint/builtins/gen/var/countLeadingZeros/6d4656.wgsl new file mode 100644 index 0000000000..db877abbfc --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/6d4656.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countLeadingZeros(i32) -> i32 +fn countLeadingZeros_6d4656() { + var arg_0 = 1; + var res: i32 = countLeadingZeros(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + countLeadingZeros_6d4656(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + countLeadingZeros_6d4656(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + countLeadingZeros_6d4656(); +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/6d4656.wgsl.expected.glsl b/test/tint/builtins/gen/var/countLeadingZeros/6d4656.wgsl.expected.glsl new file mode 100644 index 0000000000..4e140afbc9 --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/6d4656.wgsl.expected.glsl @@ -0,0 +1,97 @@ +#version 310 es + +int tint_count_leading_zeros(int v) { + uint x = uint(v); + uint b16 = ((x <= 65535u) ? 16u : 0u); + x = (x << b16); + uint b8 = ((x <= 16777215u) ? 8u : 0u); + x = (x << b8); + uint b4 = ((x <= 268435455u) ? 4u : 0u); + x = (x << b4); + uint b2 = ((x <= 1073741823u) ? 2u : 0u); + x = (x << b2); + uint b1 = ((x <= 2147483647u) ? 1u : 0u); + uint is_zero = ((x == 0u) ? 1u : 0u); + return int((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_6d4656() { + int arg_0 = 1; + int res = tint_count_leading_zeros(arg_0); +} + +vec4 vertex_main() { + countLeadingZeros_6d4656(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +int tint_count_leading_zeros(int v) { + uint x = uint(v); + uint b16 = ((x <= 65535u) ? 16u : 0u); + x = (x << b16); + uint b8 = ((x <= 16777215u) ? 8u : 0u); + x = (x << b8); + uint b4 = ((x <= 268435455u) ? 4u : 0u); + x = (x << b4); + uint b2 = ((x <= 1073741823u) ? 2u : 0u); + x = (x << b2); + uint b1 = ((x <= 2147483647u) ? 1u : 0u); + uint is_zero = ((x == 0u) ? 1u : 0u); + return int((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_6d4656() { + int arg_0 = 1; + int res = tint_count_leading_zeros(arg_0); +} + +void fragment_main() { + countLeadingZeros_6d4656(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +int tint_count_leading_zeros(int v) { + uint x = uint(v); + uint b16 = ((x <= 65535u) ? 16u : 0u); + x = (x << b16); + uint b8 = ((x <= 16777215u) ? 8u : 0u); + x = (x << b8); + uint b4 = ((x <= 268435455u) ? 4u : 0u); + x = (x << b4); + uint b2 = ((x <= 1073741823u) ? 2u : 0u); + x = (x << b2); + uint b1 = ((x <= 2147483647u) ? 1u : 0u); + uint is_zero = ((x == 0u) ? 1u : 0u); + return int((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_6d4656() { + int arg_0 = 1; + int res = tint_count_leading_zeros(arg_0); +} + +void compute_main() { + countLeadingZeros_6d4656(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/6d4656.wgsl.expected.hlsl b/test/tint/builtins/gen/var/countLeadingZeros/6d4656.wgsl.expected.hlsl new file mode 100644 index 0000000000..ddf54fb1eb --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/6d4656.wgsl.expected.hlsl @@ -0,0 +1,46 @@ +int tint_count_leading_zeros(int v) { + uint x = uint(v); + const uint b16 = ((x <= 65535u) ? 16u : 0u); + x = (x << b16); + const uint b8 = ((x <= 16777215u) ? 8u : 0u); + x = (x << b8); + const uint b4 = ((x <= 268435455u) ? 4u : 0u); + x = (x << b4); + const uint b2 = ((x <= 1073741823u) ? 2u : 0u); + x = (x << b2); + const uint b1 = ((x <= 2147483647u) ? 1u : 0u); + const uint is_zero = ((x == 0u) ? 1u : 0u); + return int((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_6d4656() { + int arg_0 = 1; + int res = tint_count_leading_zeros(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countLeadingZeros_6d4656(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countLeadingZeros_6d4656(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countLeadingZeros_6d4656(); + return; +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/6d4656.wgsl.expected.msl b/test/tint/builtins/gen/var/countLeadingZeros/6d4656.wgsl.expected.msl new file mode 100644 index 0000000000..260714f47b --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/6d4656.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void countLeadingZeros_6d4656() { + int arg_0 = 1; + int res = clz(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countLeadingZeros_6d4656(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countLeadingZeros_6d4656(); + return; +} + +kernel void compute_main() { + countLeadingZeros_6d4656(); + return; +} + diff --git a/test/tint/builtins/gen/var/countLeadingZeros/6d4656.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countLeadingZeros/6d4656.wgsl.expected.spvasm new file mode 100644 index 0000000000..558ca73783 --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/6d4656.wgsl.expected.spvasm @@ -0,0 +1,133 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 87 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_count_leading_zeros "tint_count_leading_zeros" + OpName %v "v" + OpName %x "x" + OpName %countLeadingZeros_6d4656 "countLeadingZeros_6d4656" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %9 = OpTypeFunction %int %int + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %18 = OpConstantNull %uint + %uint_65535 = OpConstant %uint 65535 + %bool = OpTypeBool + %uint_16 = OpConstant %uint 16 +%uint_16777215 = OpConstant %uint 16777215 + %uint_8 = OpConstant %uint 8 +%uint_268435455 = OpConstant %uint 268435455 + %uint_4 = OpConstant %uint 4 +%uint_1073741823 = OpConstant %uint 1073741823 + %uint_2 = OpConstant %uint 2 +%uint_2147483647 = OpConstant %uint 2147483647 + %uint_1 = OpConstant %uint 1 + %void = OpTypeVoid + %62 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %69 = OpConstantNull %int + %73 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_count_leading_zeros = OpFunction %int None %9 + %v = OpFunctionParameter %int + %13 = OpLabel + %x = OpVariable %_ptr_Function_uint Function %18 + %14 = OpBitcast %uint %v + OpStore %x %14 + %20 = OpLoad %uint %x + %22 = OpULessThanEqual %bool %20 %uint_65535 + %19 = OpSelect %uint %22 %uint_16 %18 + %25 = OpLoad %uint %x + %26 = OpShiftLeftLogical %uint %25 %19 + OpStore %x %26 + %28 = OpLoad %uint %x + %30 = OpULessThanEqual %bool %28 %uint_16777215 + %27 = OpSelect %uint %30 %uint_8 %18 + %32 = OpLoad %uint %x + %33 = OpShiftLeftLogical %uint %32 %27 + OpStore %x %33 + %35 = OpLoad %uint %x + %37 = OpULessThanEqual %bool %35 %uint_268435455 + %34 = OpSelect %uint %37 %uint_4 %18 + %39 = OpLoad %uint %x + %40 = OpShiftLeftLogical %uint %39 %34 + OpStore %x %40 + %42 = OpLoad %uint %x + %44 = OpULessThanEqual %bool %42 %uint_1073741823 + %41 = OpSelect %uint %44 %uint_2 %18 + %46 = OpLoad %uint %x + %47 = OpShiftLeftLogical %uint %46 %41 + OpStore %x %47 + %49 = OpLoad %uint %x + %51 = OpULessThanEqual %bool %49 %uint_2147483647 + %48 = OpSelect %uint %51 %uint_1 %18 + %54 = OpLoad %uint %x + %55 = OpIEqual %bool %54 %18 + %53 = OpSelect %uint %55 %uint_1 %18 + %57 = OpBitwiseOr %uint %19 %27 + %58 = OpBitwiseOr %uint %57 %34 + %59 = OpBitwiseOr %uint %58 %41 + %60 = OpBitwiseOr %uint %59 %48 + %61 = OpIAdd %uint %60 %53 + %56 = OpBitcast %int %61 + OpReturnValue %56 + OpFunctionEnd +%countLeadingZeros_6d4656 = OpFunction %void None %62 + %65 = OpLabel + %arg_0 = OpVariable %_ptr_Function_int Function %69 + %res = OpVariable %_ptr_Function_int Function %69 + OpStore %arg_0 %int_1 + %71 = OpLoad %int %arg_0 + %70 = OpFunctionCall %int %tint_count_leading_zeros %71 + OpStore %res %70 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %73 + %75 = OpLabel + %76 = OpFunctionCall %void %countLeadingZeros_6d4656 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %62 + %78 = OpLabel + %79 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %79 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %62 + %82 = OpLabel + %83 = OpFunctionCall %void %countLeadingZeros_6d4656 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %62 + %85 = OpLabel + %86 = OpFunctionCall %void %countLeadingZeros_6d4656 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/countLeadingZeros/6d4656.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countLeadingZeros/6d4656.wgsl.expected.wgsl new file mode 100644 index 0000000000..8e14227db8 --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/6d4656.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn countLeadingZeros_6d4656() { + var arg_0 = 1; + var res : i32 = countLeadingZeros(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + countLeadingZeros_6d4656(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + countLeadingZeros_6d4656(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + countLeadingZeros_6d4656(); +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/70783f.wgsl b/test/tint/builtins/gen/var/countLeadingZeros/70783f.wgsl new file mode 100644 index 0000000000..0c22c5766c --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/70783f.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countLeadingZeros(vec<2, u32>) -> vec<2, u32> +fn countLeadingZeros_70783f() { + var arg_0 = vec2(); + var res: vec2 = countLeadingZeros(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + countLeadingZeros_70783f(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + countLeadingZeros_70783f(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + countLeadingZeros_70783f(); +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/70783f.wgsl.expected.glsl b/test/tint/builtins/gen/var/countLeadingZeros/70783f.wgsl.expected.glsl new file mode 100644 index 0000000000..c7763c590e --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/70783f.wgsl.expected.glsl @@ -0,0 +1,97 @@ +#version 310 es + +uvec2 tint_count_leading_zeros(uvec2 v) { + uvec2 x = uvec2(v); + uvec2 b16 = mix(uvec2(0u), uvec2(16u), lessThanEqual(x, uvec2(65535u))); + x = (x << b16); + uvec2 b8 = mix(uvec2(0u), uvec2(8u), lessThanEqual(x, uvec2(16777215u))); + x = (x << b8); + uvec2 b4 = mix(uvec2(0u), uvec2(4u), lessThanEqual(x, uvec2(268435455u))); + x = (x << b4); + uvec2 b2 = mix(uvec2(0u), uvec2(2u), lessThanEqual(x, uvec2(1073741823u))); + x = (x << b2); + uvec2 b1 = mix(uvec2(0u), uvec2(1u), lessThanEqual(x, uvec2(2147483647u))); + uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u))); + return uvec2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_70783f() { + uvec2 arg_0 = uvec2(0u); + uvec2 res = tint_count_leading_zeros(arg_0); +} + +vec4 vertex_main() { + countLeadingZeros_70783f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uvec2 tint_count_leading_zeros(uvec2 v) { + uvec2 x = uvec2(v); + uvec2 b16 = mix(uvec2(0u), uvec2(16u), lessThanEqual(x, uvec2(65535u))); + x = (x << b16); + uvec2 b8 = mix(uvec2(0u), uvec2(8u), lessThanEqual(x, uvec2(16777215u))); + x = (x << b8); + uvec2 b4 = mix(uvec2(0u), uvec2(4u), lessThanEqual(x, uvec2(268435455u))); + x = (x << b4); + uvec2 b2 = mix(uvec2(0u), uvec2(2u), lessThanEqual(x, uvec2(1073741823u))); + x = (x << b2); + uvec2 b1 = mix(uvec2(0u), uvec2(1u), lessThanEqual(x, uvec2(2147483647u))); + uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u))); + return uvec2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_70783f() { + uvec2 arg_0 = uvec2(0u); + uvec2 res = tint_count_leading_zeros(arg_0); +} + +void fragment_main() { + countLeadingZeros_70783f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uvec2 tint_count_leading_zeros(uvec2 v) { + uvec2 x = uvec2(v); + uvec2 b16 = mix(uvec2(0u), uvec2(16u), lessThanEqual(x, uvec2(65535u))); + x = (x << b16); + uvec2 b8 = mix(uvec2(0u), uvec2(8u), lessThanEqual(x, uvec2(16777215u))); + x = (x << b8); + uvec2 b4 = mix(uvec2(0u), uvec2(4u), lessThanEqual(x, uvec2(268435455u))); + x = (x << b4); + uvec2 b2 = mix(uvec2(0u), uvec2(2u), lessThanEqual(x, uvec2(1073741823u))); + x = (x << b2); + uvec2 b1 = mix(uvec2(0u), uvec2(1u), lessThanEqual(x, uvec2(2147483647u))); + uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u))); + return uvec2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_70783f() { + uvec2 arg_0 = uvec2(0u); + uvec2 res = tint_count_leading_zeros(arg_0); +} + +void compute_main() { + countLeadingZeros_70783f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/70783f.wgsl.expected.hlsl b/test/tint/builtins/gen/var/countLeadingZeros/70783f.wgsl.expected.hlsl new file mode 100644 index 0000000000..90d4b5bdcd --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/70783f.wgsl.expected.hlsl @@ -0,0 +1,46 @@ +uint2 tint_count_leading_zeros(uint2 v) { + uint2 x = uint2(v); + const uint2 b16 = ((x <= (65535u).xx) ? (16u).xx : (0u).xx); + x = (x << b16); + const uint2 b8 = ((x <= (16777215u).xx) ? (8u).xx : (0u).xx); + x = (x << b8); + const uint2 b4 = ((x <= (268435455u).xx) ? (4u).xx : (0u).xx); + x = (x << b4); + const uint2 b2 = ((x <= (1073741823u).xx) ? (2u).xx : (0u).xx); + x = (x << b2); + const uint2 b1 = ((x <= (2147483647u).xx) ? (1u).xx : (0u).xx); + const uint2 is_zero = ((x == (0u).xx) ? (1u).xx : (0u).xx); + return uint2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_70783f() { + uint2 arg_0 = (0u).xx; + uint2 res = tint_count_leading_zeros(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countLeadingZeros_70783f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countLeadingZeros_70783f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countLeadingZeros_70783f(); + return; +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/70783f.wgsl.expected.msl b/test/tint/builtins/gen/var/countLeadingZeros/70783f.wgsl.expected.msl new file mode 100644 index 0000000000..eb39a9f318 --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/70783f.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void countLeadingZeros_70783f() { + uint2 arg_0 = uint2(0u); + uint2 res = clz(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countLeadingZeros_70783f(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countLeadingZeros_70783f(); + return; +} + +kernel void compute_main() { + countLeadingZeros_70783f(); + return; +} + diff --git a/test/tint/builtins/gen/var/countLeadingZeros/70783f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countLeadingZeros/70783f.wgsl.expected.spvasm new file mode 100644 index 0000000000..6bf8e615cc --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/70783f.wgsl.expected.spvasm @@ -0,0 +1,139 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 95 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_count_leading_zeros "tint_count_leading_zeros" + OpName %v "v" + OpName %x "x" + OpName %countLeadingZeros_70783f "countLeadingZeros_70783f" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %9 = OpTypeFunction %v2uint %v2uint +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %18 = OpConstantNull %v2uint + %uint_65535 = OpConstant %uint 65535 + %22 = OpConstantComposite %v2uint %uint_65535 %uint_65535 + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %uint_16 = OpConstant %uint 16 + %27 = OpConstantComposite %v2uint %uint_16 %uint_16 +%uint_16777215 = OpConstant %uint 16777215 + %33 = OpConstantComposite %v2uint %uint_16777215 %uint_16777215 + %uint_8 = OpConstant %uint 8 + %36 = OpConstantComposite %v2uint %uint_8 %uint_8 +%uint_268435455 = OpConstant %uint 268435455 + %42 = OpConstantComposite %v2uint %uint_268435455 %uint_268435455 + %uint_4 = OpConstant %uint 4 + %45 = OpConstantComposite %v2uint %uint_4 %uint_4 +%uint_1073741823 = OpConstant %uint 1073741823 + %51 = OpConstantComposite %v2uint %uint_1073741823 %uint_1073741823 + %uint_2 = OpConstant %uint 2 + %54 = OpConstantComposite %v2uint %uint_2 %uint_2 +%uint_2147483647 = OpConstant %uint 2147483647 + %60 = OpConstantComposite %v2uint %uint_2147483647 %uint_2147483647 + %uint_1 = OpConstant %uint 1 + %63 = OpConstantComposite %v2uint %uint_1 %uint_1 + %void = OpTypeVoid + %73 = OpTypeFunction %void + %81 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_count_leading_zeros = OpFunction %v2uint None %9 + %v = OpFunctionParameter %v2uint + %14 = OpLabel + %x = OpVariable %_ptr_Function_v2uint Function %18 + OpStore %x %v + %20 = OpLoad %v2uint %x + %23 = OpULessThanEqual %v2bool %20 %22 + %19 = OpSelect %v2uint %23 %27 %18 + %28 = OpLoad %v2uint %x + %29 = OpShiftLeftLogical %v2uint %28 %19 + OpStore %x %29 + %31 = OpLoad %v2uint %x + %34 = OpULessThanEqual %v2bool %31 %33 + %30 = OpSelect %v2uint %34 %36 %18 + %37 = OpLoad %v2uint %x + %38 = OpShiftLeftLogical %v2uint %37 %30 + OpStore %x %38 + %40 = OpLoad %v2uint %x + %43 = OpULessThanEqual %v2bool %40 %42 + %39 = OpSelect %v2uint %43 %45 %18 + %46 = OpLoad %v2uint %x + %47 = OpShiftLeftLogical %v2uint %46 %39 + OpStore %x %47 + %49 = OpLoad %v2uint %x + %52 = OpULessThanEqual %v2bool %49 %51 + %48 = OpSelect %v2uint %52 %54 %18 + %55 = OpLoad %v2uint %x + %56 = OpShiftLeftLogical %v2uint %55 %48 + OpStore %x %56 + %58 = OpLoad %v2uint %x + %61 = OpULessThanEqual %v2bool %58 %60 + %57 = OpSelect %v2uint %61 %63 %18 + %65 = OpLoad %v2uint %x + %66 = OpIEqual %v2bool %65 %18 + %64 = OpSelect %v2uint %66 %63 %18 + %68 = OpBitwiseOr %v2uint %19 %30 + %69 = OpBitwiseOr %v2uint %68 %39 + %70 = OpBitwiseOr %v2uint %69 %48 + %71 = OpBitwiseOr %v2uint %70 %57 + %72 = OpIAdd %v2uint %71 %64 + OpReturnValue %72 + OpFunctionEnd +%countLeadingZeros_70783f = OpFunction %void None %73 + %76 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2uint Function %18 + %res = OpVariable %_ptr_Function_v2uint Function %18 + OpStore %arg_0 %18 + %79 = OpLoad %v2uint %arg_0 + %78 = OpFunctionCall %v2uint %tint_count_leading_zeros %79 + OpStore %res %78 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %81 + %83 = OpLabel + %84 = OpFunctionCall %void %countLeadingZeros_70783f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %73 + %86 = OpLabel + %87 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %87 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %73 + %90 = OpLabel + %91 = OpFunctionCall %void %countLeadingZeros_70783f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %73 + %93 = OpLabel + %94 = OpFunctionCall %void %countLeadingZeros_70783f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/countLeadingZeros/70783f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countLeadingZeros/70783f.wgsl.expected.wgsl new file mode 100644 index 0000000000..f005d3528c --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/70783f.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn countLeadingZeros_70783f() { + var arg_0 = vec2(); + var res : vec2 = countLeadingZeros(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + countLeadingZeros_70783f(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + countLeadingZeros_70783f(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + countLeadingZeros_70783f(); +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/7c38a6.wgsl b/test/tint/builtins/gen/var/countLeadingZeros/7c38a6.wgsl new file mode 100644 index 0000000000..597fb8cd29 --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/7c38a6.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countLeadingZeros(vec<3, i32>) -> vec<3, i32> +fn countLeadingZeros_7c38a6() { + var arg_0 = vec3(); + var res: vec3 = countLeadingZeros(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + countLeadingZeros_7c38a6(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + countLeadingZeros_7c38a6(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + countLeadingZeros_7c38a6(); +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/7c38a6.wgsl.expected.glsl b/test/tint/builtins/gen/var/countLeadingZeros/7c38a6.wgsl.expected.glsl new file mode 100644 index 0000000000..56378593c8 --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/7c38a6.wgsl.expected.glsl @@ -0,0 +1,97 @@ +#version 310 es + +ivec3 tint_count_leading_zeros(ivec3 v) { + uvec3 x = uvec3(v); + uvec3 b16 = mix(uvec3(0u), uvec3(16u), lessThanEqual(x, uvec3(65535u))); + x = (x << b16); + uvec3 b8 = mix(uvec3(0u), uvec3(8u), lessThanEqual(x, uvec3(16777215u))); + x = (x << b8); + uvec3 b4 = mix(uvec3(0u), uvec3(4u), lessThanEqual(x, uvec3(268435455u))); + x = (x << b4); + uvec3 b2 = mix(uvec3(0u), uvec3(2u), lessThanEqual(x, uvec3(1073741823u))); + x = (x << b2); + uvec3 b1 = mix(uvec3(0u), uvec3(1u), lessThanEqual(x, uvec3(2147483647u))); + uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u))); + return ivec3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_7c38a6() { + ivec3 arg_0 = ivec3(0); + ivec3 res = tint_count_leading_zeros(arg_0); +} + +vec4 vertex_main() { + countLeadingZeros_7c38a6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +ivec3 tint_count_leading_zeros(ivec3 v) { + uvec3 x = uvec3(v); + uvec3 b16 = mix(uvec3(0u), uvec3(16u), lessThanEqual(x, uvec3(65535u))); + x = (x << b16); + uvec3 b8 = mix(uvec3(0u), uvec3(8u), lessThanEqual(x, uvec3(16777215u))); + x = (x << b8); + uvec3 b4 = mix(uvec3(0u), uvec3(4u), lessThanEqual(x, uvec3(268435455u))); + x = (x << b4); + uvec3 b2 = mix(uvec3(0u), uvec3(2u), lessThanEqual(x, uvec3(1073741823u))); + x = (x << b2); + uvec3 b1 = mix(uvec3(0u), uvec3(1u), lessThanEqual(x, uvec3(2147483647u))); + uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u))); + return ivec3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_7c38a6() { + ivec3 arg_0 = ivec3(0); + ivec3 res = tint_count_leading_zeros(arg_0); +} + +void fragment_main() { + countLeadingZeros_7c38a6(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +ivec3 tint_count_leading_zeros(ivec3 v) { + uvec3 x = uvec3(v); + uvec3 b16 = mix(uvec3(0u), uvec3(16u), lessThanEqual(x, uvec3(65535u))); + x = (x << b16); + uvec3 b8 = mix(uvec3(0u), uvec3(8u), lessThanEqual(x, uvec3(16777215u))); + x = (x << b8); + uvec3 b4 = mix(uvec3(0u), uvec3(4u), lessThanEqual(x, uvec3(268435455u))); + x = (x << b4); + uvec3 b2 = mix(uvec3(0u), uvec3(2u), lessThanEqual(x, uvec3(1073741823u))); + x = (x << b2); + uvec3 b1 = mix(uvec3(0u), uvec3(1u), lessThanEqual(x, uvec3(2147483647u))); + uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u))); + return ivec3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_7c38a6() { + ivec3 arg_0 = ivec3(0); + ivec3 res = tint_count_leading_zeros(arg_0); +} + +void compute_main() { + countLeadingZeros_7c38a6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/7c38a6.wgsl.expected.hlsl b/test/tint/builtins/gen/var/countLeadingZeros/7c38a6.wgsl.expected.hlsl new file mode 100644 index 0000000000..a22216298f --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/7c38a6.wgsl.expected.hlsl @@ -0,0 +1,46 @@ +int3 tint_count_leading_zeros(int3 v) { + uint3 x = uint3(v); + const uint3 b16 = ((x <= (65535u).xxx) ? (16u).xxx : (0u).xxx); + x = (x << b16); + const uint3 b8 = ((x <= (16777215u).xxx) ? (8u).xxx : (0u).xxx); + x = (x << b8); + const uint3 b4 = ((x <= (268435455u).xxx) ? (4u).xxx : (0u).xxx); + x = (x << b4); + const uint3 b2 = ((x <= (1073741823u).xxx) ? (2u).xxx : (0u).xxx); + x = (x << b2); + const uint3 b1 = ((x <= (2147483647u).xxx) ? (1u).xxx : (0u).xxx); + const uint3 is_zero = ((x == (0u).xxx) ? (1u).xxx : (0u).xxx); + return int3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_7c38a6() { + int3 arg_0 = (0).xxx; + int3 res = tint_count_leading_zeros(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countLeadingZeros_7c38a6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countLeadingZeros_7c38a6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countLeadingZeros_7c38a6(); + return; +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/7c38a6.wgsl.expected.msl b/test/tint/builtins/gen/var/countLeadingZeros/7c38a6.wgsl.expected.msl new file mode 100644 index 0000000000..d6a5cf646d --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/7c38a6.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void countLeadingZeros_7c38a6() { + int3 arg_0 = int3(0); + int3 res = clz(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countLeadingZeros_7c38a6(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countLeadingZeros_7c38a6(); + return; +} + +kernel void compute_main() { + countLeadingZeros_7c38a6(); + return; +} + diff --git a/test/tint/builtins/gen/var/countLeadingZeros/7c38a6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countLeadingZeros/7c38a6.wgsl.expected.spvasm new file mode 100644 index 0000000000..13be646769 --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/7c38a6.wgsl.expected.spvasm @@ -0,0 +1,145 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 99 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_count_leading_zeros "tint_count_leading_zeros" + OpName %v "v" + OpName %x "x" + OpName %countLeadingZeros_7c38a6 "countLeadingZeros_7c38a6" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %9 = OpTypeFunction %v3int %v3int + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %20 = OpConstantNull %v3uint + %uint_65535 = OpConstant %uint 65535 + %24 = OpConstantComposite %v3uint %uint_65535 %uint_65535 %uint_65535 + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %uint_16 = OpConstant %uint 16 + %29 = OpConstantComposite %v3uint %uint_16 %uint_16 %uint_16 +%uint_16777215 = OpConstant %uint 16777215 + %35 = OpConstantComposite %v3uint %uint_16777215 %uint_16777215 %uint_16777215 + %uint_8 = OpConstant %uint 8 + %38 = OpConstantComposite %v3uint %uint_8 %uint_8 %uint_8 +%uint_268435455 = OpConstant %uint 268435455 + %44 = OpConstantComposite %v3uint %uint_268435455 %uint_268435455 %uint_268435455 + %uint_4 = OpConstant %uint 4 + %47 = OpConstantComposite %v3uint %uint_4 %uint_4 %uint_4 +%uint_1073741823 = OpConstant %uint 1073741823 + %53 = OpConstantComposite %v3uint %uint_1073741823 %uint_1073741823 %uint_1073741823 + %uint_2 = OpConstant %uint 2 + %56 = OpConstantComposite %v3uint %uint_2 %uint_2 %uint_2 +%uint_2147483647 = OpConstant %uint 2147483647 + %62 = OpConstantComposite %v3uint %uint_2147483647 %uint_2147483647 %uint_2147483647 + %uint_1 = OpConstant %uint 1 + %65 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 + %void = OpTypeVoid + %75 = OpTypeFunction %void + %79 = OpConstantNull %v3int +%_ptr_Function_v3int = OpTypePointer Function %v3int + %85 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_count_leading_zeros = OpFunction %v3int None %9 + %v = OpFunctionParameter %v3int + %14 = OpLabel + %x = OpVariable %_ptr_Function_v3uint Function %20 + %15 = OpBitcast %v3uint %v + OpStore %x %15 + %22 = OpLoad %v3uint %x + %25 = OpULessThanEqual %v3bool %22 %24 + %21 = OpSelect %v3uint %25 %29 %20 + %30 = OpLoad %v3uint %x + %31 = OpShiftLeftLogical %v3uint %30 %21 + OpStore %x %31 + %33 = OpLoad %v3uint %x + %36 = OpULessThanEqual %v3bool %33 %35 + %32 = OpSelect %v3uint %36 %38 %20 + %39 = OpLoad %v3uint %x + %40 = OpShiftLeftLogical %v3uint %39 %32 + OpStore %x %40 + %42 = OpLoad %v3uint %x + %45 = OpULessThanEqual %v3bool %42 %44 + %41 = OpSelect %v3uint %45 %47 %20 + %48 = OpLoad %v3uint %x + %49 = OpShiftLeftLogical %v3uint %48 %41 + OpStore %x %49 + %51 = OpLoad %v3uint %x + %54 = OpULessThanEqual %v3bool %51 %53 + %50 = OpSelect %v3uint %54 %56 %20 + %57 = OpLoad %v3uint %x + %58 = OpShiftLeftLogical %v3uint %57 %50 + OpStore %x %58 + %60 = OpLoad %v3uint %x + %63 = OpULessThanEqual %v3bool %60 %62 + %59 = OpSelect %v3uint %63 %65 %20 + %67 = OpLoad %v3uint %x + %68 = OpIEqual %v3bool %67 %20 + %66 = OpSelect %v3uint %68 %65 %20 + %70 = OpBitwiseOr %v3uint %21 %32 + %71 = OpBitwiseOr %v3uint %70 %41 + %72 = OpBitwiseOr %v3uint %71 %50 + %73 = OpBitwiseOr %v3uint %72 %59 + %74 = OpIAdd %v3uint %73 %66 + %69 = OpBitcast %v3int %74 + OpReturnValue %69 + OpFunctionEnd +%countLeadingZeros_7c38a6 = OpFunction %void None %75 + %78 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3int Function %79 + %res = OpVariable %_ptr_Function_v3int Function %79 + OpStore %arg_0 %79 + %83 = OpLoad %v3int %arg_0 + %82 = OpFunctionCall %v3int %tint_count_leading_zeros %83 + OpStore %res %82 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %85 + %87 = OpLabel + %88 = OpFunctionCall %void %countLeadingZeros_7c38a6 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %75 + %90 = OpLabel + %91 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %91 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %75 + %94 = OpLabel + %95 = OpFunctionCall %void %countLeadingZeros_7c38a6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %75 + %97 = OpLabel + %98 = OpFunctionCall %void %countLeadingZeros_7c38a6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/countLeadingZeros/7c38a6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countLeadingZeros/7c38a6.wgsl.expected.wgsl new file mode 100644 index 0000000000..b4f5e0a110 --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/7c38a6.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn countLeadingZeros_7c38a6() { + var arg_0 = vec3(); + var res : vec3 = countLeadingZeros(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + countLeadingZeros_7c38a6(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + countLeadingZeros_7c38a6(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + countLeadingZeros_7c38a6(); +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/858d40.wgsl b/test/tint/builtins/gen/var/countLeadingZeros/858d40.wgsl new file mode 100644 index 0000000000..cdc1846dc5 --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/858d40.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countLeadingZeros(vec<2, i32>) -> vec<2, i32> +fn countLeadingZeros_858d40() { + var arg_0 = vec2(); + var res: vec2 = countLeadingZeros(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + countLeadingZeros_858d40(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + countLeadingZeros_858d40(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + countLeadingZeros_858d40(); +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/858d40.wgsl.expected.glsl b/test/tint/builtins/gen/var/countLeadingZeros/858d40.wgsl.expected.glsl new file mode 100644 index 0000000000..37ad0cdc21 --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/858d40.wgsl.expected.glsl @@ -0,0 +1,97 @@ +#version 310 es + +ivec2 tint_count_leading_zeros(ivec2 v) { + uvec2 x = uvec2(v); + uvec2 b16 = mix(uvec2(0u), uvec2(16u), lessThanEqual(x, uvec2(65535u))); + x = (x << b16); + uvec2 b8 = mix(uvec2(0u), uvec2(8u), lessThanEqual(x, uvec2(16777215u))); + x = (x << b8); + uvec2 b4 = mix(uvec2(0u), uvec2(4u), lessThanEqual(x, uvec2(268435455u))); + x = (x << b4); + uvec2 b2 = mix(uvec2(0u), uvec2(2u), lessThanEqual(x, uvec2(1073741823u))); + x = (x << b2); + uvec2 b1 = mix(uvec2(0u), uvec2(1u), lessThanEqual(x, uvec2(2147483647u))); + uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u))); + return ivec2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_858d40() { + ivec2 arg_0 = ivec2(0); + ivec2 res = tint_count_leading_zeros(arg_0); +} + +vec4 vertex_main() { + countLeadingZeros_858d40(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +ivec2 tint_count_leading_zeros(ivec2 v) { + uvec2 x = uvec2(v); + uvec2 b16 = mix(uvec2(0u), uvec2(16u), lessThanEqual(x, uvec2(65535u))); + x = (x << b16); + uvec2 b8 = mix(uvec2(0u), uvec2(8u), lessThanEqual(x, uvec2(16777215u))); + x = (x << b8); + uvec2 b4 = mix(uvec2(0u), uvec2(4u), lessThanEqual(x, uvec2(268435455u))); + x = (x << b4); + uvec2 b2 = mix(uvec2(0u), uvec2(2u), lessThanEqual(x, uvec2(1073741823u))); + x = (x << b2); + uvec2 b1 = mix(uvec2(0u), uvec2(1u), lessThanEqual(x, uvec2(2147483647u))); + uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u))); + return ivec2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_858d40() { + ivec2 arg_0 = ivec2(0); + ivec2 res = tint_count_leading_zeros(arg_0); +} + +void fragment_main() { + countLeadingZeros_858d40(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +ivec2 tint_count_leading_zeros(ivec2 v) { + uvec2 x = uvec2(v); + uvec2 b16 = mix(uvec2(0u), uvec2(16u), lessThanEqual(x, uvec2(65535u))); + x = (x << b16); + uvec2 b8 = mix(uvec2(0u), uvec2(8u), lessThanEqual(x, uvec2(16777215u))); + x = (x << b8); + uvec2 b4 = mix(uvec2(0u), uvec2(4u), lessThanEqual(x, uvec2(268435455u))); + x = (x << b4); + uvec2 b2 = mix(uvec2(0u), uvec2(2u), lessThanEqual(x, uvec2(1073741823u))); + x = (x << b2); + uvec2 b1 = mix(uvec2(0u), uvec2(1u), lessThanEqual(x, uvec2(2147483647u))); + uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u))); + return ivec2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_858d40() { + ivec2 arg_0 = ivec2(0); + ivec2 res = tint_count_leading_zeros(arg_0); +} + +void compute_main() { + countLeadingZeros_858d40(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/858d40.wgsl.expected.hlsl b/test/tint/builtins/gen/var/countLeadingZeros/858d40.wgsl.expected.hlsl new file mode 100644 index 0000000000..554c876e9f --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/858d40.wgsl.expected.hlsl @@ -0,0 +1,46 @@ +int2 tint_count_leading_zeros(int2 v) { + uint2 x = uint2(v); + const uint2 b16 = ((x <= (65535u).xx) ? (16u).xx : (0u).xx); + x = (x << b16); + const uint2 b8 = ((x <= (16777215u).xx) ? (8u).xx : (0u).xx); + x = (x << b8); + const uint2 b4 = ((x <= (268435455u).xx) ? (4u).xx : (0u).xx); + x = (x << b4); + const uint2 b2 = ((x <= (1073741823u).xx) ? (2u).xx : (0u).xx); + x = (x << b2); + const uint2 b1 = ((x <= (2147483647u).xx) ? (1u).xx : (0u).xx); + const uint2 is_zero = ((x == (0u).xx) ? (1u).xx : (0u).xx); + return int2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_858d40() { + int2 arg_0 = (0).xx; + int2 res = tint_count_leading_zeros(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countLeadingZeros_858d40(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countLeadingZeros_858d40(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countLeadingZeros_858d40(); + return; +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/858d40.wgsl.expected.msl b/test/tint/builtins/gen/var/countLeadingZeros/858d40.wgsl.expected.msl new file mode 100644 index 0000000000..936cead3aa --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/858d40.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void countLeadingZeros_858d40() { + int2 arg_0 = int2(0); + int2 res = clz(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countLeadingZeros_858d40(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countLeadingZeros_858d40(); + return; +} + +kernel void compute_main() { + countLeadingZeros_858d40(); + return; +} + diff --git a/test/tint/builtins/gen/var/countLeadingZeros/858d40.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countLeadingZeros/858d40.wgsl.expected.spvasm new file mode 100644 index 0000000000..9713d96256 --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/858d40.wgsl.expected.spvasm @@ -0,0 +1,145 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 99 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_count_leading_zeros "tint_count_leading_zeros" + OpName %v "v" + OpName %x "x" + OpName %countLeadingZeros_858d40 "countLeadingZeros_858d40" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %9 = OpTypeFunction %v2int %v2int + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %20 = OpConstantNull %v2uint + %uint_65535 = OpConstant %uint 65535 + %24 = OpConstantComposite %v2uint %uint_65535 %uint_65535 + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %uint_16 = OpConstant %uint 16 + %29 = OpConstantComposite %v2uint %uint_16 %uint_16 +%uint_16777215 = OpConstant %uint 16777215 + %35 = OpConstantComposite %v2uint %uint_16777215 %uint_16777215 + %uint_8 = OpConstant %uint 8 + %38 = OpConstantComposite %v2uint %uint_8 %uint_8 +%uint_268435455 = OpConstant %uint 268435455 + %44 = OpConstantComposite %v2uint %uint_268435455 %uint_268435455 + %uint_4 = OpConstant %uint 4 + %47 = OpConstantComposite %v2uint %uint_4 %uint_4 +%uint_1073741823 = OpConstant %uint 1073741823 + %53 = OpConstantComposite %v2uint %uint_1073741823 %uint_1073741823 + %uint_2 = OpConstant %uint 2 + %56 = OpConstantComposite %v2uint %uint_2 %uint_2 +%uint_2147483647 = OpConstant %uint 2147483647 + %62 = OpConstantComposite %v2uint %uint_2147483647 %uint_2147483647 + %uint_1 = OpConstant %uint 1 + %65 = OpConstantComposite %v2uint %uint_1 %uint_1 + %void = OpTypeVoid + %75 = OpTypeFunction %void + %79 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %85 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_count_leading_zeros = OpFunction %v2int None %9 + %v = OpFunctionParameter %v2int + %14 = OpLabel + %x = OpVariable %_ptr_Function_v2uint Function %20 + %15 = OpBitcast %v2uint %v + OpStore %x %15 + %22 = OpLoad %v2uint %x + %25 = OpULessThanEqual %v2bool %22 %24 + %21 = OpSelect %v2uint %25 %29 %20 + %30 = OpLoad %v2uint %x + %31 = OpShiftLeftLogical %v2uint %30 %21 + OpStore %x %31 + %33 = OpLoad %v2uint %x + %36 = OpULessThanEqual %v2bool %33 %35 + %32 = OpSelect %v2uint %36 %38 %20 + %39 = OpLoad %v2uint %x + %40 = OpShiftLeftLogical %v2uint %39 %32 + OpStore %x %40 + %42 = OpLoad %v2uint %x + %45 = OpULessThanEqual %v2bool %42 %44 + %41 = OpSelect %v2uint %45 %47 %20 + %48 = OpLoad %v2uint %x + %49 = OpShiftLeftLogical %v2uint %48 %41 + OpStore %x %49 + %51 = OpLoad %v2uint %x + %54 = OpULessThanEqual %v2bool %51 %53 + %50 = OpSelect %v2uint %54 %56 %20 + %57 = OpLoad %v2uint %x + %58 = OpShiftLeftLogical %v2uint %57 %50 + OpStore %x %58 + %60 = OpLoad %v2uint %x + %63 = OpULessThanEqual %v2bool %60 %62 + %59 = OpSelect %v2uint %63 %65 %20 + %67 = OpLoad %v2uint %x + %68 = OpIEqual %v2bool %67 %20 + %66 = OpSelect %v2uint %68 %65 %20 + %70 = OpBitwiseOr %v2uint %21 %32 + %71 = OpBitwiseOr %v2uint %70 %41 + %72 = OpBitwiseOr %v2uint %71 %50 + %73 = OpBitwiseOr %v2uint %72 %59 + %74 = OpIAdd %v2uint %73 %66 + %69 = OpBitcast %v2int %74 + OpReturnValue %69 + OpFunctionEnd +%countLeadingZeros_858d40 = OpFunction %void None %75 + %78 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2int Function %79 + %res = OpVariable %_ptr_Function_v2int Function %79 + OpStore %arg_0 %79 + %83 = OpLoad %v2int %arg_0 + %82 = OpFunctionCall %v2int %tint_count_leading_zeros %83 + OpStore %res %82 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %85 + %87 = OpLabel + %88 = OpFunctionCall %void %countLeadingZeros_858d40 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %75 + %90 = OpLabel + %91 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %91 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %75 + %94 = OpLabel + %95 = OpFunctionCall %void %countLeadingZeros_858d40 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %75 + %97 = OpLabel + %98 = OpFunctionCall %void %countLeadingZeros_858d40 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/countLeadingZeros/858d40.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countLeadingZeros/858d40.wgsl.expected.wgsl new file mode 100644 index 0000000000..7636a6b088 --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/858d40.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn countLeadingZeros_858d40() { + var arg_0 = vec2(); + var res : vec2 = countLeadingZeros(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + countLeadingZeros_858d40(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + countLeadingZeros_858d40(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + countLeadingZeros_858d40(); +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/ab6345.wgsl b/test/tint/builtins/gen/var/countLeadingZeros/ab6345.wgsl new file mode 100644 index 0000000000..f27d250d8d --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/ab6345.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countLeadingZeros(vec<3, u32>) -> vec<3, u32> +fn countLeadingZeros_ab6345() { + var arg_0 = vec3(); + var res: vec3 = countLeadingZeros(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + countLeadingZeros_ab6345(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + countLeadingZeros_ab6345(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + countLeadingZeros_ab6345(); +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/ab6345.wgsl.expected.glsl b/test/tint/builtins/gen/var/countLeadingZeros/ab6345.wgsl.expected.glsl new file mode 100644 index 0000000000..9718304023 --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/ab6345.wgsl.expected.glsl @@ -0,0 +1,97 @@ +#version 310 es + +uvec3 tint_count_leading_zeros(uvec3 v) { + uvec3 x = uvec3(v); + uvec3 b16 = mix(uvec3(0u), uvec3(16u), lessThanEqual(x, uvec3(65535u))); + x = (x << b16); + uvec3 b8 = mix(uvec3(0u), uvec3(8u), lessThanEqual(x, uvec3(16777215u))); + x = (x << b8); + uvec3 b4 = mix(uvec3(0u), uvec3(4u), lessThanEqual(x, uvec3(268435455u))); + x = (x << b4); + uvec3 b2 = mix(uvec3(0u), uvec3(2u), lessThanEqual(x, uvec3(1073741823u))); + x = (x << b2); + uvec3 b1 = mix(uvec3(0u), uvec3(1u), lessThanEqual(x, uvec3(2147483647u))); + uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u))); + return uvec3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_ab6345() { + uvec3 arg_0 = uvec3(0u); + uvec3 res = tint_count_leading_zeros(arg_0); +} + +vec4 vertex_main() { + countLeadingZeros_ab6345(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uvec3 tint_count_leading_zeros(uvec3 v) { + uvec3 x = uvec3(v); + uvec3 b16 = mix(uvec3(0u), uvec3(16u), lessThanEqual(x, uvec3(65535u))); + x = (x << b16); + uvec3 b8 = mix(uvec3(0u), uvec3(8u), lessThanEqual(x, uvec3(16777215u))); + x = (x << b8); + uvec3 b4 = mix(uvec3(0u), uvec3(4u), lessThanEqual(x, uvec3(268435455u))); + x = (x << b4); + uvec3 b2 = mix(uvec3(0u), uvec3(2u), lessThanEqual(x, uvec3(1073741823u))); + x = (x << b2); + uvec3 b1 = mix(uvec3(0u), uvec3(1u), lessThanEqual(x, uvec3(2147483647u))); + uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u))); + return uvec3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_ab6345() { + uvec3 arg_0 = uvec3(0u); + uvec3 res = tint_count_leading_zeros(arg_0); +} + +void fragment_main() { + countLeadingZeros_ab6345(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uvec3 tint_count_leading_zeros(uvec3 v) { + uvec3 x = uvec3(v); + uvec3 b16 = mix(uvec3(0u), uvec3(16u), lessThanEqual(x, uvec3(65535u))); + x = (x << b16); + uvec3 b8 = mix(uvec3(0u), uvec3(8u), lessThanEqual(x, uvec3(16777215u))); + x = (x << b8); + uvec3 b4 = mix(uvec3(0u), uvec3(4u), lessThanEqual(x, uvec3(268435455u))); + x = (x << b4); + uvec3 b2 = mix(uvec3(0u), uvec3(2u), lessThanEqual(x, uvec3(1073741823u))); + x = (x << b2); + uvec3 b1 = mix(uvec3(0u), uvec3(1u), lessThanEqual(x, uvec3(2147483647u))); + uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u))); + return uvec3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_ab6345() { + uvec3 arg_0 = uvec3(0u); + uvec3 res = tint_count_leading_zeros(arg_0); +} + +void compute_main() { + countLeadingZeros_ab6345(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/ab6345.wgsl.expected.hlsl b/test/tint/builtins/gen/var/countLeadingZeros/ab6345.wgsl.expected.hlsl new file mode 100644 index 0000000000..8ce7db4836 --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/ab6345.wgsl.expected.hlsl @@ -0,0 +1,46 @@ +uint3 tint_count_leading_zeros(uint3 v) { + uint3 x = uint3(v); + const uint3 b16 = ((x <= (65535u).xxx) ? (16u).xxx : (0u).xxx); + x = (x << b16); + const uint3 b8 = ((x <= (16777215u).xxx) ? (8u).xxx : (0u).xxx); + x = (x << b8); + const uint3 b4 = ((x <= (268435455u).xxx) ? (4u).xxx : (0u).xxx); + x = (x << b4); + const uint3 b2 = ((x <= (1073741823u).xxx) ? (2u).xxx : (0u).xxx); + x = (x << b2); + const uint3 b1 = ((x <= (2147483647u).xxx) ? (1u).xxx : (0u).xxx); + const uint3 is_zero = ((x == (0u).xxx) ? (1u).xxx : (0u).xxx); + return uint3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_ab6345() { + uint3 arg_0 = (0u).xxx; + uint3 res = tint_count_leading_zeros(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countLeadingZeros_ab6345(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countLeadingZeros_ab6345(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countLeadingZeros_ab6345(); + return; +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/ab6345.wgsl.expected.msl b/test/tint/builtins/gen/var/countLeadingZeros/ab6345.wgsl.expected.msl new file mode 100644 index 0000000000..da91869393 --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/ab6345.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void countLeadingZeros_ab6345() { + uint3 arg_0 = uint3(0u); + uint3 res = clz(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countLeadingZeros_ab6345(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countLeadingZeros_ab6345(); + return; +} + +kernel void compute_main() { + countLeadingZeros_ab6345(); + return; +} + diff --git a/test/tint/builtins/gen/var/countLeadingZeros/ab6345.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countLeadingZeros/ab6345.wgsl.expected.spvasm new file mode 100644 index 0000000000..fbe6e6a017 --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/ab6345.wgsl.expected.spvasm @@ -0,0 +1,139 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 95 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_count_leading_zeros "tint_count_leading_zeros" + OpName %v "v" + OpName %x "x" + OpName %countLeadingZeros_ab6345 "countLeadingZeros_ab6345" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %9 = OpTypeFunction %v3uint %v3uint +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %18 = OpConstantNull %v3uint + %uint_65535 = OpConstant %uint 65535 + %22 = OpConstantComposite %v3uint %uint_65535 %uint_65535 %uint_65535 + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %uint_16 = OpConstant %uint 16 + %27 = OpConstantComposite %v3uint %uint_16 %uint_16 %uint_16 +%uint_16777215 = OpConstant %uint 16777215 + %33 = OpConstantComposite %v3uint %uint_16777215 %uint_16777215 %uint_16777215 + %uint_8 = OpConstant %uint 8 + %36 = OpConstantComposite %v3uint %uint_8 %uint_8 %uint_8 +%uint_268435455 = OpConstant %uint 268435455 + %42 = OpConstantComposite %v3uint %uint_268435455 %uint_268435455 %uint_268435455 + %uint_4 = OpConstant %uint 4 + %45 = OpConstantComposite %v3uint %uint_4 %uint_4 %uint_4 +%uint_1073741823 = OpConstant %uint 1073741823 + %51 = OpConstantComposite %v3uint %uint_1073741823 %uint_1073741823 %uint_1073741823 + %uint_2 = OpConstant %uint 2 + %54 = OpConstantComposite %v3uint %uint_2 %uint_2 %uint_2 +%uint_2147483647 = OpConstant %uint 2147483647 + %60 = OpConstantComposite %v3uint %uint_2147483647 %uint_2147483647 %uint_2147483647 + %uint_1 = OpConstant %uint 1 + %63 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 + %void = OpTypeVoid + %73 = OpTypeFunction %void + %81 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_count_leading_zeros = OpFunction %v3uint None %9 + %v = OpFunctionParameter %v3uint + %14 = OpLabel + %x = OpVariable %_ptr_Function_v3uint Function %18 + OpStore %x %v + %20 = OpLoad %v3uint %x + %23 = OpULessThanEqual %v3bool %20 %22 + %19 = OpSelect %v3uint %23 %27 %18 + %28 = OpLoad %v3uint %x + %29 = OpShiftLeftLogical %v3uint %28 %19 + OpStore %x %29 + %31 = OpLoad %v3uint %x + %34 = OpULessThanEqual %v3bool %31 %33 + %30 = OpSelect %v3uint %34 %36 %18 + %37 = OpLoad %v3uint %x + %38 = OpShiftLeftLogical %v3uint %37 %30 + OpStore %x %38 + %40 = OpLoad %v3uint %x + %43 = OpULessThanEqual %v3bool %40 %42 + %39 = OpSelect %v3uint %43 %45 %18 + %46 = OpLoad %v3uint %x + %47 = OpShiftLeftLogical %v3uint %46 %39 + OpStore %x %47 + %49 = OpLoad %v3uint %x + %52 = OpULessThanEqual %v3bool %49 %51 + %48 = OpSelect %v3uint %52 %54 %18 + %55 = OpLoad %v3uint %x + %56 = OpShiftLeftLogical %v3uint %55 %48 + OpStore %x %56 + %58 = OpLoad %v3uint %x + %61 = OpULessThanEqual %v3bool %58 %60 + %57 = OpSelect %v3uint %61 %63 %18 + %65 = OpLoad %v3uint %x + %66 = OpIEqual %v3bool %65 %18 + %64 = OpSelect %v3uint %66 %63 %18 + %68 = OpBitwiseOr %v3uint %19 %30 + %69 = OpBitwiseOr %v3uint %68 %39 + %70 = OpBitwiseOr %v3uint %69 %48 + %71 = OpBitwiseOr %v3uint %70 %57 + %72 = OpIAdd %v3uint %71 %64 + OpReturnValue %72 + OpFunctionEnd +%countLeadingZeros_ab6345 = OpFunction %void None %73 + %76 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3uint Function %18 + %res = OpVariable %_ptr_Function_v3uint Function %18 + OpStore %arg_0 %18 + %79 = OpLoad %v3uint %arg_0 + %78 = OpFunctionCall %v3uint %tint_count_leading_zeros %79 + OpStore %res %78 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %81 + %83 = OpLabel + %84 = OpFunctionCall %void %countLeadingZeros_ab6345 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %73 + %86 = OpLabel + %87 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %87 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %73 + %90 = OpLabel + %91 = OpFunctionCall %void %countLeadingZeros_ab6345 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %73 + %93 = OpLabel + %94 = OpFunctionCall %void %countLeadingZeros_ab6345 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/countLeadingZeros/ab6345.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countLeadingZeros/ab6345.wgsl.expected.wgsl new file mode 100644 index 0000000000..a9936e094c --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/ab6345.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn countLeadingZeros_ab6345() { + var arg_0 = vec3(); + var res : vec3 = countLeadingZeros(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + countLeadingZeros_ab6345(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + countLeadingZeros_ab6345(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + countLeadingZeros_ab6345(); +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/eab32b.wgsl b/test/tint/builtins/gen/var/countLeadingZeros/eab32b.wgsl new file mode 100644 index 0000000000..c3a1e880f8 --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/eab32b.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countLeadingZeros(vec<4, i32>) -> vec<4, i32> +fn countLeadingZeros_eab32b() { + var arg_0 = vec4(); + var res: vec4 = countLeadingZeros(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + countLeadingZeros_eab32b(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + countLeadingZeros_eab32b(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + countLeadingZeros_eab32b(); +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/eab32b.wgsl.expected.glsl b/test/tint/builtins/gen/var/countLeadingZeros/eab32b.wgsl.expected.glsl new file mode 100644 index 0000000000..54da7b1035 --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/eab32b.wgsl.expected.glsl @@ -0,0 +1,97 @@ +#version 310 es + +ivec4 tint_count_leading_zeros(ivec4 v) { + uvec4 x = uvec4(v); + uvec4 b16 = mix(uvec4(0u), uvec4(16u), lessThanEqual(x, uvec4(65535u))); + x = (x << b16); + uvec4 b8 = mix(uvec4(0u), uvec4(8u), lessThanEqual(x, uvec4(16777215u))); + x = (x << b8); + uvec4 b4 = mix(uvec4(0u), uvec4(4u), lessThanEqual(x, uvec4(268435455u))); + x = (x << b4); + uvec4 b2 = mix(uvec4(0u), uvec4(2u), lessThanEqual(x, uvec4(1073741823u))); + x = (x << b2); + uvec4 b1 = mix(uvec4(0u), uvec4(1u), lessThanEqual(x, uvec4(2147483647u))); + uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u))); + return ivec4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_eab32b() { + ivec4 arg_0 = ivec4(0); + ivec4 res = tint_count_leading_zeros(arg_0); +} + +vec4 vertex_main() { + countLeadingZeros_eab32b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +ivec4 tint_count_leading_zeros(ivec4 v) { + uvec4 x = uvec4(v); + uvec4 b16 = mix(uvec4(0u), uvec4(16u), lessThanEqual(x, uvec4(65535u))); + x = (x << b16); + uvec4 b8 = mix(uvec4(0u), uvec4(8u), lessThanEqual(x, uvec4(16777215u))); + x = (x << b8); + uvec4 b4 = mix(uvec4(0u), uvec4(4u), lessThanEqual(x, uvec4(268435455u))); + x = (x << b4); + uvec4 b2 = mix(uvec4(0u), uvec4(2u), lessThanEqual(x, uvec4(1073741823u))); + x = (x << b2); + uvec4 b1 = mix(uvec4(0u), uvec4(1u), lessThanEqual(x, uvec4(2147483647u))); + uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u))); + return ivec4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_eab32b() { + ivec4 arg_0 = ivec4(0); + ivec4 res = tint_count_leading_zeros(arg_0); +} + +void fragment_main() { + countLeadingZeros_eab32b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +ivec4 tint_count_leading_zeros(ivec4 v) { + uvec4 x = uvec4(v); + uvec4 b16 = mix(uvec4(0u), uvec4(16u), lessThanEqual(x, uvec4(65535u))); + x = (x << b16); + uvec4 b8 = mix(uvec4(0u), uvec4(8u), lessThanEqual(x, uvec4(16777215u))); + x = (x << b8); + uvec4 b4 = mix(uvec4(0u), uvec4(4u), lessThanEqual(x, uvec4(268435455u))); + x = (x << b4); + uvec4 b2 = mix(uvec4(0u), uvec4(2u), lessThanEqual(x, uvec4(1073741823u))); + x = (x << b2); + uvec4 b1 = mix(uvec4(0u), uvec4(1u), lessThanEqual(x, uvec4(2147483647u))); + uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u))); + return ivec4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_eab32b() { + ivec4 arg_0 = ivec4(0); + ivec4 res = tint_count_leading_zeros(arg_0); +} + +void compute_main() { + countLeadingZeros_eab32b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/eab32b.wgsl.expected.hlsl b/test/tint/builtins/gen/var/countLeadingZeros/eab32b.wgsl.expected.hlsl new file mode 100644 index 0000000000..0c0038e915 --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/eab32b.wgsl.expected.hlsl @@ -0,0 +1,46 @@ +int4 tint_count_leading_zeros(int4 v) { + uint4 x = uint4(v); + const uint4 b16 = ((x <= (65535u).xxxx) ? (16u).xxxx : (0u).xxxx); + x = (x << b16); + const uint4 b8 = ((x <= (16777215u).xxxx) ? (8u).xxxx : (0u).xxxx); + x = (x << b8); + const uint4 b4 = ((x <= (268435455u).xxxx) ? (4u).xxxx : (0u).xxxx); + x = (x << b4); + const uint4 b2 = ((x <= (1073741823u).xxxx) ? (2u).xxxx : (0u).xxxx); + x = (x << b2); + const uint4 b1 = ((x <= (2147483647u).xxxx) ? (1u).xxxx : (0u).xxxx); + const uint4 is_zero = ((x == (0u).xxxx) ? (1u).xxxx : (0u).xxxx); + return int4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_eab32b() { + int4 arg_0 = (0).xxxx; + int4 res = tint_count_leading_zeros(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countLeadingZeros_eab32b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countLeadingZeros_eab32b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countLeadingZeros_eab32b(); + return; +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/eab32b.wgsl.expected.msl b/test/tint/builtins/gen/var/countLeadingZeros/eab32b.wgsl.expected.msl new file mode 100644 index 0000000000..e057ee92e2 --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/eab32b.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void countLeadingZeros_eab32b() { + int4 arg_0 = int4(0); + int4 res = clz(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countLeadingZeros_eab32b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countLeadingZeros_eab32b(); + return; +} + +kernel void compute_main() { + countLeadingZeros_eab32b(); + return; +} + diff --git a/test/tint/builtins/gen/var/countLeadingZeros/eab32b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countLeadingZeros/eab32b.wgsl.expected.spvasm new file mode 100644 index 0000000000..e5abbcf218 --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/eab32b.wgsl.expected.spvasm @@ -0,0 +1,145 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 99 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_count_leading_zeros "tint_count_leading_zeros" + OpName %v "v" + OpName %x "x" + OpName %countLeadingZeros_eab32b "countLeadingZeros_eab32b" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %9 = OpTypeFunction %v4int %v4int + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %20 = OpConstantNull %v4uint + %uint_65535 = OpConstant %uint 65535 + %24 = OpConstantComposite %v4uint %uint_65535 %uint_65535 %uint_65535 %uint_65535 + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %uint_16 = OpConstant %uint 16 + %29 = OpConstantComposite %v4uint %uint_16 %uint_16 %uint_16 %uint_16 +%uint_16777215 = OpConstant %uint 16777215 + %35 = OpConstantComposite %v4uint %uint_16777215 %uint_16777215 %uint_16777215 %uint_16777215 + %uint_8 = OpConstant %uint 8 + %38 = OpConstantComposite %v4uint %uint_8 %uint_8 %uint_8 %uint_8 +%uint_268435455 = OpConstant %uint 268435455 + %44 = OpConstantComposite %v4uint %uint_268435455 %uint_268435455 %uint_268435455 %uint_268435455 + %uint_4 = OpConstant %uint 4 + %47 = OpConstantComposite %v4uint %uint_4 %uint_4 %uint_4 %uint_4 +%uint_1073741823 = OpConstant %uint 1073741823 + %53 = OpConstantComposite %v4uint %uint_1073741823 %uint_1073741823 %uint_1073741823 %uint_1073741823 + %uint_2 = OpConstant %uint 2 + %56 = OpConstantComposite %v4uint %uint_2 %uint_2 %uint_2 %uint_2 +%uint_2147483647 = OpConstant %uint 2147483647 + %62 = OpConstantComposite %v4uint %uint_2147483647 %uint_2147483647 %uint_2147483647 %uint_2147483647 + %uint_1 = OpConstant %uint 1 + %65 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1 + %void = OpTypeVoid + %75 = OpTypeFunction %void + %79 = OpConstantNull %v4int +%_ptr_Function_v4int = OpTypePointer Function %v4int + %85 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_count_leading_zeros = OpFunction %v4int None %9 + %v = OpFunctionParameter %v4int + %14 = OpLabel + %x = OpVariable %_ptr_Function_v4uint Function %20 + %15 = OpBitcast %v4uint %v + OpStore %x %15 + %22 = OpLoad %v4uint %x + %25 = OpULessThanEqual %v4bool %22 %24 + %21 = OpSelect %v4uint %25 %29 %20 + %30 = OpLoad %v4uint %x + %31 = OpShiftLeftLogical %v4uint %30 %21 + OpStore %x %31 + %33 = OpLoad %v4uint %x + %36 = OpULessThanEqual %v4bool %33 %35 + %32 = OpSelect %v4uint %36 %38 %20 + %39 = OpLoad %v4uint %x + %40 = OpShiftLeftLogical %v4uint %39 %32 + OpStore %x %40 + %42 = OpLoad %v4uint %x + %45 = OpULessThanEqual %v4bool %42 %44 + %41 = OpSelect %v4uint %45 %47 %20 + %48 = OpLoad %v4uint %x + %49 = OpShiftLeftLogical %v4uint %48 %41 + OpStore %x %49 + %51 = OpLoad %v4uint %x + %54 = OpULessThanEqual %v4bool %51 %53 + %50 = OpSelect %v4uint %54 %56 %20 + %57 = OpLoad %v4uint %x + %58 = OpShiftLeftLogical %v4uint %57 %50 + OpStore %x %58 + %60 = OpLoad %v4uint %x + %63 = OpULessThanEqual %v4bool %60 %62 + %59 = OpSelect %v4uint %63 %65 %20 + %67 = OpLoad %v4uint %x + %68 = OpIEqual %v4bool %67 %20 + %66 = OpSelect %v4uint %68 %65 %20 + %70 = OpBitwiseOr %v4uint %21 %32 + %71 = OpBitwiseOr %v4uint %70 %41 + %72 = OpBitwiseOr %v4uint %71 %50 + %73 = OpBitwiseOr %v4uint %72 %59 + %74 = OpIAdd %v4uint %73 %66 + %69 = OpBitcast %v4int %74 + OpReturnValue %69 + OpFunctionEnd +%countLeadingZeros_eab32b = OpFunction %void None %75 + %78 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4int Function %79 + %res = OpVariable %_ptr_Function_v4int Function %79 + OpStore %arg_0 %79 + %83 = OpLoad %v4int %arg_0 + %82 = OpFunctionCall %v4int %tint_count_leading_zeros %83 + OpStore %res %82 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %85 + %87 = OpLabel + %88 = OpFunctionCall %void %countLeadingZeros_eab32b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %75 + %90 = OpLabel + %91 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %91 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %75 + %94 = OpLabel + %95 = OpFunctionCall %void %countLeadingZeros_eab32b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %75 + %97 = OpLabel + %98 = OpFunctionCall %void %countLeadingZeros_eab32b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/countLeadingZeros/eab32b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countLeadingZeros/eab32b.wgsl.expected.wgsl new file mode 100644 index 0000000000..2cfb1aee82 --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/eab32b.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn countLeadingZeros_eab32b() { + var arg_0 = vec4(); + var res : vec4 = countLeadingZeros(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + countLeadingZeros_eab32b(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + countLeadingZeros_eab32b(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + countLeadingZeros_eab32b(); +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/f70103.wgsl b/test/tint/builtins/gen/var/countLeadingZeros/f70103.wgsl new file mode 100644 index 0000000000..ca3af73fd2 --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/f70103.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countLeadingZeros(vec<4, u32>) -> vec<4, u32> +fn countLeadingZeros_f70103() { + var arg_0 = vec4(); + var res: vec4 = countLeadingZeros(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + countLeadingZeros_f70103(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + countLeadingZeros_f70103(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + countLeadingZeros_f70103(); +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/f70103.wgsl.expected.glsl b/test/tint/builtins/gen/var/countLeadingZeros/f70103.wgsl.expected.glsl new file mode 100644 index 0000000000..3f589ec3fd --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/f70103.wgsl.expected.glsl @@ -0,0 +1,97 @@ +#version 310 es + +uvec4 tint_count_leading_zeros(uvec4 v) { + uvec4 x = uvec4(v); + uvec4 b16 = mix(uvec4(0u), uvec4(16u), lessThanEqual(x, uvec4(65535u))); + x = (x << b16); + uvec4 b8 = mix(uvec4(0u), uvec4(8u), lessThanEqual(x, uvec4(16777215u))); + x = (x << b8); + uvec4 b4 = mix(uvec4(0u), uvec4(4u), lessThanEqual(x, uvec4(268435455u))); + x = (x << b4); + uvec4 b2 = mix(uvec4(0u), uvec4(2u), lessThanEqual(x, uvec4(1073741823u))); + x = (x << b2); + uvec4 b1 = mix(uvec4(0u), uvec4(1u), lessThanEqual(x, uvec4(2147483647u))); + uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u))); + return uvec4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_f70103() { + uvec4 arg_0 = uvec4(0u); + uvec4 res = tint_count_leading_zeros(arg_0); +} + +vec4 vertex_main() { + countLeadingZeros_f70103(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uvec4 tint_count_leading_zeros(uvec4 v) { + uvec4 x = uvec4(v); + uvec4 b16 = mix(uvec4(0u), uvec4(16u), lessThanEqual(x, uvec4(65535u))); + x = (x << b16); + uvec4 b8 = mix(uvec4(0u), uvec4(8u), lessThanEqual(x, uvec4(16777215u))); + x = (x << b8); + uvec4 b4 = mix(uvec4(0u), uvec4(4u), lessThanEqual(x, uvec4(268435455u))); + x = (x << b4); + uvec4 b2 = mix(uvec4(0u), uvec4(2u), lessThanEqual(x, uvec4(1073741823u))); + x = (x << b2); + uvec4 b1 = mix(uvec4(0u), uvec4(1u), lessThanEqual(x, uvec4(2147483647u))); + uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u))); + return uvec4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_f70103() { + uvec4 arg_0 = uvec4(0u); + uvec4 res = tint_count_leading_zeros(arg_0); +} + +void fragment_main() { + countLeadingZeros_f70103(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uvec4 tint_count_leading_zeros(uvec4 v) { + uvec4 x = uvec4(v); + uvec4 b16 = mix(uvec4(0u), uvec4(16u), lessThanEqual(x, uvec4(65535u))); + x = (x << b16); + uvec4 b8 = mix(uvec4(0u), uvec4(8u), lessThanEqual(x, uvec4(16777215u))); + x = (x << b8); + uvec4 b4 = mix(uvec4(0u), uvec4(4u), lessThanEqual(x, uvec4(268435455u))); + x = (x << b4); + uvec4 b2 = mix(uvec4(0u), uvec4(2u), lessThanEqual(x, uvec4(1073741823u))); + x = (x << b2); + uvec4 b1 = mix(uvec4(0u), uvec4(1u), lessThanEqual(x, uvec4(2147483647u))); + uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u))); + return uvec4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_f70103() { + uvec4 arg_0 = uvec4(0u); + uvec4 res = tint_count_leading_zeros(arg_0); +} + +void compute_main() { + countLeadingZeros_f70103(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/f70103.wgsl.expected.hlsl b/test/tint/builtins/gen/var/countLeadingZeros/f70103.wgsl.expected.hlsl new file mode 100644 index 0000000000..073158b3ee --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/f70103.wgsl.expected.hlsl @@ -0,0 +1,46 @@ +uint4 tint_count_leading_zeros(uint4 v) { + uint4 x = uint4(v); + const uint4 b16 = ((x <= (65535u).xxxx) ? (16u).xxxx : (0u).xxxx); + x = (x << b16); + const uint4 b8 = ((x <= (16777215u).xxxx) ? (8u).xxxx : (0u).xxxx); + x = (x << b8); + const uint4 b4 = ((x <= (268435455u).xxxx) ? (4u).xxxx : (0u).xxxx); + x = (x << b4); + const uint4 b2 = ((x <= (1073741823u).xxxx) ? (2u).xxxx : (0u).xxxx); + x = (x << b2); + const uint4 b1 = ((x <= (2147483647u).xxxx) ? (1u).xxxx : (0u).xxxx); + const uint4 is_zero = ((x == (0u).xxxx) ? (1u).xxxx : (0u).xxxx); + return uint4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_f70103() { + uint4 arg_0 = (0u).xxxx; + uint4 res = tint_count_leading_zeros(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countLeadingZeros_f70103(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countLeadingZeros_f70103(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countLeadingZeros_f70103(); + return; +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/f70103.wgsl.expected.msl b/test/tint/builtins/gen/var/countLeadingZeros/f70103.wgsl.expected.msl new file mode 100644 index 0000000000..ff67225ae4 --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/f70103.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void countLeadingZeros_f70103() { + uint4 arg_0 = uint4(0u); + uint4 res = clz(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countLeadingZeros_f70103(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countLeadingZeros_f70103(); + return; +} + +kernel void compute_main() { + countLeadingZeros_f70103(); + return; +} + diff --git a/test/tint/builtins/gen/var/countLeadingZeros/f70103.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countLeadingZeros/f70103.wgsl.expected.spvasm new file mode 100644 index 0000000000..a28fd9cc0c --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/f70103.wgsl.expected.spvasm @@ -0,0 +1,139 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 95 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_count_leading_zeros "tint_count_leading_zeros" + OpName %v "v" + OpName %x "x" + OpName %countLeadingZeros_f70103 "countLeadingZeros_f70103" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + %9 = OpTypeFunction %v4uint %v4uint +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %18 = OpConstantNull %v4uint + %uint_65535 = OpConstant %uint 65535 + %22 = OpConstantComposite %v4uint %uint_65535 %uint_65535 %uint_65535 %uint_65535 + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %uint_16 = OpConstant %uint 16 + %27 = OpConstantComposite %v4uint %uint_16 %uint_16 %uint_16 %uint_16 +%uint_16777215 = OpConstant %uint 16777215 + %33 = OpConstantComposite %v4uint %uint_16777215 %uint_16777215 %uint_16777215 %uint_16777215 + %uint_8 = OpConstant %uint 8 + %36 = OpConstantComposite %v4uint %uint_8 %uint_8 %uint_8 %uint_8 +%uint_268435455 = OpConstant %uint 268435455 + %42 = OpConstantComposite %v4uint %uint_268435455 %uint_268435455 %uint_268435455 %uint_268435455 + %uint_4 = OpConstant %uint 4 + %45 = OpConstantComposite %v4uint %uint_4 %uint_4 %uint_4 %uint_4 +%uint_1073741823 = OpConstant %uint 1073741823 + %51 = OpConstantComposite %v4uint %uint_1073741823 %uint_1073741823 %uint_1073741823 %uint_1073741823 + %uint_2 = OpConstant %uint 2 + %54 = OpConstantComposite %v4uint %uint_2 %uint_2 %uint_2 %uint_2 +%uint_2147483647 = OpConstant %uint 2147483647 + %60 = OpConstantComposite %v4uint %uint_2147483647 %uint_2147483647 %uint_2147483647 %uint_2147483647 + %uint_1 = OpConstant %uint 1 + %63 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1 + %void = OpTypeVoid + %73 = OpTypeFunction %void + %81 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_count_leading_zeros = OpFunction %v4uint None %9 + %v = OpFunctionParameter %v4uint + %14 = OpLabel + %x = OpVariable %_ptr_Function_v4uint Function %18 + OpStore %x %v + %20 = OpLoad %v4uint %x + %23 = OpULessThanEqual %v4bool %20 %22 + %19 = OpSelect %v4uint %23 %27 %18 + %28 = OpLoad %v4uint %x + %29 = OpShiftLeftLogical %v4uint %28 %19 + OpStore %x %29 + %31 = OpLoad %v4uint %x + %34 = OpULessThanEqual %v4bool %31 %33 + %30 = OpSelect %v4uint %34 %36 %18 + %37 = OpLoad %v4uint %x + %38 = OpShiftLeftLogical %v4uint %37 %30 + OpStore %x %38 + %40 = OpLoad %v4uint %x + %43 = OpULessThanEqual %v4bool %40 %42 + %39 = OpSelect %v4uint %43 %45 %18 + %46 = OpLoad %v4uint %x + %47 = OpShiftLeftLogical %v4uint %46 %39 + OpStore %x %47 + %49 = OpLoad %v4uint %x + %52 = OpULessThanEqual %v4bool %49 %51 + %48 = OpSelect %v4uint %52 %54 %18 + %55 = OpLoad %v4uint %x + %56 = OpShiftLeftLogical %v4uint %55 %48 + OpStore %x %56 + %58 = OpLoad %v4uint %x + %61 = OpULessThanEqual %v4bool %58 %60 + %57 = OpSelect %v4uint %61 %63 %18 + %65 = OpLoad %v4uint %x + %66 = OpIEqual %v4bool %65 %18 + %64 = OpSelect %v4uint %66 %63 %18 + %68 = OpBitwiseOr %v4uint %19 %30 + %69 = OpBitwiseOr %v4uint %68 %39 + %70 = OpBitwiseOr %v4uint %69 %48 + %71 = OpBitwiseOr %v4uint %70 %57 + %72 = OpIAdd %v4uint %71 %64 + OpReturnValue %72 + OpFunctionEnd +%countLeadingZeros_f70103 = OpFunction %void None %73 + %76 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4uint Function %18 + %res = OpVariable %_ptr_Function_v4uint Function %18 + OpStore %arg_0 %18 + %79 = OpLoad %v4uint %arg_0 + %78 = OpFunctionCall %v4uint %tint_count_leading_zeros %79 + OpStore %res %78 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %81 + %83 = OpLabel + %84 = OpFunctionCall %void %countLeadingZeros_f70103 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %73 + %86 = OpLabel + %87 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %87 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %73 + %90 = OpLabel + %91 = OpFunctionCall %void %countLeadingZeros_f70103 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %73 + %93 = OpLabel + %94 = OpFunctionCall %void %countLeadingZeros_f70103 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/countLeadingZeros/f70103.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countLeadingZeros/f70103.wgsl.expected.wgsl new file mode 100644 index 0000000000..62fbfc6aff --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/f70103.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn countLeadingZeros_f70103() { + var arg_0 = vec4(); + var res : vec4 = countLeadingZeros(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + countLeadingZeros_f70103(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + countLeadingZeros_f70103(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + countLeadingZeros_f70103(); +} diff --git a/test/tint/builtins/gen/var/countOneBits/0d0e46.wgsl b/test/tint/builtins/gen/var/countOneBits/0d0e46.wgsl new file mode 100644 index 0000000000..61a57d3c6f --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/0d0e46.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countOneBits(vec<4, u32>) -> vec<4, u32> +fn countOneBits_0d0e46() { + var arg_0 = vec4(); + var res: vec4 = countOneBits(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + countOneBits_0d0e46(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + countOneBits_0d0e46(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + countOneBits_0d0e46(); +} diff --git a/test/tint/builtins/gen/var/countOneBits/0d0e46.wgsl.expected.glsl b/test/tint/builtins/gen/var/countOneBits/0d0e46.wgsl.expected.glsl new file mode 100644 index 0000000000..a5c7b974b2 --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/0d0e46.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void countOneBits_0d0e46() { + uvec4 arg_0 = uvec4(0u); + uvec4 res = uvec4(bitCount(arg_0)); +} + +vec4 vertex_main() { + countOneBits_0d0e46(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void countOneBits_0d0e46() { + uvec4 arg_0 = uvec4(0u); + uvec4 res = uvec4(bitCount(arg_0)); +} + +void fragment_main() { + countOneBits_0d0e46(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void countOneBits_0d0e46() { + uvec4 arg_0 = uvec4(0u); + uvec4 res = uvec4(bitCount(arg_0)); +} + +void compute_main() { + countOneBits_0d0e46(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/countOneBits/0d0e46.wgsl.expected.hlsl b/test/tint/builtins/gen/var/countOneBits/0d0e46.wgsl.expected.hlsl new file mode 100644 index 0000000000..65d9518f22 --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/0d0e46.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void countOneBits_0d0e46() { + uint4 arg_0 = (0u).xxxx; + uint4 res = countbits(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countOneBits_0d0e46(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countOneBits_0d0e46(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countOneBits_0d0e46(); + return; +} diff --git a/test/tint/builtins/gen/var/countOneBits/0d0e46.wgsl.expected.msl b/test/tint/builtins/gen/var/countOneBits/0d0e46.wgsl.expected.msl new file mode 100644 index 0000000000..a08898f16c --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/0d0e46.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void countOneBits_0d0e46() { + uint4 arg_0 = uint4(0u); + uint4 res = popcount(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countOneBits_0d0e46(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countOneBits_0d0e46(); + return; +} + +kernel void compute_main() { + countOneBits_0d0e46(); + return; +} + diff --git a/test/tint/builtins/gen/var/countOneBits/0d0e46.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countOneBits/0d0e46.wgsl.expected.spvasm new file mode 100644 index 0000000000..d80bfd798f --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/0d0e46.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %countOneBits_0d0e46 "countOneBits_0d0e46" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + %15 = OpConstantNull %v4uint +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%countOneBits_0d0e46 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4uint Function %15 + %res = OpVariable %_ptr_Function_v4uint Function %15 + OpStore %arg_0 %15 + %19 = OpLoad %v4uint %arg_0 + %18 = OpBitCount %v4uint %19 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %countOneBits_0d0e46 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %countOneBits_0d0e46 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %countOneBits_0d0e46 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/countOneBits/0d0e46.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countOneBits/0d0e46.wgsl.expected.wgsl new file mode 100644 index 0000000000..fd7c5563aa --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/0d0e46.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn countOneBits_0d0e46() { + var arg_0 = vec4(); + var res : vec4 = countOneBits(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + countOneBits_0d0e46(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + countOneBits_0d0e46(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + countOneBits_0d0e46(); +} diff --git a/test/tint/builtins/gen/var/countOneBits/0f7980.wgsl b/test/tint/builtins/gen/var/countOneBits/0f7980.wgsl new file mode 100644 index 0000000000..0e27caa5af --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/0f7980.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countOneBits(vec<4, i32>) -> vec<4, i32> +fn countOneBits_0f7980() { + var arg_0 = vec4(); + var res: vec4 = countOneBits(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + countOneBits_0f7980(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + countOneBits_0f7980(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + countOneBits_0f7980(); +} diff --git a/test/tint/builtins/gen/var/countOneBits/0f7980.wgsl.expected.glsl b/test/tint/builtins/gen/var/countOneBits/0f7980.wgsl.expected.glsl new file mode 100644 index 0000000000..627bd2b597 --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/0f7980.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void countOneBits_0f7980() { + ivec4 arg_0 = ivec4(0); + ivec4 res = ivec4(bitCount(arg_0)); +} + +vec4 vertex_main() { + countOneBits_0f7980(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void countOneBits_0f7980() { + ivec4 arg_0 = ivec4(0); + ivec4 res = ivec4(bitCount(arg_0)); +} + +void fragment_main() { + countOneBits_0f7980(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void countOneBits_0f7980() { + ivec4 arg_0 = ivec4(0); + ivec4 res = ivec4(bitCount(arg_0)); +} + +void compute_main() { + countOneBits_0f7980(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/countOneBits/0f7980.wgsl.expected.hlsl b/test/tint/builtins/gen/var/countOneBits/0f7980.wgsl.expected.hlsl new file mode 100644 index 0000000000..0fd2b2eac8 --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/0f7980.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void countOneBits_0f7980() { + int4 arg_0 = (0).xxxx; + int4 res = asint(countbits(asuint(arg_0))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countOneBits_0f7980(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countOneBits_0f7980(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countOneBits_0f7980(); + return; +} diff --git a/test/tint/builtins/gen/var/countOneBits/0f7980.wgsl.expected.msl b/test/tint/builtins/gen/var/countOneBits/0f7980.wgsl.expected.msl new file mode 100644 index 0000000000..39c833d903 --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/0f7980.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void countOneBits_0f7980() { + int4 arg_0 = int4(0); + int4 res = popcount(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countOneBits_0f7980(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countOneBits_0f7980(); + return; +} + +kernel void compute_main() { + countOneBits_0f7980(); + return; +} + diff --git a/test/tint/builtins/gen/var/countOneBits/0f7980.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countOneBits/0f7980.wgsl.expected.spvasm new file mode 100644 index 0000000000..31f4f89952 --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/0f7980.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %countOneBits_0f7980 "countOneBits_0f7980" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %15 = OpConstantNull %v4int +%_ptr_Function_v4int = OpTypePointer Function %v4int + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%countOneBits_0f7980 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4int Function %15 + %res = OpVariable %_ptr_Function_v4int Function %15 + OpStore %arg_0 %15 + %19 = OpLoad %v4int %arg_0 + %18 = OpBitCount %v4int %19 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %countOneBits_0f7980 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %countOneBits_0f7980 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %countOneBits_0f7980 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/countOneBits/0f7980.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countOneBits/0f7980.wgsl.expected.wgsl new file mode 100644 index 0000000000..200c35e759 --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/0f7980.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn countOneBits_0f7980() { + var arg_0 = vec4(); + var res : vec4 = countOneBits(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + countOneBits_0f7980(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + countOneBits_0f7980(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + countOneBits_0f7980(); +} diff --git a/test/tint/builtins/gen/var/countOneBits/65d2ae.wgsl b/test/tint/builtins/gen/var/countOneBits/65d2ae.wgsl new file mode 100644 index 0000000000..5b4d0a253c --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/65d2ae.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countOneBits(vec<3, i32>) -> vec<3, i32> +fn countOneBits_65d2ae() { + var arg_0 = vec3(); + var res: vec3 = countOneBits(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + countOneBits_65d2ae(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + countOneBits_65d2ae(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + countOneBits_65d2ae(); +} diff --git a/test/tint/builtins/gen/var/countOneBits/65d2ae.wgsl.expected.glsl b/test/tint/builtins/gen/var/countOneBits/65d2ae.wgsl.expected.glsl new file mode 100644 index 0000000000..f7f55d377b --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/65d2ae.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void countOneBits_65d2ae() { + ivec3 arg_0 = ivec3(0); + ivec3 res = ivec3(bitCount(arg_0)); +} + +vec4 vertex_main() { + countOneBits_65d2ae(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void countOneBits_65d2ae() { + ivec3 arg_0 = ivec3(0); + ivec3 res = ivec3(bitCount(arg_0)); +} + +void fragment_main() { + countOneBits_65d2ae(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void countOneBits_65d2ae() { + ivec3 arg_0 = ivec3(0); + ivec3 res = ivec3(bitCount(arg_0)); +} + +void compute_main() { + countOneBits_65d2ae(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/countOneBits/65d2ae.wgsl.expected.hlsl b/test/tint/builtins/gen/var/countOneBits/65d2ae.wgsl.expected.hlsl new file mode 100644 index 0000000000..d93901e7c4 --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/65d2ae.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void countOneBits_65d2ae() { + int3 arg_0 = (0).xxx; + int3 res = asint(countbits(asuint(arg_0))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countOneBits_65d2ae(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countOneBits_65d2ae(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countOneBits_65d2ae(); + return; +} diff --git a/test/tint/builtins/gen/var/countOneBits/65d2ae.wgsl.expected.msl b/test/tint/builtins/gen/var/countOneBits/65d2ae.wgsl.expected.msl new file mode 100644 index 0000000000..862de76224 --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/65d2ae.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void countOneBits_65d2ae() { + int3 arg_0 = int3(0); + int3 res = popcount(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countOneBits_65d2ae(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countOneBits_65d2ae(); + return; +} + +kernel void compute_main() { + countOneBits_65d2ae(); + return; +} + diff --git a/test/tint/builtins/gen/var/countOneBits/65d2ae.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countOneBits/65d2ae.wgsl.expected.spvasm new file mode 100644 index 0000000000..c0d6318401 --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/65d2ae.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %countOneBits_65d2ae "countOneBits_65d2ae" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %15 = OpConstantNull %v3int +%_ptr_Function_v3int = OpTypePointer Function %v3int + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%countOneBits_65d2ae = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3int Function %15 + %res = OpVariable %_ptr_Function_v3int Function %15 + OpStore %arg_0 %15 + %19 = OpLoad %v3int %arg_0 + %18 = OpBitCount %v3int %19 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %countOneBits_65d2ae + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %countOneBits_65d2ae + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %countOneBits_65d2ae + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/countOneBits/65d2ae.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countOneBits/65d2ae.wgsl.expected.wgsl new file mode 100644 index 0000000000..f5a982382b --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/65d2ae.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn countOneBits_65d2ae() { + var arg_0 = vec3(); + var res : vec3 = countOneBits(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + countOneBits_65d2ae(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + countOneBits_65d2ae(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + countOneBits_65d2ae(); +} diff --git a/test/tint/builtins/gen/var/countOneBits/690cfc.wgsl b/test/tint/builtins/gen/var/countOneBits/690cfc.wgsl new file mode 100644 index 0000000000..737f27652c --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/690cfc.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countOneBits(vec<3, u32>) -> vec<3, u32> +fn countOneBits_690cfc() { + var arg_0 = vec3(); + var res: vec3 = countOneBits(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + countOneBits_690cfc(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + countOneBits_690cfc(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + countOneBits_690cfc(); +} diff --git a/test/tint/builtins/gen/var/countOneBits/690cfc.wgsl.expected.glsl b/test/tint/builtins/gen/var/countOneBits/690cfc.wgsl.expected.glsl new file mode 100644 index 0000000000..038c4a9e28 --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/690cfc.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void countOneBits_690cfc() { + uvec3 arg_0 = uvec3(0u); + uvec3 res = uvec3(bitCount(arg_0)); +} + +vec4 vertex_main() { + countOneBits_690cfc(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void countOneBits_690cfc() { + uvec3 arg_0 = uvec3(0u); + uvec3 res = uvec3(bitCount(arg_0)); +} + +void fragment_main() { + countOneBits_690cfc(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void countOneBits_690cfc() { + uvec3 arg_0 = uvec3(0u); + uvec3 res = uvec3(bitCount(arg_0)); +} + +void compute_main() { + countOneBits_690cfc(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/countOneBits/690cfc.wgsl.expected.hlsl b/test/tint/builtins/gen/var/countOneBits/690cfc.wgsl.expected.hlsl new file mode 100644 index 0000000000..41849453dd --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/690cfc.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void countOneBits_690cfc() { + uint3 arg_0 = (0u).xxx; + uint3 res = countbits(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countOneBits_690cfc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countOneBits_690cfc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countOneBits_690cfc(); + return; +} diff --git a/test/tint/builtins/gen/var/countOneBits/690cfc.wgsl.expected.msl b/test/tint/builtins/gen/var/countOneBits/690cfc.wgsl.expected.msl new file mode 100644 index 0000000000..d0460a80a9 --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/690cfc.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void countOneBits_690cfc() { + uint3 arg_0 = uint3(0u); + uint3 res = popcount(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countOneBits_690cfc(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countOneBits_690cfc(); + return; +} + +kernel void compute_main() { + countOneBits_690cfc(); + return; +} + diff --git a/test/tint/builtins/gen/var/countOneBits/690cfc.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countOneBits/690cfc.wgsl.expected.spvasm new file mode 100644 index 0000000000..b6ddf63556 --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/690cfc.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %countOneBits_690cfc "countOneBits_690cfc" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %15 = OpConstantNull %v3uint +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%countOneBits_690cfc = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3uint Function %15 + %res = OpVariable %_ptr_Function_v3uint Function %15 + OpStore %arg_0 %15 + %19 = OpLoad %v3uint %arg_0 + %18 = OpBitCount %v3uint %19 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %countOneBits_690cfc + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %countOneBits_690cfc + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %countOneBits_690cfc + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/countOneBits/690cfc.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countOneBits/690cfc.wgsl.expected.wgsl new file mode 100644 index 0000000000..4c33e511b9 --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/690cfc.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn countOneBits_690cfc() { + var arg_0 = vec3(); + var res : vec3 = countOneBits(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + countOneBits_690cfc(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + countOneBits_690cfc(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + countOneBits_690cfc(); +} diff --git a/test/tint/builtins/gen/var/countOneBits/94fd81.wgsl b/test/tint/builtins/gen/var/countOneBits/94fd81.wgsl new file mode 100644 index 0000000000..6832818658 --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/94fd81.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countOneBits(vec<2, u32>) -> vec<2, u32> +fn countOneBits_94fd81() { + var arg_0 = vec2(); + var res: vec2 = countOneBits(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + countOneBits_94fd81(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + countOneBits_94fd81(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + countOneBits_94fd81(); +} diff --git a/test/tint/builtins/gen/var/countOneBits/94fd81.wgsl.expected.glsl b/test/tint/builtins/gen/var/countOneBits/94fd81.wgsl.expected.glsl new file mode 100644 index 0000000000..abbdc4c5eb --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/94fd81.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void countOneBits_94fd81() { + uvec2 arg_0 = uvec2(0u); + uvec2 res = uvec2(bitCount(arg_0)); +} + +vec4 vertex_main() { + countOneBits_94fd81(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void countOneBits_94fd81() { + uvec2 arg_0 = uvec2(0u); + uvec2 res = uvec2(bitCount(arg_0)); +} + +void fragment_main() { + countOneBits_94fd81(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void countOneBits_94fd81() { + uvec2 arg_0 = uvec2(0u); + uvec2 res = uvec2(bitCount(arg_0)); +} + +void compute_main() { + countOneBits_94fd81(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/countOneBits/94fd81.wgsl.expected.hlsl b/test/tint/builtins/gen/var/countOneBits/94fd81.wgsl.expected.hlsl new file mode 100644 index 0000000000..962e4478cc --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/94fd81.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void countOneBits_94fd81() { + uint2 arg_0 = (0u).xx; + uint2 res = countbits(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countOneBits_94fd81(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countOneBits_94fd81(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countOneBits_94fd81(); + return; +} diff --git a/test/tint/builtins/gen/var/countOneBits/94fd81.wgsl.expected.msl b/test/tint/builtins/gen/var/countOneBits/94fd81.wgsl.expected.msl new file mode 100644 index 0000000000..f41704e7e2 --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/94fd81.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void countOneBits_94fd81() { + uint2 arg_0 = uint2(0u); + uint2 res = popcount(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countOneBits_94fd81(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countOneBits_94fd81(); + return; +} + +kernel void compute_main() { + countOneBits_94fd81(); + return; +} + diff --git a/test/tint/builtins/gen/var/countOneBits/94fd81.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countOneBits/94fd81.wgsl.expected.spvasm new file mode 100644 index 0000000000..d099bc2561 --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/94fd81.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %countOneBits_94fd81 "countOneBits_94fd81" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %15 = OpConstantNull %v2uint +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%countOneBits_94fd81 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2uint Function %15 + %res = OpVariable %_ptr_Function_v2uint Function %15 + OpStore %arg_0 %15 + %19 = OpLoad %v2uint %arg_0 + %18 = OpBitCount %v2uint %19 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %countOneBits_94fd81 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %countOneBits_94fd81 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %countOneBits_94fd81 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/countOneBits/94fd81.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countOneBits/94fd81.wgsl.expected.wgsl new file mode 100644 index 0000000000..5048e6c7a5 --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/94fd81.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn countOneBits_94fd81() { + var arg_0 = vec2(); + var res : vec2 = countOneBits(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + countOneBits_94fd81(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + countOneBits_94fd81(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + countOneBits_94fd81(); +} diff --git a/test/tint/builtins/gen/var/countOneBits/ae44f9.wgsl b/test/tint/builtins/gen/var/countOneBits/ae44f9.wgsl new file mode 100644 index 0000000000..3e6f59ae1f --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/ae44f9.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countOneBits(u32) -> u32 +fn countOneBits_ae44f9() { + var arg_0 = 1u; + var res: u32 = countOneBits(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + countOneBits_ae44f9(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + countOneBits_ae44f9(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + countOneBits_ae44f9(); +} diff --git a/test/tint/builtins/gen/var/countOneBits/ae44f9.wgsl.expected.glsl b/test/tint/builtins/gen/var/countOneBits/ae44f9.wgsl.expected.glsl new file mode 100644 index 0000000000..c47d7d073a --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/ae44f9.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void countOneBits_ae44f9() { + uint arg_0 = 1u; + uint res = uint(bitCount(arg_0)); +} + +vec4 vertex_main() { + countOneBits_ae44f9(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void countOneBits_ae44f9() { + uint arg_0 = 1u; + uint res = uint(bitCount(arg_0)); +} + +void fragment_main() { + countOneBits_ae44f9(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void countOneBits_ae44f9() { + uint arg_0 = 1u; + uint res = uint(bitCount(arg_0)); +} + +void compute_main() { + countOneBits_ae44f9(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/countOneBits/ae44f9.wgsl.expected.hlsl b/test/tint/builtins/gen/var/countOneBits/ae44f9.wgsl.expected.hlsl new file mode 100644 index 0000000000..5c19408cde --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/ae44f9.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void countOneBits_ae44f9() { + uint arg_0 = 1u; + uint res = countbits(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countOneBits_ae44f9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countOneBits_ae44f9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countOneBits_ae44f9(); + return; +} diff --git a/test/tint/builtins/gen/var/countOneBits/ae44f9.wgsl.expected.msl b/test/tint/builtins/gen/var/countOneBits/ae44f9.wgsl.expected.msl new file mode 100644 index 0000000000..a04bb18100 --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/ae44f9.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void countOneBits_ae44f9() { + uint arg_0 = 1u; + uint res = popcount(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countOneBits_ae44f9(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countOneBits_ae44f9(); + return; +} + +kernel void compute_main() { + countOneBits_ae44f9(); + return; +} + diff --git a/test/tint/builtins/gen/var/countOneBits/ae44f9.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countOneBits/ae44f9.wgsl.expected.spvasm new file mode 100644 index 0000000000..5879bf3329 --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/ae44f9.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %countOneBits_ae44f9 "countOneBits_ae44f9" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %17 = OpConstantNull %uint + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%countOneBits_ae44f9 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_uint Function %17 + %res = OpVariable %_ptr_Function_uint Function %17 + OpStore %arg_0 %uint_1 + %19 = OpLoad %uint %arg_0 + %18 = OpBitCount %uint %19 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %countOneBits_ae44f9 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %countOneBits_ae44f9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %countOneBits_ae44f9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/countOneBits/ae44f9.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countOneBits/ae44f9.wgsl.expected.wgsl new file mode 100644 index 0000000000..3c536e6d75 --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/ae44f9.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn countOneBits_ae44f9() { + var arg_0 = 1u; + var res : u32 = countOneBits(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + countOneBits_ae44f9(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + countOneBits_ae44f9(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + countOneBits_ae44f9(); +} diff --git a/test/tint/builtins/gen/var/countOneBits/af90e2.wgsl b/test/tint/builtins/gen/var/countOneBits/af90e2.wgsl new file mode 100644 index 0000000000..c9d9775429 --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/af90e2.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countOneBits(vec<2, i32>) -> vec<2, i32> +fn countOneBits_af90e2() { + var arg_0 = vec2(); + var res: vec2 = countOneBits(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + countOneBits_af90e2(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + countOneBits_af90e2(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + countOneBits_af90e2(); +} diff --git a/test/tint/builtins/gen/var/countOneBits/af90e2.wgsl.expected.glsl b/test/tint/builtins/gen/var/countOneBits/af90e2.wgsl.expected.glsl new file mode 100644 index 0000000000..9ce908d137 --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/af90e2.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void countOneBits_af90e2() { + ivec2 arg_0 = ivec2(0); + ivec2 res = ivec2(bitCount(arg_0)); +} + +vec4 vertex_main() { + countOneBits_af90e2(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void countOneBits_af90e2() { + ivec2 arg_0 = ivec2(0); + ivec2 res = ivec2(bitCount(arg_0)); +} + +void fragment_main() { + countOneBits_af90e2(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void countOneBits_af90e2() { + ivec2 arg_0 = ivec2(0); + ivec2 res = ivec2(bitCount(arg_0)); +} + +void compute_main() { + countOneBits_af90e2(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/countOneBits/af90e2.wgsl.expected.hlsl b/test/tint/builtins/gen/var/countOneBits/af90e2.wgsl.expected.hlsl new file mode 100644 index 0000000000..c68afc7207 --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/af90e2.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void countOneBits_af90e2() { + int2 arg_0 = (0).xx; + int2 res = asint(countbits(asuint(arg_0))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countOneBits_af90e2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countOneBits_af90e2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countOneBits_af90e2(); + return; +} diff --git a/test/tint/builtins/gen/var/countOneBits/af90e2.wgsl.expected.msl b/test/tint/builtins/gen/var/countOneBits/af90e2.wgsl.expected.msl new file mode 100644 index 0000000000..8239226feb --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/af90e2.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void countOneBits_af90e2() { + int2 arg_0 = int2(0); + int2 res = popcount(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countOneBits_af90e2(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countOneBits_af90e2(); + return; +} + +kernel void compute_main() { + countOneBits_af90e2(); + return; +} + diff --git a/test/tint/builtins/gen/var/countOneBits/af90e2.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countOneBits/af90e2.wgsl.expected.spvasm new file mode 100644 index 0000000000..4b30596666 --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/af90e2.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %countOneBits_af90e2 "countOneBits_af90e2" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %15 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%countOneBits_af90e2 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2int Function %15 + %res = OpVariable %_ptr_Function_v2int Function %15 + OpStore %arg_0 %15 + %19 = OpLoad %v2int %arg_0 + %18 = OpBitCount %v2int %19 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %countOneBits_af90e2 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %countOneBits_af90e2 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %countOneBits_af90e2 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/countOneBits/af90e2.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countOneBits/af90e2.wgsl.expected.wgsl new file mode 100644 index 0000000000..259a107d8b --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/af90e2.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn countOneBits_af90e2() { + var arg_0 = vec2(); + var res : vec2 = countOneBits(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + countOneBits_af90e2(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + countOneBits_af90e2(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + countOneBits_af90e2(); +} diff --git a/test/tint/builtins/gen/var/countOneBits/fd88b2.wgsl b/test/tint/builtins/gen/var/countOneBits/fd88b2.wgsl new file mode 100644 index 0000000000..e96dd99032 --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/fd88b2.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countOneBits(i32) -> i32 +fn countOneBits_fd88b2() { + var arg_0 = 1; + var res: i32 = countOneBits(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + countOneBits_fd88b2(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + countOneBits_fd88b2(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + countOneBits_fd88b2(); +} diff --git a/test/tint/builtins/gen/var/countOneBits/fd88b2.wgsl.expected.glsl b/test/tint/builtins/gen/var/countOneBits/fd88b2.wgsl.expected.glsl new file mode 100644 index 0000000000..7ef846b5c2 --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/fd88b2.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void countOneBits_fd88b2() { + int arg_0 = 1; + int res = int(bitCount(arg_0)); +} + +vec4 vertex_main() { + countOneBits_fd88b2(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void countOneBits_fd88b2() { + int arg_0 = 1; + int res = int(bitCount(arg_0)); +} + +void fragment_main() { + countOneBits_fd88b2(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void countOneBits_fd88b2() { + int arg_0 = 1; + int res = int(bitCount(arg_0)); +} + +void compute_main() { + countOneBits_fd88b2(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/countOneBits/fd88b2.wgsl.expected.hlsl b/test/tint/builtins/gen/var/countOneBits/fd88b2.wgsl.expected.hlsl new file mode 100644 index 0000000000..7801d95ad6 --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/fd88b2.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void countOneBits_fd88b2() { + int arg_0 = 1; + int res = asint(countbits(asuint(arg_0))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countOneBits_fd88b2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countOneBits_fd88b2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countOneBits_fd88b2(); + return; +} diff --git a/test/tint/builtins/gen/var/countOneBits/fd88b2.wgsl.expected.msl b/test/tint/builtins/gen/var/countOneBits/fd88b2.wgsl.expected.msl new file mode 100644 index 0000000000..5077121a00 --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/fd88b2.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void countOneBits_fd88b2() { + int arg_0 = 1; + int res = popcount(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countOneBits_fd88b2(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countOneBits_fd88b2(); + return; +} + +kernel void compute_main() { + countOneBits_fd88b2(); + return; +} + diff --git a/test/tint/builtins/gen/var/countOneBits/fd88b2.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countOneBits/fd88b2.wgsl.expected.spvasm new file mode 100644 index 0000000000..e3733f0ad9 --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/fd88b2.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %countOneBits_fd88b2 "countOneBits_fd88b2" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %17 = OpConstantNull %int + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%countOneBits_fd88b2 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_int Function %17 + %res = OpVariable %_ptr_Function_int Function %17 + OpStore %arg_0 %int_1 + %19 = OpLoad %int %arg_0 + %18 = OpBitCount %int %19 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %countOneBits_fd88b2 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %countOneBits_fd88b2 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %countOneBits_fd88b2 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/countOneBits/fd88b2.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countOneBits/fd88b2.wgsl.expected.wgsl new file mode 100644 index 0000000000..b3e14534f2 --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/fd88b2.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn countOneBits_fd88b2() { + var arg_0 = 1; + var res : i32 = countOneBits(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + countOneBits_fd88b2(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + countOneBits_fd88b2(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + countOneBits_fd88b2(); +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/1ad138.wgsl b/test/tint/builtins/gen/var/countTrailingZeros/1ad138.wgsl new file mode 100644 index 0000000000..70140f1a71 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/1ad138.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countTrailingZeros(vec<2, u32>) -> vec<2, u32> +fn countTrailingZeros_1ad138() { + var arg_0 = vec2(); + var res: vec2 = countTrailingZeros(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + countTrailingZeros_1ad138(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + countTrailingZeros_1ad138(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + countTrailingZeros_1ad138(); +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/1ad138.wgsl.expected.glsl b/test/tint/builtins/gen/var/countTrailingZeros/1ad138.wgsl.expected.glsl new file mode 100644 index 0000000000..1c3447b1bd --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/1ad138.wgsl.expected.glsl @@ -0,0 +1,97 @@ +#version 310 es + +uvec2 tint_count_trailing_zeros(uvec2 v) { + uvec2 x = uvec2(v); + uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u)))); + x = (x >> b16); + uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u)))); + x = (x >> b8); + uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u)))); + x = (x >> b4); + uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u)))); + x = (x >> b2); + uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u)))); + uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u))); + return uvec2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_1ad138() { + uvec2 arg_0 = uvec2(0u); + uvec2 res = tint_count_trailing_zeros(arg_0); +} + +vec4 vertex_main() { + countTrailingZeros_1ad138(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uvec2 tint_count_trailing_zeros(uvec2 v) { + uvec2 x = uvec2(v); + uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u)))); + x = (x >> b16); + uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u)))); + x = (x >> b8); + uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u)))); + x = (x >> b4); + uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u)))); + x = (x >> b2); + uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u)))); + uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u))); + return uvec2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_1ad138() { + uvec2 arg_0 = uvec2(0u); + uvec2 res = tint_count_trailing_zeros(arg_0); +} + +void fragment_main() { + countTrailingZeros_1ad138(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uvec2 tint_count_trailing_zeros(uvec2 v) { + uvec2 x = uvec2(v); + uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u)))); + x = (x >> b16); + uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u)))); + x = (x >> b8); + uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u)))); + x = (x >> b4); + uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u)))); + x = (x >> b2); + uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u)))); + uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u))); + return uvec2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_1ad138() { + uvec2 arg_0 = uvec2(0u); + uvec2 res = tint_count_trailing_zeros(arg_0); +} + +void compute_main() { + countTrailingZeros_1ad138(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/1ad138.wgsl.expected.hlsl b/test/tint/builtins/gen/var/countTrailingZeros/1ad138.wgsl.expected.hlsl new file mode 100644 index 0000000000..789f233fd6 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/1ad138.wgsl.expected.hlsl @@ -0,0 +1,46 @@ +uint2 tint_count_trailing_zeros(uint2 v) { + uint2 x = uint2(v); + const uint2 b16 = (bool2((x & (65535u).xx)) ? (0u).xx : (16u).xx); + x = (x >> b16); + const uint2 b8 = (bool2((x & (255u).xx)) ? (0u).xx : (8u).xx); + x = (x >> b8); + const uint2 b4 = (bool2((x & (15u).xx)) ? (0u).xx : (4u).xx); + x = (x >> b4); + const uint2 b2 = (bool2((x & (3u).xx)) ? (0u).xx : (2u).xx); + x = (x >> b2); + const uint2 b1 = (bool2((x & (1u).xx)) ? (0u).xx : (1u).xx); + const uint2 is_zero = ((x == (0u).xx) ? (1u).xx : (0u).xx); + return uint2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_1ad138() { + uint2 arg_0 = (0u).xx; + uint2 res = tint_count_trailing_zeros(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countTrailingZeros_1ad138(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countTrailingZeros_1ad138(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countTrailingZeros_1ad138(); + return; +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/1ad138.wgsl.expected.msl b/test/tint/builtins/gen/var/countTrailingZeros/1ad138.wgsl.expected.msl new file mode 100644 index 0000000000..c9a3f49fb6 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/1ad138.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void countTrailingZeros_1ad138() { + uint2 arg_0 = uint2(0u); + uint2 res = ctz(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countTrailingZeros_1ad138(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countTrailingZeros_1ad138(); + return; +} + +kernel void compute_main() { + countTrailingZeros_1ad138(); + return; +} + diff --git a/test/tint/builtins/gen/var/countTrailingZeros/1ad138.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countTrailingZeros/1ad138.wgsl.expected.spvasm new file mode 100644 index 0000000000..e782aa6160 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/1ad138.wgsl.expected.spvasm @@ -0,0 +1,142 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 98 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_count_trailing_zeros "tint_count_trailing_zeros" + OpName %v "v" + OpName %x "x" + OpName %countTrailingZeros_1ad138 "countTrailingZeros_1ad138" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %9 = OpTypeFunction %v2uint %v2uint +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %18 = OpConstantNull %v2uint + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %uint_65535 = OpConstant %uint 65535 + %25 = OpConstantComposite %v2uint %uint_65535 %uint_65535 + %uint_16 = OpConstant %uint 16 + %28 = OpConstantComposite %v2uint %uint_16 %uint_16 + %uint_255 = OpConstant %uint 255 + %35 = OpConstantComposite %v2uint %uint_255 %uint_255 + %uint_8 = OpConstant %uint 8 + %38 = OpConstantComposite %v2uint %uint_8 %uint_8 + %uint_15 = OpConstant %uint 15 + %45 = OpConstantComposite %v2uint %uint_15 %uint_15 + %uint_4 = OpConstant %uint 4 + %48 = OpConstantComposite %v2uint %uint_4 %uint_4 + %uint_3 = OpConstant %uint 3 + %55 = OpConstantComposite %v2uint %uint_3 %uint_3 + %uint_2 = OpConstant %uint 2 + %58 = OpConstantComposite %v2uint %uint_2 %uint_2 + %uint_1 = OpConstant %uint 1 + %65 = OpConstantComposite %v2uint %uint_1 %uint_1 + %void = OpTypeVoid + %76 = OpTypeFunction %void + %84 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_count_trailing_zeros = OpFunction %v2uint None %9 + %v = OpFunctionParameter %v2uint + %14 = OpLabel + %x = OpVariable %_ptr_Function_v2uint Function %18 + OpStore %x %v + %23 = OpLoad %v2uint %x + %26 = OpBitwiseAnd %v2uint %23 %25 + %20 = OpINotEqual %v2bool %26 %18 + %19 = OpSelect %v2uint %20 %18 %28 + %29 = OpLoad %v2uint %x + %30 = OpShiftRightLogical %v2uint %29 %19 + OpStore %x %30 + %33 = OpLoad %v2uint %x + %36 = OpBitwiseAnd %v2uint %33 %35 + %32 = OpINotEqual %v2bool %36 %18 + %31 = OpSelect %v2uint %32 %18 %38 + %39 = OpLoad %v2uint %x + %40 = OpShiftRightLogical %v2uint %39 %31 + OpStore %x %40 + %43 = OpLoad %v2uint %x + %46 = OpBitwiseAnd %v2uint %43 %45 + %42 = OpINotEqual %v2bool %46 %18 + %41 = OpSelect %v2uint %42 %18 %48 + %49 = OpLoad %v2uint %x + %50 = OpShiftRightLogical %v2uint %49 %41 + OpStore %x %50 + %53 = OpLoad %v2uint %x + %56 = OpBitwiseAnd %v2uint %53 %55 + %52 = OpINotEqual %v2bool %56 %18 + %51 = OpSelect %v2uint %52 %18 %58 + %59 = OpLoad %v2uint %x + %60 = OpShiftRightLogical %v2uint %59 %51 + OpStore %x %60 + %63 = OpLoad %v2uint %x + %66 = OpBitwiseAnd %v2uint %63 %65 + %62 = OpINotEqual %v2bool %66 %18 + %61 = OpSelect %v2uint %62 %18 %65 + %68 = OpLoad %v2uint %x + %69 = OpIEqual %v2bool %68 %18 + %67 = OpSelect %v2uint %69 %65 %18 + %71 = OpBitwiseOr %v2uint %19 %31 + %72 = OpBitwiseOr %v2uint %71 %41 + %73 = OpBitwiseOr %v2uint %72 %51 + %74 = OpBitwiseOr %v2uint %73 %61 + %75 = OpIAdd %v2uint %74 %67 + OpReturnValue %75 + OpFunctionEnd +%countTrailingZeros_1ad138 = OpFunction %void None %76 + %79 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2uint Function %18 + %res = OpVariable %_ptr_Function_v2uint Function %18 + OpStore %arg_0 %18 + %82 = OpLoad %v2uint %arg_0 + %81 = OpFunctionCall %v2uint %tint_count_trailing_zeros %82 + OpStore %res %81 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %84 + %86 = OpLabel + %87 = OpFunctionCall %void %countTrailingZeros_1ad138 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %76 + %89 = OpLabel + %90 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %90 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %76 + %93 = OpLabel + %94 = OpFunctionCall %void %countTrailingZeros_1ad138 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %76 + %96 = OpLabel + %97 = OpFunctionCall %void %countTrailingZeros_1ad138 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/countTrailingZeros/1ad138.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countTrailingZeros/1ad138.wgsl.expected.wgsl new file mode 100644 index 0000000000..a4169f7525 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/1ad138.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn countTrailingZeros_1ad138() { + var arg_0 = vec2(); + var res : vec2 = countTrailingZeros(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + countTrailingZeros_1ad138(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + countTrailingZeros_1ad138(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + countTrailingZeros_1ad138(); +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/1dc84a.wgsl b/test/tint/builtins/gen/var/countTrailingZeros/1dc84a.wgsl new file mode 100644 index 0000000000..0834908238 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/1dc84a.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countTrailingZeros(vec<4, i32>) -> vec<4, i32> +fn countTrailingZeros_1dc84a() { + var arg_0 = vec4(); + var res: vec4 = countTrailingZeros(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + countTrailingZeros_1dc84a(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + countTrailingZeros_1dc84a(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + countTrailingZeros_1dc84a(); +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/1dc84a.wgsl.expected.glsl b/test/tint/builtins/gen/var/countTrailingZeros/1dc84a.wgsl.expected.glsl new file mode 100644 index 0000000000..5868bbe169 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/1dc84a.wgsl.expected.glsl @@ -0,0 +1,97 @@ +#version 310 es + +ivec4 tint_count_trailing_zeros(ivec4 v) { + uvec4 x = uvec4(v); + uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u)))); + x = (x >> b16); + uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u)))); + x = (x >> b8); + uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u)))); + x = (x >> b4); + uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u)))); + x = (x >> b2); + uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u)))); + uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u))); + return ivec4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_1dc84a() { + ivec4 arg_0 = ivec4(0); + ivec4 res = tint_count_trailing_zeros(arg_0); +} + +vec4 vertex_main() { + countTrailingZeros_1dc84a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +ivec4 tint_count_trailing_zeros(ivec4 v) { + uvec4 x = uvec4(v); + uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u)))); + x = (x >> b16); + uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u)))); + x = (x >> b8); + uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u)))); + x = (x >> b4); + uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u)))); + x = (x >> b2); + uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u)))); + uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u))); + return ivec4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_1dc84a() { + ivec4 arg_0 = ivec4(0); + ivec4 res = tint_count_trailing_zeros(arg_0); +} + +void fragment_main() { + countTrailingZeros_1dc84a(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +ivec4 tint_count_trailing_zeros(ivec4 v) { + uvec4 x = uvec4(v); + uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u)))); + x = (x >> b16); + uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u)))); + x = (x >> b8); + uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u)))); + x = (x >> b4); + uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u)))); + x = (x >> b2); + uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u)))); + uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u))); + return ivec4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_1dc84a() { + ivec4 arg_0 = ivec4(0); + ivec4 res = tint_count_trailing_zeros(arg_0); +} + +void compute_main() { + countTrailingZeros_1dc84a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/1dc84a.wgsl.expected.hlsl b/test/tint/builtins/gen/var/countTrailingZeros/1dc84a.wgsl.expected.hlsl new file mode 100644 index 0000000000..54f1937ad5 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/1dc84a.wgsl.expected.hlsl @@ -0,0 +1,46 @@ +int4 tint_count_trailing_zeros(int4 v) { + uint4 x = uint4(v); + const uint4 b16 = (bool4((x & (65535u).xxxx)) ? (0u).xxxx : (16u).xxxx); + x = (x >> b16); + const uint4 b8 = (bool4((x & (255u).xxxx)) ? (0u).xxxx : (8u).xxxx); + x = (x >> b8); + const uint4 b4 = (bool4((x & (15u).xxxx)) ? (0u).xxxx : (4u).xxxx); + x = (x >> b4); + const uint4 b2 = (bool4((x & (3u).xxxx)) ? (0u).xxxx : (2u).xxxx); + x = (x >> b2); + const uint4 b1 = (bool4((x & (1u).xxxx)) ? (0u).xxxx : (1u).xxxx); + const uint4 is_zero = ((x == (0u).xxxx) ? (1u).xxxx : (0u).xxxx); + return int4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_1dc84a() { + int4 arg_0 = (0).xxxx; + int4 res = tint_count_trailing_zeros(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countTrailingZeros_1dc84a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countTrailingZeros_1dc84a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countTrailingZeros_1dc84a(); + return; +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/1dc84a.wgsl.expected.msl b/test/tint/builtins/gen/var/countTrailingZeros/1dc84a.wgsl.expected.msl new file mode 100644 index 0000000000..0d8f6ecee6 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/1dc84a.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void countTrailingZeros_1dc84a() { + int4 arg_0 = int4(0); + int4 res = ctz(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countTrailingZeros_1dc84a(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countTrailingZeros_1dc84a(); + return; +} + +kernel void compute_main() { + countTrailingZeros_1dc84a(); + return; +} + diff --git a/test/tint/builtins/gen/var/countTrailingZeros/1dc84a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countTrailingZeros/1dc84a.wgsl.expected.spvasm new file mode 100644 index 0000000000..e4f2586b9f --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/1dc84a.wgsl.expected.spvasm @@ -0,0 +1,148 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 102 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_count_trailing_zeros "tint_count_trailing_zeros" + OpName %v "v" + OpName %x "x" + OpName %countTrailingZeros_1dc84a "countTrailingZeros_1dc84a" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %9 = OpTypeFunction %v4int %v4int + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %20 = OpConstantNull %v4uint + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %uint_65535 = OpConstant %uint 65535 + %27 = OpConstantComposite %v4uint %uint_65535 %uint_65535 %uint_65535 %uint_65535 + %uint_16 = OpConstant %uint 16 + %30 = OpConstantComposite %v4uint %uint_16 %uint_16 %uint_16 %uint_16 + %uint_255 = OpConstant %uint 255 + %37 = OpConstantComposite %v4uint %uint_255 %uint_255 %uint_255 %uint_255 + %uint_8 = OpConstant %uint 8 + %40 = OpConstantComposite %v4uint %uint_8 %uint_8 %uint_8 %uint_8 + %uint_15 = OpConstant %uint 15 + %47 = OpConstantComposite %v4uint %uint_15 %uint_15 %uint_15 %uint_15 + %uint_4 = OpConstant %uint 4 + %50 = OpConstantComposite %v4uint %uint_4 %uint_4 %uint_4 %uint_4 + %uint_3 = OpConstant %uint 3 + %57 = OpConstantComposite %v4uint %uint_3 %uint_3 %uint_3 %uint_3 + %uint_2 = OpConstant %uint 2 + %60 = OpConstantComposite %v4uint %uint_2 %uint_2 %uint_2 %uint_2 + %uint_1 = OpConstant %uint 1 + %67 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1 + %void = OpTypeVoid + %78 = OpTypeFunction %void + %82 = OpConstantNull %v4int +%_ptr_Function_v4int = OpTypePointer Function %v4int + %88 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_count_trailing_zeros = OpFunction %v4int None %9 + %v = OpFunctionParameter %v4int + %14 = OpLabel + %x = OpVariable %_ptr_Function_v4uint Function %20 + %15 = OpBitcast %v4uint %v + OpStore %x %15 + %25 = OpLoad %v4uint %x + %28 = OpBitwiseAnd %v4uint %25 %27 + %22 = OpINotEqual %v4bool %28 %20 + %21 = OpSelect %v4uint %22 %20 %30 + %31 = OpLoad %v4uint %x + %32 = OpShiftRightLogical %v4uint %31 %21 + OpStore %x %32 + %35 = OpLoad %v4uint %x + %38 = OpBitwiseAnd %v4uint %35 %37 + %34 = OpINotEqual %v4bool %38 %20 + %33 = OpSelect %v4uint %34 %20 %40 + %41 = OpLoad %v4uint %x + %42 = OpShiftRightLogical %v4uint %41 %33 + OpStore %x %42 + %45 = OpLoad %v4uint %x + %48 = OpBitwiseAnd %v4uint %45 %47 + %44 = OpINotEqual %v4bool %48 %20 + %43 = OpSelect %v4uint %44 %20 %50 + %51 = OpLoad %v4uint %x + %52 = OpShiftRightLogical %v4uint %51 %43 + OpStore %x %52 + %55 = OpLoad %v4uint %x + %58 = OpBitwiseAnd %v4uint %55 %57 + %54 = OpINotEqual %v4bool %58 %20 + %53 = OpSelect %v4uint %54 %20 %60 + %61 = OpLoad %v4uint %x + %62 = OpShiftRightLogical %v4uint %61 %53 + OpStore %x %62 + %65 = OpLoad %v4uint %x + %68 = OpBitwiseAnd %v4uint %65 %67 + %64 = OpINotEqual %v4bool %68 %20 + %63 = OpSelect %v4uint %64 %20 %67 + %70 = OpLoad %v4uint %x + %71 = OpIEqual %v4bool %70 %20 + %69 = OpSelect %v4uint %71 %67 %20 + %73 = OpBitwiseOr %v4uint %21 %33 + %74 = OpBitwiseOr %v4uint %73 %43 + %75 = OpBitwiseOr %v4uint %74 %53 + %76 = OpBitwiseOr %v4uint %75 %63 + %77 = OpIAdd %v4uint %76 %69 + %72 = OpBitcast %v4int %77 + OpReturnValue %72 + OpFunctionEnd +%countTrailingZeros_1dc84a = OpFunction %void None %78 + %81 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4int Function %82 + %res = OpVariable %_ptr_Function_v4int Function %82 + OpStore %arg_0 %82 + %86 = OpLoad %v4int %arg_0 + %85 = OpFunctionCall %v4int %tint_count_trailing_zeros %86 + OpStore %res %85 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %88 + %90 = OpLabel + %91 = OpFunctionCall %void %countTrailingZeros_1dc84a + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %78 + %93 = OpLabel + %94 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %94 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %78 + %97 = OpLabel + %98 = OpFunctionCall %void %countTrailingZeros_1dc84a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %78 + %100 = OpLabel + %101 = OpFunctionCall %void %countTrailingZeros_1dc84a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/countTrailingZeros/1dc84a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countTrailingZeros/1dc84a.wgsl.expected.wgsl new file mode 100644 index 0000000000..e3d95b5ca0 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/1dc84a.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn countTrailingZeros_1dc84a() { + var arg_0 = vec4(); + var res : vec4 = countTrailingZeros(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + countTrailingZeros_1dc84a(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + countTrailingZeros_1dc84a(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + countTrailingZeros_1dc84a(); +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/21e394.wgsl b/test/tint/builtins/gen/var/countTrailingZeros/21e394.wgsl new file mode 100644 index 0000000000..925950071c --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/21e394.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countTrailingZeros(u32) -> u32 +fn countTrailingZeros_21e394() { + var arg_0 = 1u; + var res: u32 = countTrailingZeros(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + countTrailingZeros_21e394(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + countTrailingZeros_21e394(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + countTrailingZeros_21e394(); +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/21e394.wgsl.expected.glsl b/test/tint/builtins/gen/var/countTrailingZeros/21e394.wgsl.expected.glsl new file mode 100644 index 0000000000..8995ab5d14 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/21e394.wgsl.expected.glsl @@ -0,0 +1,97 @@ +#version 310 es + +uint tint_count_trailing_zeros(uint v) { + uint x = uint(v); + uint b16 = (bool((x & 65535u)) ? 0u : 16u); + x = (x >> b16); + uint b8 = (bool((x & 255u)) ? 0u : 8u); + x = (x >> b8); + uint b4 = (bool((x & 15u)) ? 0u : 4u); + x = (x >> b4); + uint b2 = (bool((x & 3u)) ? 0u : 2u); + x = (x >> b2); + uint b1 = (bool((x & 1u)) ? 0u : 1u); + uint is_zero = ((x == 0u) ? 1u : 0u); + return uint((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_21e394() { + uint arg_0 = 1u; + uint res = tint_count_trailing_zeros(arg_0); +} + +vec4 vertex_main() { + countTrailingZeros_21e394(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uint tint_count_trailing_zeros(uint v) { + uint x = uint(v); + uint b16 = (bool((x & 65535u)) ? 0u : 16u); + x = (x >> b16); + uint b8 = (bool((x & 255u)) ? 0u : 8u); + x = (x >> b8); + uint b4 = (bool((x & 15u)) ? 0u : 4u); + x = (x >> b4); + uint b2 = (bool((x & 3u)) ? 0u : 2u); + x = (x >> b2); + uint b1 = (bool((x & 1u)) ? 0u : 1u); + uint is_zero = ((x == 0u) ? 1u : 0u); + return uint((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_21e394() { + uint arg_0 = 1u; + uint res = tint_count_trailing_zeros(arg_0); +} + +void fragment_main() { + countTrailingZeros_21e394(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uint tint_count_trailing_zeros(uint v) { + uint x = uint(v); + uint b16 = (bool((x & 65535u)) ? 0u : 16u); + x = (x >> b16); + uint b8 = (bool((x & 255u)) ? 0u : 8u); + x = (x >> b8); + uint b4 = (bool((x & 15u)) ? 0u : 4u); + x = (x >> b4); + uint b2 = (bool((x & 3u)) ? 0u : 2u); + x = (x >> b2); + uint b1 = (bool((x & 1u)) ? 0u : 1u); + uint is_zero = ((x == 0u) ? 1u : 0u); + return uint((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_21e394() { + uint arg_0 = 1u; + uint res = tint_count_trailing_zeros(arg_0); +} + +void compute_main() { + countTrailingZeros_21e394(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/21e394.wgsl.expected.hlsl b/test/tint/builtins/gen/var/countTrailingZeros/21e394.wgsl.expected.hlsl new file mode 100644 index 0000000000..4581899842 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/21e394.wgsl.expected.hlsl @@ -0,0 +1,46 @@ +uint tint_count_trailing_zeros(uint v) { + uint x = uint(v); + const uint b16 = (bool((x & 65535u)) ? 0u : 16u); + x = (x >> b16); + const uint b8 = (bool((x & 255u)) ? 0u : 8u); + x = (x >> b8); + const uint b4 = (bool((x & 15u)) ? 0u : 4u); + x = (x >> b4); + const uint b2 = (bool((x & 3u)) ? 0u : 2u); + x = (x >> b2); + const uint b1 = (bool((x & 1u)) ? 0u : 1u); + const uint is_zero = ((x == 0u) ? 1u : 0u); + return uint((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_21e394() { + uint arg_0 = 1u; + uint res = tint_count_trailing_zeros(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countTrailingZeros_21e394(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countTrailingZeros_21e394(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countTrailingZeros_21e394(); + return; +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/21e394.wgsl.expected.msl b/test/tint/builtins/gen/var/countTrailingZeros/21e394.wgsl.expected.msl new file mode 100644 index 0000000000..6c9c98741a --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/21e394.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void countTrailingZeros_21e394() { + uint arg_0 = 1u; + uint res = ctz(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countTrailingZeros_21e394(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countTrailingZeros_21e394(); + return; +} + +kernel void compute_main() { + countTrailingZeros_21e394(); + return; +} + diff --git a/test/tint/builtins/gen/var/countTrailingZeros/21e394.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countTrailingZeros/21e394.wgsl.expected.spvasm new file mode 100644 index 0000000000..afa8fca93a --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/21e394.wgsl.expected.spvasm @@ -0,0 +1,131 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 87 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_count_trailing_zeros "tint_count_trailing_zeros" + OpName %v "v" + OpName %x "x" + OpName %countTrailingZeros_21e394 "countTrailingZeros_21e394" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %9 = OpTypeFunction %uint %uint +%_ptr_Function_uint = OpTypePointer Function %uint + %17 = OpConstantNull %uint + %bool = OpTypeBool + %uint_65535 = OpConstant %uint 65535 + %uint_16 = OpConstant %uint 16 + %uint_255 = OpConstant %uint 255 + %uint_8 = OpConstant %uint 8 + %uint_15 = OpConstant %uint 15 + %uint_4 = OpConstant %uint 4 + %uint_3 = OpConstant %uint 3 + %uint_2 = OpConstant %uint 2 + %uint_1 = OpConstant %uint 1 + %void = OpTypeVoid + %65 = OpTypeFunction %void + %73 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_count_trailing_zeros = OpFunction %uint None %9 + %v = OpFunctionParameter %uint + %13 = OpLabel + %x = OpVariable %_ptr_Function_uint Function %17 + OpStore %x %v + %21 = OpLoad %uint %x + %23 = OpBitwiseAnd %uint %21 %uint_65535 + %19 = OpINotEqual %bool %23 %17 + %18 = OpSelect %uint %19 %17 %uint_16 + %25 = OpLoad %uint %x + %26 = OpShiftRightLogical %uint %25 %18 + OpStore %x %26 + %29 = OpLoad %uint %x + %31 = OpBitwiseAnd %uint %29 %uint_255 + %28 = OpINotEqual %bool %31 %17 + %27 = OpSelect %uint %28 %17 %uint_8 + %33 = OpLoad %uint %x + %34 = OpShiftRightLogical %uint %33 %27 + OpStore %x %34 + %37 = OpLoad %uint %x + %39 = OpBitwiseAnd %uint %37 %uint_15 + %36 = OpINotEqual %bool %39 %17 + %35 = OpSelect %uint %36 %17 %uint_4 + %41 = OpLoad %uint %x + %42 = OpShiftRightLogical %uint %41 %35 + OpStore %x %42 + %45 = OpLoad %uint %x + %47 = OpBitwiseAnd %uint %45 %uint_3 + %44 = OpINotEqual %bool %47 %17 + %43 = OpSelect %uint %44 %17 %uint_2 + %49 = OpLoad %uint %x + %50 = OpShiftRightLogical %uint %49 %43 + OpStore %x %50 + %53 = OpLoad %uint %x + %55 = OpBitwiseAnd %uint %53 %uint_1 + %52 = OpINotEqual %bool %55 %17 + %51 = OpSelect %uint %52 %17 %uint_1 + %57 = OpLoad %uint %x + %58 = OpIEqual %bool %57 %17 + %56 = OpSelect %uint %58 %uint_1 %17 + %60 = OpBitwiseOr %uint %18 %27 + %61 = OpBitwiseOr %uint %60 %35 + %62 = OpBitwiseOr %uint %61 %43 + %63 = OpBitwiseOr %uint %62 %51 + %64 = OpIAdd %uint %63 %56 + OpReturnValue %64 + OpFunctionEnd +%countTrailingZeros_21e394 = OpFunction %void None %65 + %68 = OpLabel + %arg_0 = OpVariable %_ptr_Function_uint Function %17 + %res = OpVariable %_ptr_Function_uint Function %17 + OpStore %arg_0 %uint_1 + %71 = OpLoad %uint %arg_0 + %70 = OpFunctionCall %uint %tint_count_trailing_zeros %71 + OpStore %res %70 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %73 + %75 = OpLabel + %76 = OpFunctionCall %void %countTrailingZeros_21e394 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %65 + %78 = OpLabel + %79 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %79 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %65 + %82 = OpLabel + %83 = OpFunctionCall %void %countTrailingZeros_21e394 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %65 + %85 = OpLabel + %86 = OpFunctionCall %void %countTrailingZeros_21e394 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/countTrailingZeros/21e394.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countTrailingZeros/21e394.wgsl.expected.wgsl new file mode 100644 index 0000000000..3756bcfebe --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/21e394.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn countTrailingZeros_21e394() { + var arg_0 = 1u; + var res : u32 = countTrailingZeros(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + countTrailingZeros_21e394(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + countTrailingZeros_21e394(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + countTrailingZeros_21e394(); +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/327c37.wgsl b/test/tint/builtins/gen/var/countTrailingZeros/327c37.wgsl new file mode 100644 index 0000000000..f4a72e6406 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/327c37.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countTrailingZeros(vec<2, i32>) -> vec<2, i32> +fn countTrailingZeros_327c37() { + var arg_0 = vec2(); + var res: vec2 = countTrailingZeros(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + countTrailingZeros_327c37(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + countTrailingZeros_327c37(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + countTrailingZeros_327c37(); +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/327c37.wgsl.expected.glsl b/test/tint/builtins/gen/var/countTrailingZeros/327c37.wgsl.expected.glsl new file mode 100644 index 0000000000..192df0727d --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/327c37.wgsl.expected.glsl @@ -0,0 +1,97 @@ +#version 310 es + +ivec2 tint_count_trailing_zeros(ivec2 v) { + uvec2 x = uvec2(v); + uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u)))); + x = (x >> b16); + uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u)))); + x = (x >> b8); + uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u)))); + x = (x >> b4); + uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u)))); + x = (x >> b2); + uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u)))); + uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u))); + return ivec2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_327c37() { + ivec2 arg_0 = ivec2(0); + ivec2 res = tint_count_trailing_zeros(arg_0); +} + +vec4 vertex_main() { + countTrailingZeros_327c37(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +ivec2 tint_count_trailing_zeros(ivec2 v) { + uvec2 x = uvec2(v); + uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u)))); + x = (x >> b16); + uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u)))); + x = (x >> b8); + uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u)))); + x = (x >> b4); + uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u)))); + x = (x >> b2); + uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u)))); + uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u))); + return ivec2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_327c37() { + ivec2 arg_0 = ivec2(0); + ivec2 res = tint_count_trailing_zeros(arg_0); +} + +void fragment_main() { + countTrailingZeros_327c37(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +ivec2 tint_count_trailing_zeros(ivec2 v) { + uvec2 x = uvec2(v); + uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u)))); + x = (x >> b16); + uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u)))); + x = (x >> b8); + uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u)))); + x = (x >> b4); + uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u)))); + x = (x >> b2); + uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u)))); + uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u))); + return ivec2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_327c37() { + ivec2 arg_0 = ivec2(0); + ivec2 res = tint_count_trailing_zeros(arg_0); +} + +void compute_main() { + countTrailingZeros_327c37(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/327c37.wgsl.expected.hlsl b/test/tint/builtins/gen/var/countTrailingZeros/327c37.wgsl.expected.hlsl new file mode 100644 index 0000000000..2be49d7fd1 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/327c37.wgsl.expected.hlsl @@ -0,0 +1,46 @@ +int2 tint_count_trailing_zeros(int2 v) { + uint2 x = uint2(v); + const uint2 b16 = (bool2((x & (65535u).xx)) ? (0u).xx : (16u).xx); + x = (x >> b16); + const uint2 b8 = (bool2((x & (255u).xx)) ? (0u).xx : (8u).xx); + x = (x >> b8); + const uint2 b4 = (bool2((x & (15u).xx)) ? (0u).xx : (4u).xx); + x = (x >> b4); + const uint2 b2 = (bool2((x & (3u).xx)) ? (0u).xx : (2u).xx); + x = (x >> b2); + const uint2 b1 = (bool2((x & (1u).xx)) ? (0u).xx : (1u).xx); + const uint2 is_zero = ((x == (0u).xx) ? (1u).xx : (0u).xx); + return int2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_327c37() { + int2 arg_0 = (0).xx; + int2 res = tint_count_trailing_zeros(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countTrailingZeros_327c37(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countTrailingZeros_327c37(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countTrailingZeros_327c37(); + return; +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/327c37.wgsl.expected.msl b/test/tint/builtins/gen/var/countTrailingZeros/327c37.wgsl.expected.msl new file mode 100644 index 0000000000..c0a88c524a --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/327c37.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void countTrailingZeros_327c37() { + int2 arg_0 = int2(0); + int2 res = ctz(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countTrailingZeros_327c37(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countTrailingZeros_327c37(); + return; +} + +kernel void compute_main() { + countTrailingZeros_327c37(); + return; +} + diff --git a/test/tint/builtins/gen/var/countTrailingZeros/327c37.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countTrailingZeros/327c37.wgsl.expected.spvasm new file mode 100644 index 0000000000..8c108bdd48 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/327c37.wgsl.expected.spvasm @@ -0,0 +1,148 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 102 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_count_trailing_zeros "tint_count_trailing_zeros" + OpName %v "v" + OpName %x "x" + OpName %countTrailingZeros_327c37 "countTrailingZeros_327c37" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %9 = OpTypeFunction %v2int %v2int + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %20 = OpConstantNull %v2uint + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %uint_65535 = OpConstant %uint 65535 + %27 = OpConstantComposite %v2uint %uint_65535 %uint_65535 + %uint_16 = OpConstant %uint 16 + %30 = OpConstantComposite %v2uint %uint_16 %uint_16 + %uint_255 = OpConstant %uint 255 + %37 = OpConstantComposite %v2uint %uint_255 %uint_255 + %uint_8 = OpConstant %uint 8 + %40 = OpConstantComposite %v2uint %uint_8 %uint_8 + %uint_15 = OpConstant %uint 15 + %47 = OpConstantComposite %v2uint %uint_15 %uint_15 + %uint_4 = OpConstant %uint 4 + %50 = OpConstantComposite %v2uint %uint_4 %uint_4 + %uint_3 = OpConstant %uint 3 + %57 = OpConstantComposite %v2uint %uint_3 %uint_3 + %uint_2 = OpConstant %uint 2 + %60 = OpConstantComposite %v2uint %uint_2 %uint_2 + %uint_1 = OpConstant %uint 1 + %67 = OpConstantComposite %v2uint %uint_1 %uint_1 + %void = OpTypeVoid + %78 = OpTypeFunction %void + %82 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %88 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_count_trailing_zeros = OpFunction %v2int None %9 + %v = OpFunctionParameter %v2int + %14 = OpLabel + %x = OpVariable %_ptr_Function_v2uint Function %20 + %15 = OpBitcast %v2uint %v + OpStore %x %15 + %25 = OpLoad %v2uint %x + %28 = OpBitwiseAnd %v2uint %25 %27 + %22 = OpINotEqual %v2bool %28 %20 + %21 = OpSelect %v2uint %22 %20 %30 + %31 = OpLoad %v2uint %x + %32 = OpShiftRightLogical %v2uint %31 %21 + OpStore %x %32 + %35 = OpLoad %v2uint %x + %38 = OpBitwiseAnd %v2uint %35 %37 + %34 = OpINotEqual %v2bool %38 %20 + %33 = OpSelect %v2uint %34 %20 %40 + %41 = OpLoad %v2uint %x + %42 = OpShiftRightLogical %v2uint %41 %33 + OpStore %x %42 + %45 = OpLoad %v2uint %x + %48 = OpBitwiseAnd %v2uint %45 %47 + %44 = OpINotEqual %v2bool %48 %20 + %43 = OpSelect %v2uint %44 %20 %50 + %51 = OpLoad %v2uint %x + %52 = OpShiftRightLogical %v2uint %51 %43 + OpStore %x %52 + %55 = OpLoad %v2uint %x + %58 = OpBitwiseAnd %v2uint %55 %57 + %54 = OpINotEqual %v2bool %58 %20 + %53 = OpSelect %v2uint %54 %20 %60 + %61 = OpLoad %v2uint %x + %62 = OpShiftRightLogical %v2uint %61 %53 + OpStore %x %62 + %65 = OpLoad %v2uint %x + %68 = OpBitwiseAnd %v2uint %65 %67 + %64 = OpINotEqual %v2bool %68 %20 + %63 = OpSelect %v2uint %64 %20 %67 + %70 = OpLoad %v2uint %x + %71 = OpIEqual %v2bool %70 %20 + %69 = OpSelect %v2uint %71 %67 %20 + %73 = OpBitwiseOr %v2uint %21 %33 + %74 = OpBitwiseOr %v2uint %73 %43 + %75 = OpBitwiseOr %v2uint %74 %53 + %76 = OpBitwiseOr %v2uint %75 %63 + %77 = OpIAdd %v2uint %76 %69 + %72 = OpBitcast %v2int %77 + OpReturnValue %72 + OpFunctionEnd +%countTrailingZeros_327c37 = OpFunction %void None %78 + %81 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2int Function %82 + %res = OpVariable %_ptr_Function_v2int Function %82 + OpStore %arg_0 %82 + %86 = OpLoad %v2int %arg_0 + %85 = OpFunctionCall %v2int %tint_count_trailing_zeros %86 + OpStore %res %85 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %88 + %90 = OpLabel + %91 = OpFunctionCall %void %countTrailingZeros_327c37 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %78 + %93 = OpLabel + %94 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %94 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %78 + %97 = OpLabel + %98 = OpFunctionCall %void %countTrailingZeros_327c37 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %78 + %100 = OpLabel + %101 = OpFunctionCall %void %countTrailingZeros_327c37 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/countTrailingZeros/327c37.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countTrailingZeros/327c37.wgsl.expected.wgsl new file mode 100644 index 0000000000..f235ce1478 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/327c37.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn countTrailingZeros_327c37() { + var arg_0 = vec2(); + var res : vec2 = countTrailingZeros(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + countTrailingZeros_327c37(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + countTrailingZeros_327c37(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + countTrailingZeros_327c37(); +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/42fed6.wgsl b/test/tint/builtins/gen/var/countTrailingZeros/42fed6.wgsl new file mode 100644 index 0000000000..9d3a884954 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/42fed6.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countTrailingZeros(i32) -> i32 +fn countTrailingZeros_42fed6() { + var arg_0 = 1; + var res: i32 = countTrailingZeros(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + countTrailingZeros_42fed6(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + countTrailingZeros_42fed6(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + countTrailingZeros_42fed6(); +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/42fed6.wgsl.expected.glsl b/test/tint/builtins/gen/var/countTrailingZeros/42fed6.wgsl.expected.glsl new file mode 100644 index 0000000000..80ff533989 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/42fed6.wgsl.expected.glsl @@ -0,0 +1,97 @@ +#version 310 es + +int tint_count_trailing_zeros(int v) { + uint x = uint(v); + uint b16 = (bool((x & 65535u)) ? 0u : 16u); + x = (x >> b16); + uint b8 = (bool((x & 255u)) ? 0u : 8u); + x = (x >> b8); + uint b4 = (bool((x & 15u)) ? 0u : 4u); + x = (x >> b4); + uint b2 = (bool((x & 3u)) ? 0u : 2u); + x = (x >> b2); + uint b1 = (bool((x & 1u)) ? 0u : 1u); + uint is_zero = ((x == 0u) ? 1u : 0u); + return int((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_42fed6() { + int arg_0 = 1; + int res = tint_count_trailing_zeros(arg_0); +} + +vec4 vertex_main() { + countTrailingZeros_42fed6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +int tint_count_trailing_zeros(int v) { + uint x = uint(v); + uint b16 = (bool((x & 65535u)) ? 0u : 16u); + x = (x >> b16); + uint b8 = (bool((x & 255u)) ? 0u : 8u); + x = (x >> b8); + uint b4 = (bool((x & 15u)) ? 0u : 4u); + x = (x >> b4); + uint b2 = (bool((x & 3u)) ? 0u : 2u); + x = (x >> b2); + uint b1 = (bool((x & 1u)) ? 0u : 1u); + uint is_zero = ((x == 0u) ? 1u : 0u); + return int((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_42fed6() { + int arg_0 = 1; + int res = tint_count_trailing_zeros(arg_0); +} + +void fragment_main() { + countTrailingZeros_42fed6(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +int tint_count_trailing_zeros(int v) { + uint x = uint(v); + uint b16 = (bool((x & 65535u)) ? 0u : 16u); + x = (x >> b16); + uint b8 = (bool((x & 255u)) ? 0u : 8u); + x = (x >> b8); + uint b4 = (bool((x & 15u)) ? 0u : 4u); + x = (x >> b4); + uint b2 = (bool((x & 3u)) ? 0u : 2u); + x = (x >> b2); + uint b1 = (bool((x & 1u)) ? 0u : 1u); + uint is_zero = ((x == 0u) ? 1u : 0u); + return int((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_42fed6() { + int arg_0 = 1; + int res = tint_count_trailing_zeros(arg_0); +} + +void compute_main() { + countTrailingZeros_42fed6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/42fed6.wgsl.expected.hlsl b/test/tint/builtins/gen/var/countTrailingZeros/42fed6.wgsl.expected.hlsl new file mode 100644 index 0000000000..464986a871 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/42fed6.wgsl.expected.hlsl @@ -0,0 +1,46 @@ +int tint_count_trailing_zeros(int v) { + uint x = uint(v); + const uint b16 = (bool((x & 65535u)) ? 0u : 16u); + x = (x >> b16); + const uint b8 = (bool((x & 255u)) ? 0u : 8u); + x = (x >> b8); + const uint b4 = (bool((x & 15u)) ? 0u : 4u); + x = (x >> b4); + const uint b2 = (bool((x & 3u)) ? 0u : 2u); + x = (x >> b2); + const uint b1 = (bool((x & 1u)) ? 0u : 1u); + const uint is_zero = ((x == 0u) ? 1u : 0u); + return int((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_42fed6() { + int arg_0 = 1; + int res = tint_count_trailing_zeros(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countTrailingZeros_42fed6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countTrailingZeros_42fed6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countTrailingZeros_42fed6(); + return; +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/42fed6.wgsl.expected.msl b/test/tint/builtins/gen/var/countTrailingZeros/42fed6.wgsl.expected.msl new file mode 100644 index 0000000000..6811b6b83c --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/42fed6.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void countTrailingZeros_42fed6() { + int arg_0 = 1; + int res = ctz(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countTrailingZeros_42fed6(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countTrailingZeros_42fed6(); + return; +} + +kernel void compute_main() { + countTrailingZeros_42fed6(); + return; +} + diff --git a/test/tint/builtins/gen/var/countTrailingZeros/42fed6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countTrailingZeros/42fed6.wgsl.expected.spvasm new file mode 100644 index 0000000000..f727b4e248 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/42fed6.wgsl.expected.spvasm @@ -0,0 +1,137 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 91 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_count_trailing_zeros "tint_count_trailing_zeros" + OpName %v "v" + OpName %x "x" + OpName %countTrailingZeros_42fed6 "countTrailingZeros_42fed6" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %9 = OpTypeFunction %int %int + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %18 = OpConstantNull %uint + %bool = OpTypeBool + %uint_65535 = OpConstant %uint 65535 + %uint_16 = OpConstant %uint 16 + %uint_255 = OpConstant %uint 255 + %uint_8 = OpConstant %uint 8 + %uint_15 = OpConstant %uint 15 + %uint_4 = OpConstant %uint 4 + %uint_3 = OpConstant %uint 3 + %uint_2 = OpConstant %uint 2 + %uint_1 = OpConstant %uint 1 + %void = OpTypeVoid + %66 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %73 = OpConstantNull %int + %77 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_count_trailing_zeros = OpFunction %int None %9 + %v = OpFunctionParameter %int + %13 = OpLabel + %x = OpVariable %_ptr_Function_uint Function %18 + %14 = OpBitcast %uint %v + OpStore %x %14 + %22 = OpLoad %uint %x + %24 = OpBitwiseAnd %uint %22 %uint_65535 + %20 = OpINotEqual %bool %24 %18 + %19 = OpSelect %uint %20 %18 %uint_16 + %26 = OpLoad %uint %x + %27 = OpShiftRightLogical %uint %26 %19 + OpStore %x %27 + %30 = OpLoad %uint %x + %32 = OpBitwiseAnd %uint %30 %uint_255 + %29 = OpINotEqual %bool %32 %18 + %28 = OpSelect %uint %29 %18 %uint_8 + %34 = OpLoad %uint %x + %35 = OpShiftRightLogical %uint %34 %28 + OpStore %x %35 + %38 = OpLoad %uint %x + %40 = OpBitwiseAnd %uint %38 %uint_15 + %37 = OpINotEqual %bool %40 %18 + %36 = OpSelect %uint %37 %18 %uint_4 + %42 = OpLoad %uint %x + %43 = OpShiftRightLogical %uint %42 %36 + OpStore %x %43 + %46 = OpLoad %uint %x + %48 = OpBitwiseAnd %uint %46 %uint_3 + %45 = OpINotEqual %bool %48 %18 + %44 = OpSelect %uint %45 %18 %uint_2 + %50 = OpLoad %uint %x + %51 = OpShiftRightLogical %uint %50 %44 + OpStore %x %51 + %54 = OpLoad %uint %x + %56 = OpBitwiseAnd %uint %54 %uint_1 + %53 = OpINotEqual %bool %56 %18 + %52 = OpSelect %uint %53 %18 %uint_1 + %58 = OpLoad %uint %x + %59 = OpIEqual %bool %58 %18 + %57 = OpSelect %uint %59 %uint_1 %18 + %61 = OpBitwiseOr %uint %19 %28 + %62 = OpBitwiseOr %uint %61 %36 + %63 = OpBitwiseOr %uint %62 %44 + %64 = OpBitwiseOr %uint %63 %52 + %65 = OpIAdd %uint %64 %57 + %60 = OpBitcast %int %65 + OpReturnValue %60 + OpFunctionEnd +%countTrailingZeros_42fed6 = OpFunction %void None %66 + %69 = OpLabel + %arg_0 = OpVariable %_ptr_Function_int Function %73 + %res = OpVariable %_ptr_Function_int Function %73 + OpStore %arg_0 %int_1 + %75 = OpLoad %int %arg_0 + %74 = OpFunctionCall %int %tint_count_trailing_zeros %75 + OpStore %res %74 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %77 + %79 = OpLabel + %80 = OpFunctionCall %void %countTrailingZeros_42fed6 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %66 + %82 = OpLabel + %83 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %83 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %66 + %86 = OpLabel + %87 = OpFunctionCall %void %countTrailingZeros_42fed6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %66 + %89 = OpLabel + %90 = OpFunctionCall %void %countTrailingZeros_42fed6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/countTrailingZeros/42fed6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countTrailingZeros/42fed6.wgsl.expected.wgsl new file mode 100644 index 0000000000..536a7c09b6 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/42fed6.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn countTrailingZeros_42fed6() { + var arg_0 = 1; + var res : i32 = countTrailingZeros(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + countTrailingZeros_42fed6(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + countTrailingZeros_42fed6(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + countTrailingZeros_42fed6(); +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/8ed26f.wgsl b/test/tint/builtins/gen/var/countTrailingZeros/8ed26f.wgsl new file mode 100644 index 0000000000..e64b6a8448 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/8ed26f.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countTrailingZeros(vec<3, u32>) -> vec<3, u32> +fn countTrailingZeros_8ed26f() { + var arg_0 = vec3(); + var res: vec3 = countTrailingZeros(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + countTrailingZeros_8ed26f(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + countTrailingZeros_8ed26f(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + countTrailingZeros_8ed26f(); +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/8ed26f.wgsl.expected.glsl b/test/tint/builtins/gen/var/countTrailingZeros/8ed26f.wgsl.expected.glsl new file mode 100644 index 0000000000..84eee228ab --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/8ed26f.wgsl.expected.glsl @@ -0,0 +1,97 @@ +#version 310 es + +uvec3 tint_count_trailing_zeros(uvec3 v) { + uvec3 x = uvec3(v); + uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u)))); + x = (x >> b16); + uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u)))); + x = (x >> b8); + uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u)))); + x = (x >> b4); + uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u)))); + x = (x >> b2); + uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u)))); + uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u))); + return uvec3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_8ed26f() { + uvec3 arg_0 = uvec3(0u); + uvec3 res = tint_count_trailing_zeros(arg_0); +} + +vec4 vertex_main() { + countTrailingZeros_8ed26f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uvec3 tint_count_trailing_zeros(uvec3 v) { + uvec3 x = uvec3(v); + uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u)))); + x = (x >> b16); + uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u)))); + x = (x >> b8); + uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u)))); + x = (x >> b4); + uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u)))); + x = (x >> b2); + uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u)))); + uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u))); + return uvec3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_8ed26f() { + uvec3 arg_0 = uvec3(0u); + uvec3 res = tint_count_trailing_zeros(arg_0); +} + +void fragment_main() { + countTrailingZeros_8ed26f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uvec3 tint_count_trailing_zeros(uvec3 v) { + uvec3 x = uvec3(v); + uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u)))); + x = (x >> b16); + uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u)))); + x = (x >> b8); + uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u)))); + x = (x >> b4); + uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u)))); + x = (x >> b2); + uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u)))); + uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u))); + return uvec3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_8ed26f() { + uvec3 arg_0 = uvec3(0u); + uvec3 res = tint_count_trailing_zeros(arg_0); +} + +void compute_main() { + countTrailingZeros_8ed26f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/8ed26f.wgsl.expected.hlsl b/test/tint/builtins/gen/var/countTrailingZeros/8ed26f.wgsl.expected.hlsl new file mode 100644 index 0000000000..8f96543f78 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/8ed26f.wgsl.expected.hlsl @@ -0,0 +1,46 @@ +uint3 tint_count_trailing_zeros(uint3 v) { + uint3 x = uint3(v); + const uint3 b16 = (bool3((x & (65535u).xxx)) ? (0u).xxx : (16u).xxx); + x = (x >> b16); + const uint3 b8 = (bool3((x & (255u).xxx)) ? (0u).xxx : (8u).xxx); + x = (x >> b8); + const uint3 b4 = (bool3((x & (15u).xxx)) ? (0u).xxx : (4u).xxx); + x = (x >> b4); + const uint3 b2 = (bool3((x & (3u).xxx)) ? (0u).xxx : (2u).xxx); + x = (x >> b2); + const uint3 b1 = (bool3((x & (1u).xxx)) ? (0u).xxx : (1u).xxx); + const uint3 is_zero = ((x == (0u).xxx) ? (1u).xxx : (0u).xxx); + return uint3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_8ed26f() { + uint3 arg_0 = (0u).xxx; + uint3 res = tint_count_trailing_zeros(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countTrailingZeros_8ed26f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countTrailingZeros_8ed26f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countTrailingZeros_8ed26f(); + return; +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/8ed26f.wgsl.expected.msl b/test/tint/builtins/gen/var/countTrailingZeros/8ed26f.wgsl.expected.msl new file mode 100644 index 0000000000..04bd4b100c --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/8ed26f.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void countTrailingZeros_8ed26f() { + uint3 arg_0 = uint3(0u); + uint3 res = ctz(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countTrailingZeros_8ed26f(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countTrailingZeros_8ed26f(); + return; +} + +kernel void compute_main() { + countTrailingZeros_8ed26f(); + return; +} + diff --git a/test/tint/builtins/gen/var/countTrailingZeros/8ed26f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countTrailingZeros/8ed26f.wgsl.expected.spvasm new file mode 100644 index 0000000000..bc80f734d6 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/8ed26f.wgsl.expected.spvasm @@ -0,0 +1,142 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 98 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_count_trailing_zeros "tint_count_trailing_zeros" + OpName %v "v" + OpName %x "x" + OpName %countTrailingZeros_8ed26f "countTrailingZeros_8ed26f" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %9 = OpTypeFunction %v3uint %v3uint +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %18 = OpConstantNull %v3uint + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %uint_65535 = OpConstant %uint 65535 + %25 = OpConstantComposite %v3uint %uint_65535 %uint_65535 %uint_65535 + %uint_16 = OpConstant %uint 16 + %28 = OpConstantComposite %v3uint %uint_16 %uint_16 %uint_16 + %uint_255 = OpConstant %uint 255 + %35 = OpConstantComposite %v3uint %uint_255 %uint_255 %uint_255 + %uint_8 = OpConstant %uint 8 + %38 = OpConstantComposite %v3uint %uint_8 %uint_8 %uint_8 + %uint_15 = OpConstant %uint 15 + %45 = OpConstantComposite %v3uint %uint_15 %uint_15 %uint_15 + %uint_4 = OpConstant %uint 4 + %48 = OpConstantComposite %v3uint %uint_4 %uint_4 %uint_4 + %uint_3 = OpConstant %uint 3 + %55 = OpConstantComposite %v3uint %uint_3 %uint_3 %uint_3 + %uint_2 = OpConstant %uint 2 + %58 = OpConstantComposite %v3uint %uint_2 %uint_2 %uint_2 + %uint_1 = OpConstant %uint 1 + %65 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 + %void = OpTypeVoid + %76 = OpTypeFunction %void + %84 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_count_trailing_zeros = OpFunction %v3uint None %9 + %v = OpFunctionParameter %v3uint + %14 = OpLabel + %x = OpVariable %_ptr_Function_v3uint Function %18 + OpStore %x %v + %23 = OpLoad %v3uint %x + %26 = OpBitwiseAnd %v3uint %23 %25 + %20 = OpINotEqual %v3bool %26 %18 + %19 = OpSelect %v3uint %20 %18 %28 + %29 = OpLoad %v3uint %x + %30 = OpShiftRightLogical %v3uint %29 %19 + OpStore %x %30 + %33 = OpLoad %v3uint %x + %36 = OpBitwiseAnd %v3uint %33 %35 + %32 = OpINotEqual %v3bool %36 %18 + %31 = OpSelect %v3uint %32 %18 %38 + %39 = OpLoad %v3uint %x + %40 = OpShiftRightLogical %v3uint %39 %31 + OpStore %x %40 + %43 = OpLoad %v3uint %x + %46 = OpBitwiseAnd %v3uint %43 %45 + %42 = OpINotEqual %v3bool %46 %18 + %41 = OpSelect %v3uint %42 %18 %48 + %49 = OpLoad %v3uint %x + %50 = OpShiftRightLogical %v3uint %49 %41 + OpStore %x %50 + %53 = OpLoad %v3uint %x + %56 = OpBitwiseAnd %v3uint %53 %55 + %52 = OpINotEqual %v3bool %56 %18 + %51 = OpSelect %v3uint %52 %18 %58 + %59 = OpLoad %v3uint %x + %60 = OpShiftRightLogical %v3uint %59 %51 + OpStore %x %60 + %63 = OpLoad %v3uint %x + %66 = OpBitwiseAnd %v3uint %63 %65 + %62 = OpINotEqual %v3bool %66 %18 + %61 = OpSelect %v3uint %62 %18 %65 + %68 = OpLoad %v3uint %x + %69 = OpIEqual %v3bool %68 %18 + %67 = OpSelect %v3uint %69 %65 %18 + %71 = OpBitwiseOr %v3uint %19 %31 + %72 = OpBitwiseOr %v3uint %71 %41 + %73 = OpBitwiseOr %v3uint %72 %51 + %74 = OpBitwiseOr %v3uint %73 %61 + %75 = OpIAdd %v3uint %74 %67 + OpReturnValue %75 + OpFunctionEnd +%countTrailingZeros_8ed26f = OpFunction %void None %76 + %79 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3uint Function %18 + %res = OpVariable %_ptr_Function_v3uint Function %18 + OpStore %arg_0 %18 + %82 = OpLoad %v3uint %arg_0 + %81 = OpFunctionCall %v3uint %tint_count_trailing_zeros %82 + OpStore %res %81 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %84 + %86 = OpLabel + %87 = OpFunctionCall %void %countTrailingZeros_8ed26f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %76 + %89 = OpLabel + %90 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %90 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %76 + %93 = OpLabel + %94 = OpFunctionCall %void %countTrailingZeros_8ed26f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %76 + %96 = OpLabel + %97 = OpFunctionCall %void %countTrailingZeros_8ed26f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/countTrailingZeros/8ed26f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countTrailingZeros/8ed26f.wgsl.expected.wgsl new file mode 100644 index 0000000000..61986c1363 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/8ed26f.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn countTrailingZeros_8ed26f() { + var arg_0 = vec3(); + var res : vec3 = countTrailingZeros(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + countTrailingZeros_8ed26f(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + countTrailingZeros_8ed26f(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + countTrailingZeros_8ed26f(); +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/acfacb.wgsl b/test/tint/builtins/gen/var/countTrailingZeros/acfacb.wgsl new file mode 100644 index 0000000000..0da23deac8 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/acfacb.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countTrailingZeros(vec<3, i32>) -> vec<3, i32> +fn countTrailingZeros_acfacb() { + var arg_0 = vec3(); + var res: vec3 = countTrailingZeros(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + countTrailingZeros_acfacb(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + countTrailingZeros_acfacb(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + countTrailingZeros_acfacb(); +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/acfacb.wgsl.expected.glsl b/test/tint/builtins/gen/var/countTrailingZeros/acfacb.wgsl.expected.glsl new file mode 100644 index 0000000000..01d97fb727 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/acfacb.wgsl.expected.glsl @@ -0,0 +1,97 @@ +#version 310 es + +ivec3 tint_count_trailing_zeros(ivec3 v) { + uvec3 x = uvec3(v); + uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u)))); + x = (x >> b16); + uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u)))); + x = (x >> b8); + uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u)))); + x = (x >> b4); + uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u)))); + x = (x >> b2); + uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u)))); + uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u))); + return ivec3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_acfacb() { + ivec3 arg_0 = ivec3(0); + ivec3 res = tint_count_trailing_zeros(arg_0); +} + +vec4 vertex_main() { + countTrailingZeros_acfacb(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +ivec3 tint_count_trailing_zeros(ivec3 v) { + uvec3 x = uvec3(v); + uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u)))); + x = (x >> b16); + uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u)))); + x = (x >> b8); + uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u)))); + x = (x >> b4); + uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u)))); + x = (x >> b2); + uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u)))); + uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u))); + return ivec3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_acfacb() { + ivec3 arg_0 = ivec3(0); + ivec3 res = tint_count_trailing_zeros(arg_0); +} + +void fragment_main() { + countTrailingZeros_acfacb(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +ivec3 tint_count_trailing_zeros(ivec3 v) { + uvec3 x = uvec3(v); + uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u)))); + x = (x >> b16); + uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u)))); + x = (x >> b8); + uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u)))); + x = (x >> b4); + uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u)))); + x = (x >> b2); + uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u)))); + uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u))); + return ivec3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_acfacb() { + ivec3 arg_0 = ivec3(0); + ivec3 res = tint_count_trailing_zeros(arg_0); +} + +void compute_main() { + countTrailingZeros_acfacb(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/acfacb.wgsl.expected.hlsl b/test/tint/builtins/gen/var/countTrailingZeros/acfacb.wgsl.expected.hlsl new file mode 100644 index 0000000000..c3f8ccdb55 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/acfacb.wgsl.expected.hlsl @@ -0,0 +1,46 @@ +int3 tint_count_trailing_zeros(int3 v) { + uint3 x = uint3(v); + const uint3 b16 = (bool3((x & (65535u).xxx)) ? (0u).xxx : (16u).xxx); + x = (x >> b16); + const uint3 b8 = (bool3((x & (255u).xxx)) ? (0u).xxx : (8u).xxx); + x = (x >> b8); + const uint3 b4 = (bool3((x & (15u).xxx)) ? (0u).xxx : (4u).xxx); + x = (x >> b4); + const uint3 b2 = (bool3((x & (3u).xxx)) ? (0u).xxx : (2u).xxx); + x = (x >> b2); + const uint3 b1 = (bool3((x & (1u).xxx)) ? (0u).xxx : (1u).xxx); + const uint3 is_zero = ((x == (0u).xxx) ? (1u).xxx : (0u).xxx); + return int3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_acfacb() { + int3 arg_0 = (0).xxx; + int3 res = tint_count_trailing_zeros(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countTrailingZeros_acfacb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countTrailingZeros_acfacb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countTrailingZeros_acfacb(); + return; +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/acfacb.wgsl.expected.msl b/test/tint/builtins/gen/var/countTrailingZeros/acfacb.wgsl.expected.msl new file mode 100644 index 0000000000..53c17f485e --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/acfacb.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void countTrailingZeros_acfacb() { + int3 arg_0 = int3(0); + int3 res = ctz(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countTrailingZeros_acfacb(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countTrailingZeros_acfacb(); + return; +} + +kernel void compute_main() { + countTrailingZeros_acfacb(); + return; +} + diff --git a/test/tint/builtins/gen/var/countTrailingZeros/acfacb.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countTrailingZeros/acfacb.wgsl.expected.spvasm new file mode 100644 index 0000000000..b931079d15 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/acfacb.wgsl.expected.spvasm @@ -0,0 +1,148 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 102 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_count_trailing_zeros "tint_count_trailing_zeros" + OpName %v "v" + OpName %x "x" + OpName %countTrailingZeros_acfacb "countTrailingZeros_acfacb" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %9 = OpTypeFunction %v3int %v3int + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %20 = OpConstantNull %v3uint + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %uint_65535 = OpConstant %uint 65535 + %27 = OpConstantComposite %v3uint %uint_65535 %uint_65535 %uint_65535 + %uint_16 = OpConstant %uint 16 + %30 = OpConstantComposite %v3uint %uint_16 %uint_16 %uint_16 + %uint_255 = OpConstant %uint 255 + %37 = OpConstantComposite %v3uint %uint_255 %uint_255 %uint_255 + %uint_8 = OpConstant %uint 8 + %40 = OpConstantComposite %v3uint %uint_8 %uint_8 %uint_8 + %uint_15 = OpConstant %uint 15 + %47 = OpConstantComposite %v3uint %uint_15 %uint_15 %uint_15 + %uint_4 = OpConstant %uint 4 + %50 = OpConstantComposite %v3uint %uint_4 %uint_4 %uint_4 + %uint_3 = OpConstant %uint 3 + %57 = OpConstantComposite %v3uint %uint_3 %uint_3 %uint_3 + %uint_2 = OpConstant %uint 2 + %60 = OpConstantComposite %v3uint %uint_2 %uint_2 %uint_2 + %uint_1 = OpConstant %uint 1 + %67 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 + %void = OpTypeVoid + %78 = OpTypeFunction %void + %82 = OpConstantNull %v3int +%_ptr_Function_v3int = OpTypePointer Function %v3int + %88 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_count_trailing_zeros = OpFunction %v3int None %9 + %v = OpFunctionParameter %v3int + %14 = OpLabel + %x = OpVariable %_ptr_Function_v3uint Function %20 + %15 = OpBitcast %v3uint %v + OpStore %x %15 + %25 = OpLoad %v3uint %x + %28 = OpBitwiseAnd %v3uint %25 %27 + %22 = OpINotEqual %v3bool %28 %20 + %21 = OpSelect %v3uint %22 %20 %30 + %31 = OpLoad %v3uint %x + %32 = OpShiftRightLogical %v3uint %31 %21 + OpStore %x %32 + %35 = OpLoad %v3uint %x + %38 = OpBitwiseAnd %v3uint %35 %37 + %34 = OpINotEqual %v3bool %38 %20 + %33 = OpSelect %v3uint %34 %20 %40 + %41 = OpLoad %v3uint %x + %42 = OpShiftRightLogical %v3uint %41 %33 + OpStore %x %42 + %45 = OpLoad %v3uint %x + %48 = OpBitwiseAnd %v3uint %45 %47 + %44 = OpINotEqual %v3bool %48 %20 + %43 = OpSelect %v3uint %44 %20 %50 + %51 = OpLoad %v3uint %x + %52 = OpShiftRightLogical %v3uint %51 %43 + OpStore %x %52 + %55 = OpLoad %v3uint %x + %58 = OpBitwiseAnd %v3uint %55 %57 + %54 = OpINotEqual %v3bool %58 %20 + %53 = OpSelect %v3uint %54 %20 %60 + %61 = OpLoad %v3uint %x + %62 = OpShiftRightLogical %v3uint %61 %53 + OpStore %x %62 + %65 = OpLoad %v3uint %x + %68 = OpBitwiseAnd %v3uint %65 %67 + %64 = OpINotEqual %v3bool %68 %20 + %63 = OpSelect %v3uint %64 %20 %67 + %70 = OpLoad %v3uint %x + %71 = OpIEqual %v3bool %70 %20 + %69 = OpSelect %v3uint %71 %67 %20 + %73 = OpBitwiseOr %v3uint %21 %33 + %74 = OpBitwiseOr %v3uint %73 %43 + %75 = OpBitwiseOr %v3uint %74 %53 + %76 = OpBitwiseOr %v3uint %75 %63 + %77 = OpIAdd %v3uint %76 %69 + %72 = OpBitcast %v3int %77 + OpReturnValue %72 + OpFunctionEnd +%countTrailingZeros_acfacb = OpFunction %void None %78 + %81 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3int Function %82 + %res = OpVariable %_ptr_Function_v3int Function %82 + OpStore %arg_0 %82 + %86 = OpLoad %v3int %arg_0 + %85 = OpFunctionCall %v3int %tint_count_trailing_zeros %86 + OpStore %res %85 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %88 + %90 = OpLabel + %91 = OpFunctionCall %void %countTrailingZeros_acfacb + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %78 + %93 = OpLabel + %94 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %94 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %78 + %97 = OpLabel + %98 = OpFunctionCall %void %countTrailingZeros_acfacb + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %78 + %100 = OpLabel + %101 = OpFunctionCall %void %countTrailingZeros_acfacb + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/countTrailingZeros/acfacb.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countTrailingZeros/acfacb.wgsl.expected.wgsl new file mode 100644 index 0000000000..e93b279dc4 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/acfacb.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn countTrailingZeros_acfacb() { + var arg_0 = vec3(); + var res : vec3 = countTrailingZeros(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + countTrailingZeros_acfacb(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + countTrailingZeros_acfacb(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + countTrailingZeros_acfacb(); +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/d2b4a0.wgsl b/test/tint/builtins/gen/var/countTrailingZeros/d2b4a0.wgsl new file mode 100644 index 0000000000..b94c3b6708 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/d2b4a0.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countTrailingZeros(vec<4, u32>) -> vec<4, u32> +fn countTrailingZeros_d2b4a0() { + var arg_0 = vec4(); + var res: vec4 = countTrailingZeros(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + countTrailingZeros_d2b4a0(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + countTrailingZeros_d2b4a0(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + countTrailingZeros_d2b4a0(); +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/d2b4a0.wgsl.expected.glsl b/test/tint/builtins/gen/var/countTrailingZeros/d2b4a0.wgsl.expected.glsl new file mode 100644 index 0000000000..10c75b15d7 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/d2b4a0.wgsl.expected.glsl @@ -0,0 +1,97 @@ +#version 310 es + +uvec4 tint_count_trailing_zeros(uvec4 v) { + uvec4 x = uvec4(v); + uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u)))); + x = (x >> b16); + uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u)))); + x = (x >> b8); + uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u)))); + x = (x >> b4); + uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u)))); + x = (x >> b2); + uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u)))); + uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u))); + return uvec4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_d2b4a0() { + uvec4 arg_0 = uvec4(0u); + uvec4 res = tint_count_trailing_zeros(arg_0); +} + +vec4 vertex_main() { + countTrailingZeros_d2b4a0(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uvec4 tint_count_trailing_zeros(uvec4 v) { + uvec4 x = uvec4(v); + uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u)))); + x = (x >> b16); + uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u)))); + x = (x >> b8); + uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u)))); + x = (x >> b4); + uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u)))); + x = (x >> b2); + uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u)))); + uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u))); + return uvec4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_d2b4a0() { + uvec4 arg_0 = uvec4(0u); + uvec4 res = tint_count_trailing_zeros(arg_0); +} + +void fragment_main() { + countTrailingZeros_d2b4a0(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uvec4 tint_count_trailing_zeros(uvec4 v) { + uvec4 x = uvec4(v); + uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u)))); + x = (x >> b16); + uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u)))); + x = (x >> b8); + uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u)))); + x = (x >> b4); + uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u)))); + x = (x >> b2); + uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u)))); + uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u))); + return uvec4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_d2b4a0() { + uvec4 arg_0 = uvec4(0u); + uvec4 res = tint_count_trailing_zeros(arg_0); +} + +void compute_main() { + countTrailingZeros_d2b4a0(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/d2b4a0.wgsl.expected.hlsl b/test/tint/builtins/gen/var/countTrailingZeros/d2b4a0.wgsl.expected.hlsl new file mode 100644 index 0000000000..0c41a61fc0 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/d2b4a0.wgsl.expected.hlsl @@ -0,0 +1,46 @@ +uint4 tint_count_trailing_zeros(uint4 v) { + uint4 x = uint4(v); + const uint4 b16 = (bool4((x & (65535u).xxxx)) ? (0u).xxxx : (16u).xxxx); + x = (x >> b16); + const uint4 b8 = (bool4((x & (255u).xxxx)) ? (0u).xxxx : (8u).xxxx); + x = (x >> b8); + const uint4 b4 = (bool4((x & (15u).xxxx)) ? (0u).xxxx : (4u).xxxx); + x = (x >> b4); + const uint4 b2 = (bool4((x & (3u).xxxx)) ? (0u).xxxx : (2u).xxxx); + x = (x >> b2); + const uint4 b1 = (bool4((x & (1u).xxxx)) ? (0u).xxxx : (1u).xxxx); + const uint4 is_zero = ((x == (0u).xxxx) ? (1u).xxxx : (0u).xxxx); + return uint4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_d2b4a0() { + uint4 arg_0 = (0u).xxxx; + uint4 res = tint_count_trailing_zeros(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countTrailingZeros_d2b4a0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countTrailingZeros_d2b4a0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countTrailingZeros_d2b4a0(); + return; +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/d2b4a0.wgsl.expected.msl b/test/tint/builtins/gen/var/countTrailingZeros/d2b4a0.wgsl.expected.msl new file mode 100644 index 0000000000..9a23cef436 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/d2b4a0.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void countTrailingZeros_d2b4a0() { + uint4 arg_0 = uint4(0u); + uint4 res = ctz(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countTrailingZeros_d2b4a0(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countTrailingZeros_d2b4a0(); + return; +} + +kernel void compute_main() { + countTrailingZeros_d2b4a0(); + return; +} + diff --git a/test/tint/builtins/gen/var/countTrailingZeros/d2b4a0.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countTrailingZeros/d2b4a0.wgsl.expected.spvasm new file mode 100644 index 0000000000..ebce4b7db4 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/d2b4a0.wgsl.expected.spvasm @@ -0,0 +1,142 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 98 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_count_trailing_zeros "tint_count_trailing_zeros" + OpName %v "v" + OpName %x "x" + OpName %countTrailingZeros_d2b4a0 "countTrailingZeros_d2b4a0" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + %9 = OpTypeFunction %v4uint %v4uint +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %18 = OpConstantNull %v4uint + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %uint_65535 = OpConstant %uint 65535 + %25 = OpConstantComposite %v4uint %uint_65535 %uint_65535 %uint_65535 %uint_65535 + %uint_16 = OpConstant %uint 16 + %28 = OpConstantComposite %v4uint %uint_16 %uint_16 %uint_16 %uint_16 + %uint_255 = OpConstant %uint 255 + %35 = OpConstantComposite %v4uint %uint_255 %uint_255 %uint_255 %uint_255 + %uint_8 = OpConstant %uint 8 + %38 = OpConstantComposite %v4uint %uint_8 %uint_8 %uint_8 %uint_8 + %uint_15 = OpConstant %uint 15 + %45 = OpConstantComposite %v4uint %uint_15 %uint_15 %uint_15 %uint_15 + %uint_4 = OpConstant %uint 4 + %48 = OpConstantComposite %v4uint %uint_4 %uint_4 %uint_4 %uint_4 + %uint_3 = OpConstant %uint 3 + %55 = OpConstantComposite %v4uint %uint_3 %uint_3 %uint_3 %uint_3 + %uint_2 = OpConstant %uint 2 + %58 = OpConstantComposite %v4uint %uint_2 %uint_2 %uint_2 %uint_2 + %uint_1 = OpConstant %uint 1 + %65 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1 + %void = OpTypeVoid + %76 = OpTypeFunction %void + %84 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_count_trailing_zeros = OpFunction %v4uint None %9 + %v = OpFunctionParameter %v4uint + %14 = OpLabel + %x = OpVariable %_ptr_Function_v4uint Function %18 + OpStore %x %v + %23 = OpLoad %v4uint %x + %26 = OpBitwiseAnd %v4uint %23 %25 + %20 = OpINotEqual %v4bool %26 %18 + %19 = OpSelect %v4uint %20 %18 %28 + %29 = OpLoad %v4uint %x + %30 = OpShiftRightLogical %v4uint %29 %19 + OpStore %x %30 + %33 = OpLoad %v4uint %x + %36 = OpBitwiseAnd %v4uint %33 %35 + %32 = OpINotEqual %v4bool %36 %18 + %31 = OpSelect %v4uint %32 %18 %38 + %39 = OpLoad %v4uint %x + %40 = OpShiftRightLogical %v4uint %39 %31 + OpStore %x %40 + %43 = OpLoad %v4uint %x + %46 = OpBitwiseAnd %v4uint %43 %45 + %42 = OpINotEqual %v4bool %46 %18 + %41 = OpSelect %v4uint %42 %18 %48 + %49 = OpLoad %v4uint %x + %50 = OpShiftRightLogical %v4uint %49 %41 + OpStore %x %50 + %53 = OpLoad %v4uint %x + %56 = OpBitwiseAnd %v4uint %53 %55 + %52 = OpINotEqual %v4bool %56 %18 + %51 = OpSelect %v4uint %52 %18 %58 + %59 = OpLoad %v4uint %x + %60 = OpShiftRightLogical %v4uint %59 %51 + OpStore %x %60 + %63 = OpLoad %v4uint %x + %66 = OpBitwiseAnd %v4uint %63 %65 + %62 = OpINotEqual %v4bool %66 %18 + %61 = OpSelect %v4uint %62 %18 %65 + %68 = OpLoad %v4uint %x + %69 = OpIEqual %v4bool %68 %18 + %67 = OpSelect %v4uint %69 %65 %18 + %71 = OpBitwiseOr %v4uint %19 %31 + %72 = OpBitwiseOr %v4uint %71 %41 + %73 = OpBitwiseOr %v4uint %72 %51 + %74 = OpBitwiseOr %v4uint %73 %61 + %75 = OpIAdd %v4uint %74 %67 + OpReturnValue %75 + OpFunctionEnd +%countTrailingZeros_d2b4a0 = OpFunction %void None %76 + %79 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4uint Function %18 + %res = OpVariable %_ptr_Function_v4uint Function %18 + OpStore %arg_0 %18 + %82 = OpLoad %v4uint %arg_0 + %81 = OpFunctionCall %v4uint %tint_count_trailing_zeros %82 + OpStore %res %81 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %84 + %86 = OpLabel + %87 = OpFunctionCall %void %countTrailingZeros_d2b4a0 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %76 + %89 = OpLabel + %90 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %90 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %76 + %93 = OpLabel + %94 = OpFunctionCall %void %countTrailingZeros_d2b4a0 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %76 + %96 = OpLabel + %97 = OpFunctionCall %void %countTrailingZeros_d2b4a0 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/countTrailingZeros/d2b4a0.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countTrailingZeros/d2b4a0.wgsl.expected.wgsl new file mode 100644 index 0000000000..8f10ca0cca --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/d2b4a0.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn countTrailingZeros_d2b4a0() { + var arg_0 = vec4(); + var res : vec4 = countTrailingZeros(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + countTrailingZeros_d2b4a0(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + countTrailingZeros_d2b4a0(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + countTrailingZeros_d2b4a0(); +} diff --git a/test/tint/builtins/gen/var/cross/041cb0.wgsl b/test/tint/builtins/gen/var/cross/041cb0.wgsl new file mode 100644 index 0000000000..6bcfcba2c3 --- /dev/null +++ b/test/tint/builtins/gen/var/cross/041cb0.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn cross(vec3, vec3) -> vec3 +fn cross_041cb0() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var res: vec3 = cross(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + cross_041cb0(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + cross_041cb0(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + cross_041cb0(); +} diff --git a/test/tint/builtins/gen/var/cross/041cb0.wgsl.expected.glsl b/test/tint/builtins/gen/var/cross/041cb0.wgsl.expected.glsl new file mode 100644 index 0000000000..87cb9a34c0 --- /dev/null +++ b/test/tint/builtins/gen/var/cross/041cb0.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void cross_041cb0() { + vec3 arg_0 = vec3(0.0f); + vec3 arg_1 = vec3(0.0f); + vec3 res = cross(arg_0, arg_1); +} + +vec4 vertex_main() { + cross_041cb0(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void cross_041cb0() { + vec3 arg_0 = vec3(0.0f); + vec3 arg_1 = vec3(0.0f); + vec3 res = cross(arg_0, arg_1); +} + +void fragment_main() { + cross_041cb0(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void cross_041cb0() { + vec3 arg_0 = vec3(0.0f); + vec3 arg_1 = vec3(0.0f); + vec3 res = cross(arg_0, arg_1); +} + +void compute_main() { + cross_041cb0(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/cross/041cb0.wgsl.expected.hlsl b/test/tint/builtins/gen/var/cross/041cb0.wgsl.expected.hlsl new file mode 100644 index 0000000000..272645fb5f --- /dev/null +++ b/test/tint/builtins/gen/var/cross/041cb0.wgsl.expected.hlsl @@ -0,0 +1,32 @@ +void cross_041cb0() { + float3 arg_0 = (0.0f).xxx; + float3 arg_1 = (0.0f).xxx; + float3 res = cross(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cross_041cb0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cross_041cb0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cross_041cb0(); + return; +} diff --git a/test/tint/builtins/gen/var/cross/041cb0.wgsl.expected.msl b/test/tint/builtins/gen/var/cross/041cb0.wgsl.expected.msl new file mode 100644 index 0000000000..49669392b1 --- /dev/null +++ b/test/tint/builtins/gen/var/cross/041cb0.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void cross_041cb0() { + float3 arg_0 = float3(0.0f); + float3 arg_1 = float3(0.0f); + float3 res = cross(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cross_041cb0(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cross_041cb0(); + return; +} + +kernel void compute_main() { + cross_041cb0(); + return; +} + diff --git a/test/tint/builtins/gen/var/cross/041cb0.wgsl.expected.spvasm b/test/tint/builtins/gen/var/cross/041cb0.wgsl.expected.spvasm new file mode 100644 index 0000000000..f7a1245ca7 --- /dev/null +++ b/test/tint/builtins/gen/var/cross/041cb0.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cross_041cb0 "cross_041cb0" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %14 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%cross_041cb0 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %14 + %arg_1 = OpVariable %_ptr_Function_v3float Function %14 + %res = OpVariable %_ptr_Function_v3float Function %14 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + %20 = OpLoad %v3float %arg_0 + %21 = OpLoad %v3float %arg_1 + %18 = OpExtInst %v3float %19 Cross %20 %21 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %cross_041cb0 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %cross_041cb0 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %cross_041cb0 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/cross/041cb0.wgsl.expected.wgsl b/test/tint/builtins/gen/var/cross/041cb0.wgsl.expected.wgsl new file mode 100644 index 0000000000..9789b3709f --- /dev/null +++ b/test/tint/builtins/gen/var/cross/041cb0.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn cross_041cb0() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var res : vec3 = cross(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + cross_041cb0(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + cross_041cb0(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + cross_041cb0(); +} diff --git a/test/tint/builtins/gen/var/degrees/0d170c.wgsl b/test/tint/builtins/gen/var/degrees/0d170c.wgsl new file mode 100644 index 0000000000..ca3ab637c6 --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/0d170c.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn degrees(vec<4, f32>) -> vec<4, f32> +fn degrees_0d170c() { + var arg_0 = vec4(); + var res: vec4 = degrees(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + degrees_0d170c(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + degrees_0d170c(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + degrees_0d170c(); +} diff --git a/test/tint/builtins/gen/var/degrees/0d170c.wgsl.expected.glsl b/test/tint/builtins/gen/var/degrees/0d170c.wgsl.expected.glsl new file mode 100644 index 0000000000..7050d431cc --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/0d170c.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es + +vec4 tint_degrees(vec4 param_0) { + return param_0 * 57.295779513082322865; +} + + +void degrees_0d170c() { + vec4 arg_0 = vec4(0.0f); + vec4 res = tint_degrees(arg_0); +} + +vec4 vertex_main() { + degrees_0d170c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +vec4 tint_degrees(vec4 param_0) { + return param_0 * 57.295779513082322865; +} + + +void degrees_0d170c() { + vec4 arg_0 = vec4(0.0f); + vec4 res = tint_degrees(arg_0); +} + +void fragment_main() { + degrees_0d170c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +vec4 tint_degrees(vec4 param_0) { + return param_0 * 57.295779513082322865; +} + + +void degrees_0d170c() { + vec4 arg_0 = vec4(0.0f); + vec4 res = tint_degrees(arg_0); +} + +void compute_main() { + degrees_0d170c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/degrees/0d170c.wgsl.expected.hlsl b/test/tint/builtins/gen/var/degrees/0d170c.wgsl.expected.hlsl new file mode 100644 index 0000000000..707abe1468 --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/0d170c.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +float4 tint_degrees(float4 param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_0d170c() { + float4 arg_0 = (0.0f).xxxx; + float4 res = tint_degrees(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + degrees_0d170c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + degrees_0d170c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + degrees_0d170c(); + return; +} diff --git a/test/tint/builtins/gen/var/degrees/0d170c.wgsl.expected.msl b/test/tint/builtins/gen/var/degrees/0d170c.wgsl.expected.msl new file mode 100644 index 0000000000..7f80ac70eb --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/0d170c.wgsl.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; + +float4 tint_degrees(float4 param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_0d170c() { + float4 arg_0 = float4(0.0f); + float4 res = tint_degrees(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + degrees_0d170c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + degrees_0d170c(); + return; +} + +kernel void compute_main() { + degrees_0d170c(); + return; +} + diff --git a/test/tint/builtins/gen/var/degrees/0d170c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/degrees/0d170c.wgsl.expected.spvasm new file mode 100644 index 0000000000..b0850ee290 --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/0d170c.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %degrees_0d170c "degrees_0d170c" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%degrees_0d170c = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %5 + %17 = OpLoad %v4float %arg_0 + %15 = OpExtInst %v4float %16 Degrees %17 + OpStore %res %15 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %degrees_0d170c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %degrees_0d170c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %degrees_0d170c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/degrees/0d170c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/degrees/0d170c.wgsl.expected.wgsl new file mode 100644 index 0000000000..921b7ef57b --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/0d170c.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn degrees_0d170c() { + var arg_0 = vec4(); + var res : vec4 = degrees(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + degrees_0d170c(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + degrees_0d170c(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + degrees_0d170c(); +} diff --git a/test/tint/builtins/gen/var/degrees/1ad5df.wgsl b/test/tint/builtins/gen/var/degrees/1ad5df.wgsl new file mode 100644 index 0000000000..7b72b4526d --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/1ad5df.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn degrees(vec<2, f32>) -> vec<2, f32> +fn degrees_1ad5df() { + var arg_0 = vec2(); + var res: vec2 = degrees(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + degrees_1ad5df(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + degrees_1ad5df(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + degrees_1ad5df(); +} diff --git a/test/tint/builtins/gen/var/degrees/1ad5df.wgsl.expected.glsl b/test/tint/builtins/gen/var/degrees/1ad5df.wgsl.expected.glsl new file mode 100644 index 0000000000..303eb31dfa --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/1ad5df.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es + +vec2 tint_degrees(vec2 param_0) { + return param_0 * 57.295779513082322865; +} + + +void degrees_1ad5df() { + vec2 arg_0 = vec2(0.0f); + vec2 res = tint_degrees(arg_0); +} + +vec4 vertex_main() { + degrees_1ad5df(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +vec2 tint_degrees(vec2 param_0) { + return param_0 * 57.295779513082322865; +} + + +void degrees_1ad5df() { + vec2 arg_0 = vec2(0.0f); + vec2 res = tint_degrees(arg_0); +} + +void fragment_main() { + degrees_1ad5df(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +vec2 tint_degrees(vec2 param_0) { + return param_0 * 57.295779513082322865; +} + + +void degrees_1ad5df() { + vec2 arg_0 = vec2(0.0f); + vec2 res = tint_degrees(arg_0); +} + +void compute_main() { + degrees_1ad5df(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/degrees/1ad5df.wgsl.expected.hlsl b/test/tint/builtins/gen/var/degrees/1ad5df.wgsl.expected.hlsl new file mode 100644 index 0000000000..c2b98c5165 --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/1ad5df.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +float2 tint_degrees(float2 param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_1ad5df() { + float2 arg_0 = (0.0f).xx; + float2 res = tint_degrees(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + degrees_1ad5df(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + degrees_1ad5df(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + degrees_1ad5df(); + return; +} diff --git a/test/tint/builtins/gen/var/degrees/1ad5df.wgsl.expected.msl b/test/tint/builtins/gen/var/degrees/1ad5df.wgsl.expected.msl new file mode 100644 index 0000000000..e53ab1e233 --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/1ad5df.wgsl.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; + +float2 tint_degrees(float2 param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_1ad5df() { + float2 arg_0 = float2(0.0f); + float2 res = tint_degrees(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + degrees_1ad5df(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + degrees_1ad5df(); + return; +} + +kernel void compute_main() { + degrees_1ad5df(); + return; +} + diff --git a/test/tint/builtins/gen/var/degrees/1ad5df.wgsl.expected.spvasm b/test/tint/builtins/gen/var/degrees/1ad5df.wgsl.expected.spvasm new file mode 100644 index 0000000000..84f8a46746 --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/1ad5df.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %degrees_1ad5df "degrees_1ad5df" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %14 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%degrees_1ad5df = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %14 + %res = OpVariable %_ptr_Function_v2float Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %v2float %arg_0 + %17 = OpExtInst %v2float %18 Degrees %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %degrees_1ad5df + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %degrees_1ad5df + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %degrees_1ad5df + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/degrees/1ad5df.wgsl.expected.wgsl b/test/tint/builtins/gen/var/degrees/1ad5df.wgsl.expected.wgsl new file mode 100644 index 0000000000..bcec4b0543 --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/1ad5df.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn degrees_1ad5df() { + var arg_0 = vec2(); + var res : vec2 = degrees(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + degrees_1ad5df(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + degrees_1ad5df(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + degrees_1ad5df(); +} diff --git a/test/tint/builtins/gen/var/degrees/2af623.wgsl b/test/tint/builtins/gen/var/degrees/2af623.wgsl new file mode 100644 index 0000000000..2aa8c72268 --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/2af623.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn degrees(vec<3, f32>) -> vec<3, f32> +fn degrees_2af623() { + var arg_0 = vec3(); + var res: vec3 = degrees(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + degrees_2af623(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + degrees_2af623(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + degrees_2af623(); +} diff --git a/test/tint/builtins/gen/var/degrees/2af623.wgsl.expected.glsl b/test/tint/builtins/gen/var/degrees/2af623.wgsl.expected.glsl new file mode 100644 index 0000000000..e8ac3a76f3 --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/2af623.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es + +vec3 tint_degrees(vec3 param_0) { + return param_0 * 57.295779513082322865; +} + + +void degrees_2af623() { + vec3 arg_0 = vec3(0.0f); + vec3 res = tint_degrees(arg_0); +} + +vec4 vertex_main() { + degrees_2af623(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +vec3 tint_degrees(vec3 param_0) { + return param_0 * 57.295779513082322865; +} + + +void degrees_2af623() { + vec3 arg_0 = vec3(0.0f); + vec3 res = tint_degrees(arg_0); +} + +void fragment_main() { + degrees_2af623(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +vec3 tint_degrees(vec3 param_0) { + return param_0 * 57.295779513082322865; +} + + +void degrees_2af623() { + vec3 arg_0 = vec3(0.0f); + vec3 res = tint_degrees(arg_0); +} + +void compute_main() { + degrees_2af623(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/degrees/2af623.wgsl.expected.hlsl b/test/tint/builtins/gen/var/degrees/2af623.wgsl.expected.hlsl new file mode 100644 index 0000000000..acc4754c4f --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/2af623.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +float3 tint_degrees(float3 param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_2af623() { + float3 arg_0 = (0.0f).xxx; + float3 res = tint_degrees(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + degrees_2af623(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + degrees_2af623(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + degrees_2af623(); + return; +} diff --git a/test/tint/builtins/gen/var/degrees/2af623.wgsl.expected.msl b/test/tint/builtins/gen/var/degrees/2af623.wgsl.expected.msl new file mode 100644 index 0000000000..122c1a1cf1 --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/2af623.wgsl.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; + +float3 tint_degrees(float3 param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_2af623() { + float3 arg_0 = float3(0.0f); + float3 res = tint_degrees(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + degrees_2af623(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + degrees_2af623(); + return; +} + +kernel void compute_main() { + degrees_2af623(); + return; +} + diff --git a/test/tint/builtins/gen/var/degrees/2af623.wgsl.expected.spvasm b/test/tint/builtins/gen/var/degrees/2af623.wgsl.expected.spvasm new file mode 100644 index 0000000000..68c45febba --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/2af623.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %degrees_2af623 "degrees_2af623" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %14 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%degrees_2af623 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %14 + %res = OpVariable %_ptr_Function_v3float Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %v3float %arg_0 + %17 = OpExtInst %v3float %18 Degrees %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %degrees_2af623 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %degrees_2af623 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %degrees_2af623 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/degrees/2af623.wgsl.expected.wgsl b/test/tint/builtins/gen/var/degrees/2af623.wgsl.expected.wgsl new file mode 100644 index 0000000000..1406f3237f --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/2af623.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn degrees_2af623() { + var arg_0 = vec3(); + var res : vec3 = degrees(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + degrees_2af623(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + degrees_2af623(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + degrees_2af623(); +} diff --git a/test/tint/builtins/gen/var/degrees/51f705.wgsl b/test/tint/builtins/gen/var/degrees/51f705.wgsl new file mode 100644 index 0000000000..35c111d1f7 --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/51f705.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn degrees(f32) -> f32 +fn degrees_51f705() { + var arg_0 = 1.0; + var res: f32 = degrees(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + degrees_51f705(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + degrees_51f705(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + degrees_51f705(); +} diff --git a/test/tint/builtins/gen/var/degrees/51f705.wgsl.expected.glsl b/test/tint/builtins/gen/var/degrees/51f705.wgsl.expected.glsl new file mode 100644 index 0000000000..24816052bb --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/51f705.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es + +float tint_degrees(float param_0) { + return param_0 * 57.295779513082322865; +} + + +void degrees_51f705() { + float arg_0 = 1.0f; + float res = tint_degrees(arg_0); +} + +vec4 vertex_main() { + degrees_51f705(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +float tint_degrees(float param_0) { + return param_0 * 57.295779513082322865; +} + + +void degrees_51f705() { + float arg_0 = 1.0f; + float res = tint_degrees(arg_0); +} + +void fragment_main() { + degrees_51f705(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +float tint_degrees(float param_0) { + return param_0 * 57.295779513082322865; +} + + +void degrees_51f705() { + float arg_0 = 1.0f; + float res = tint_degrees(arg_0); +} + +void compute_main() { + degrees_51f705(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/degrees/51f705.wgsl.expected.hlsl b/test/tint/builtins/gen/var/degrees/51f705.wgsl.expected.hlsl new file mode 100644 index 0000000000..98215142de --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/51f705.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +float tint_degrees(float param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_51f705() { + float arg_0 = 1.0f; + float res = tint_degrees(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + degrees_51f705(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + degrees_51f705(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + degrees_51f705(); + return; +} diff --git a/test/tint/builtins/gen/var/degrees/51f705.wgsl.expected.msl b/test/tint/builtins/gen/var/degrees/51f705.wgsl.expected.msl new file mode 100644 index 0000000000..4feaad036b --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/51f705.wgsl.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; + +float tint_degrees(float param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_51f705() { + float arg_0 = 1.0f; + float res = tint_degrees(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + degrees_51f705(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + degrees_51f705(); + return; +} + +kernel void compute_main() { + degrees_51f705(); + return; +} + diff --git a/test/tint/builtins/gen/var/degrees/51f705.wgsl.expected.spvasm b/test/tint/builtins/gen/var/degrees/51f705.wgsl.expected.spvasm new file mode 100644 index 0000000000..10bc58e43d --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/51f705.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %degrees_51f705 "degrees_51f705" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %20 = OpTypeFunction %v4float +%degrees_51f705 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + %18 = OpLoad %float %arg_0 + %16 = OpExtInst %float %17 Degrees %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %degrees_51f705 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %degrees_51f705 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %degrees_51f705 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/degrees/51f705.wgsl.expected.wgsl b/test/tint/builtins/gen/var/degrees/51f705.wgsl.expected.wgsl new file mode 100644 index 0000000000..de2a96d2d8 --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/51f705.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn degrees_51f705() { + var arg_0 = 1.0; + var res : f32 = degrees(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + degrees_51f705(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + degrees_51f705(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + degrees_51f705(); +} diff --git a/test/tint/builtins/gen/var/determinant/2b62ba.wgsl b/test/tint/builtins/gen/var/determinant/2b62ba.wgsl new file mode 100644 index 0000000000..0a0a423227 --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/2b62ba.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn determinant(mat<3, 3, f32>) -> f32 +fn determinant_2b62ba() { + var arg_0 = mat3x3(); + var res: f32 = determinant(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + determinant_2b62ba(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + determinant_2b62ba(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + determinant_2b62ba(); +} diff --git a/test/tint/builtins/gen/var/determinant/2b62ba.wgsl.expected.glsl b/test/tint/builtins/gen/var/determinant/2b62ba.wgsl.expected.glsl new file mode 100644 index 0000000000..97b89e5975 --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/2b62ba.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void determinant_2b62ba() { + mat3 arg_0 = mat3(vec3(0.0f), vec3(0.0f), vec3(0.0f)); + float res = determinant(arg_0); +} + +vec4 vertex_main() { + determinant_2b62ba(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void determinant_2b62ba() { + mat3 arg_0 = mat3(vec3(0.0f), vec3(0.0f), vec3(0.0f)); + float res = determinant(arg_0); +} + +void fragment_main() { + determinant_2b62ba(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void determinant_2b62ba() { + mat3 arg_0 = mat3(vec3(0.0f), vec3(0.0f), vec3(0.0f)); + float res = determinant(arg_0); +} + +void compute_main() { + determinant_2b62ba(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/determinant/2b62ba.wgsl.expected.hlsl b/test/tint/builtins/gen/var/determinant/2b62ba.wgsl.expected.hlsl new file mode 100644 index 0000000000..273a3f71aa --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/2b62ba.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void determinant_2b62ba() { + float3x3 arg_0 = float3x3((0.0f).xxx, (0.0f).xxx, (0.0f).xxx); + float res = determinant(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + determinant_2b62ba(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + determinant_2b62ba(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + determinant_2b62ba(); + return; +} diff --git a/test/tint/builtins/gen/var/determinant/2b62ba.wgsl.expected.msl b/test/tint/builtins/gen/var/determinant/2b62ba.wgsl.expected.msl new file mode 100644 index 0000000000..e57373d27b --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/2b62ba.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void determinant_2b62ba() { + float3x3 arg_0 = float3x3(float3(0.0f), float3(0.0f), float3(0.0f)); + float res = determinant(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + determinant_2b62ba(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + determinant_2b62ba(); + return; +} + +kernel void compute_main() { + determinant_2b62ba(); + return; +} + diff --git a/test/tint/builtins/gen/var/determinant/2b62ba.wgsl.expected.spvasm b/test/tint/builtins/gen/var/determinant/2b62ba.wgsl.expected.spvasm new file mode 100644 index 0000000000..cdf2d43147 --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/2b62ba.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %determinant_2b62ba "determinant_2b62ba" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 +%mat3v3float = OpTypeMatrix %v3float 3 + %15 = OpConstantNull %mat3v3float +%_ptr_Function_mat3v3float = OpTypePointer Function %mat3v3float +%_ptr_Function_float = OpTypePointer Function %float + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%determinant_2b62ba = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_mat3v3float Function %15 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %15 + %20 = OpLoad %mat3v3float %arg_0 + %18 = OpExtInst %float %19 Determinant %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %determinant_2b62ba + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %determinant_2b62ba + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %determinant_2b62ba + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/determinant/2b62ba.wgsl.expected.wgsl b/test/tint/builtins/gen/var/determinant/2b62ba.wgsl.expected.wgsl new file mode 100644 index 0000000000..8ac8f81a4f --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/2b62ba.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn determinant_2b62ba() { + var arg_0 = mat3x3(); + var res : f32 = determinant(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + determinant_2b62ba(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + determinant_2b62ba(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + determinant_2b62ba(); +} diff --git a/test/tint/builtins/gen/var/determinant/a0a87c.wgsl b/test/tint/builtins/gen/var/determinant/a0a87c.wgsl new file mode 100644 index 0000000000..ff3c06713d --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/a0a87c.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn determinant(mat<4, 4, f32>) -> f32 +fn determinant_a0a87c() { + var arg_0 = mat4x4(); + var res: f32 = determinant(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + determinant_a0a87c(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + determinant_a0a87c(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + determinant_a0a87c(); +} diff --git a/test/tint/builtins/gen/var/determinant/a0a87c.wgsl.expected.glsl b/test/tint/builtins/gen/var/determinant/a0a87c.wgsl.expected.glsl new file mode 100644 index 0000000000..e3848a22cb --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/a0a87c.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void determinant_a0a87c() { + mat4 arg_0 = mat4(vec4(0.0f), vec4(0.0f), vec4(0.0f), vec4(0.0f)); + float res = determinant(arg_0); +} + +vec4 vertex_main() { + determinant_a0a87c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void determinant_a0a87c() { + mat4 arg_0 = mat4(vec4(0.0f), vec4(0.0f), vec4(0.0f), vec4(0.0f)); + float res = determinant(arg_0); +} + +void fragment_main() { + determinant_a0a87c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void determinant_a0a87c() { + mat4 arg_0 = mat4(vec4(0.0f), vec4(0.0f), vec4(0.0f), vec4(0.0f)); + float res = determinant(arg_0); +} + +void compute_main() { + determinant_a0a87c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/determinant/a0a87c.wgsl.expected.hlsl b/test/tint/builtins/gen/var/determinant/a0a87c.wgsl.expected.hlsl new file mode 100644 index 0000000000..48842502fd --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/a0a87c.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void determinant_a0a87c() { + float4x4 arg_0 = float4x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx); + float res = determinant(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + determinant_a0a87c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + determinant_a0a87c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + determinant_a0a87c(); + return; +} diff --git a/test/tint/builtins/gen/var/determinant/a0a87c.wgsl.expected.msl b/test/tint/builtins/gen/var/determinant/a0a87c.wgsl.expected.msl new file mode 100644 index 0000000000..f369381d21 --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/a0a87c.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void determinant_a0a87c() { + float4x4 arg_0 = float4x4(float4(0.0f), float4(0.0f), float4(0.0f), float4(0.0f)); + float res = determinant(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + determinant_a0a87c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + determinant_a0a87c(); + return; +} + +kernel void compute_main() { + determinant_a0a87c(); + return; +} + diff --git a/test/tint/builtins/gen/var/determinant/a0a87c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/determinant/a0a87c.wgsl.expected.spvasm new file mode 100644 index 0000000000..c05d133426 --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/a0a87c.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %determinant_a0a87c "determinant_a0a87c" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%mat4v4float = OpTypeMatrix %v4float 4 + %14 = OpConstantNull %mat4v4float +%_ptr_Function_mat4v4float = OpTypePointer Function %mat4v4float +%_ptr_Function_float = OpTypePointer Function %float + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%determinant_a0a87c = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_mat4v4float Function %14 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %14 + %19 = OpLoad %mat4v4float %arg_0 + %17 = OpExtInst %float %18 Determinant %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %determinant_a0a87c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %determinant_a0a87c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %determinant_a0a87c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/determinant/a0a87c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/determinant/a0a87c.wgsl.expected.wgsl new file mode 100644 index 0000000000..bd9f32c1ec --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/a0a87c.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn determinant_a0a87c() { + var arg_0 = mat4x4(); + var res : f32 = determinant(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + determinant_a0a87c(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + determinant_a0a87c(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + determinant_a0a87c(); +} diff --git a/test/tint/builtins/gen/var/determinant/e19305.wgsl b/test/tint/builtins/gen/var/determinant/e19305.wgsl new file mode 100644 index 0000000000..807b446f80 --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/e19305.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn determinant(mat<2, 2, f32>) -> f32 +fn determinant_e19305() { + var arg_0 = mat2x2(); + var res: f32 = determinant(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + determinant_e19305(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + determinant_e19305(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + determinant_e19305(); +} diff --git a/test/tint/builtins/gen/var/determinant/e19305.wgsl.expected.glsl b/test/tint/builtins/gen/var/determinant/e19305.wgsl.expected.glsl new file mode 100644 index 0000000000..6cf0e5d2d2 --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/e19305.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void determinant_e19305() { + mat2 arg_0 = mat2(vec2(0.0f), vec2(0.0f)); + float res = determinant(arg_0); +} + +vec4 vertex_main() { + determinant_e19305(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void determinant_e19305() { + mat2 arg_0 = mat2(vec2(0.0f), vec2(0.0f)); + float res = determinant(arg_0); +} + +void fragment_main() { + determinant_e19305(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void determinant_e19305() { + mat2 arg_0 = mat2(vec2(0.0f), vec2(0.0f)); + float res = determinant(arg_0); +} + +void compute_main() { + determinant_e19305(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/determinant/e19305.wgsl.expected.hlsl b/test/tint/builtins/gen/var/determinant/e19305.wgsl.expected.hlsl new file mode 100644 index 0000000000..84a0eda0b8 --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/e19305.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void determinant_e19305() { + float2x2 arg_0 = float2x2((0.0f).xx, (0.0f).xx); + float res = determinant(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + determinant_e19305(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + determinant_e19305(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + determinant_e19305(); + return; +} diff --git a/test/tint/builtins/gen/var/determinant/e19305.wgsl.expected.msl b/test/tint/builtins/gen/var/determinant/e19305.wgsl.expected.msl new file mode 100644 index 0000000000..b74f1f50e7 --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/e19305.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void determinant_e19305() { + float2x2 arg_0 = float2x2(float2(0.0f), float2(0.0f)); + float res = determinant(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + determinant_e19305(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + determinant_e19305(); + return; +} + +kernel void compute_main() { + determinant_e19305(); + return; +} + diff --git a/test/tint/builtins/gen/var/determinant/e19305.wgsl.expected.spvasm b/test/tint/builtins/gen/var/determinant/e19305.wgsl.expected.spvasm new file mode 100644 index 0000000000..2ef5af2147 --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/e19305.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %determinant_e19305 "determinant_e19305" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%mat2v2float = OpTypeMatrix %v2float 2 + %15 = OpConstantNull %mat2v2float +%_ptr_Function_mat2v2float = OpTypePointer Function %mat2v2float +%_ptr_Function_float = OpTypePointer Function %float + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%determinant_e19305 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_mat2v2float Function %15 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %15 + %20 = OpLoad %mat2v2float %arg_0 + %18 = OpExtInst %float %19 Determinant %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %determinant_e19305 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %determinant_e19305 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %determinant_e19305 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/determinant/e19305.wgsl.expected.wgsl b/test/tint/builtins/gen/var/determinant/e19305.wgsl.expected.wgsl new file mode 100644 index 0000000000..f01365f75d --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/e19305.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn determinant_e19305() { + var arg_0 = mat2x2(); + var res : f32 = determinant(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + determinant_e19305(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + determinant_e19305(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + determinant_e19305(); +} diff --git a/test/tint/builtins/gen/var/distance/0657d4.wgsl b/test/tint/builtins/gen/var/distance/0657d4.wgsl new file mode 100644 index 0000000000..8569c29b83 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/0657d4.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn distance(vec<3, f32>, vec<3, f32>) -> f32 +fn distance_0657d4() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var res: f32 = distance(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + distance_0657d4(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + distance_0657d4(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + distance_0657d4(); +} diff --git a/test/tint/builtins/gen/var/distance/0657d4.wgsl.expected.glsl b/test/tint/builtins/gen/var/distance/0657d4.wgsl.expected.glsl new file mode 100644 index 0000000000..b040bd062b --- /dev/null +++ b/test/tint/builtins/gen/var/distance/0657d4.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void distance_0657d4() { + vec3 arg_0 = vec3(0.0f); + vec3 arg_1 = vec3(0.0f); + float res = distance(arg_0, arg_1); +} + +vec4 vertex_main() { + distance_0657d4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void distance_0657d4() { + vec3 arg_0 = vec3(0.0f); + vec3 arg_1 = vec3(0.0f); + float res = distance(arg_0, arg_1); +} + +void fragment_main() { + distance_0657d4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void distance_0657d4() { + vec3 arg_0 = vec3(0.0f); + vec3 arg_1 = vec3(0.0f); + float res = distance(arg_0, arg_1); +} + +void compute_main() { + distance_0657d4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/distance/0657d4.wgsl.expected.hlsl b/test/tint/builtins/gen/var/distance/0657d4.wgsl.expected.hlsl new file mode 100644 index 0000000000..0155edfdd2 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/0657d4.wgsl.expected.hlsl @@ -0,0 +1,32 @@ +void distance_0657d4() { + float3 arg_0 = (0.0f).xxx; + float3 arg_1 = (0.0f).xxx; + float res = distance(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + distance_0657d4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + distance_0657d4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + distance_0657d4(); + return; +} diff --git a/test/tint/builtins/gen/var/distance/0657d4.wgsl.expected.msl b/test/tint/builtins/gen/var/distance/0657d4.wgsl.expected.msl new file mode 100644 index 0000000000..7821e690c0 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/0657d4.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void distance_0657d4() { + float3 arg_0 = float3(0.0f); + float3 arg_1 = float3(0.0f); + float res = distance(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + distance_0657d4(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + distance_0657d4(); + return; +} + +kernel void compute_main() { + distance_0657d4(); + return; +} + diff --git a/test/tint/builtins/gen/var/distance/0657d4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/distance/0657d4.wgsl.expected.spvasm new file mode 100644 index 0000000000..bdb8c3f1ee --- /dev/null +++ b/test/tint/builtins/gen/var/distance/0657d4.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %distance_0657d4 "distance_0657d4" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %14 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float +%_ptr_Function_float = OpTypePointer Function %float + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%distance_0657d4 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %14 + %arg_1 = OpVariable %_ptr_Function_v3float Function %14 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + %20 = OpLoad %v3float %arg_0 + %21 = OpLoad %v3float %arg_1 + %18 = OpExtInst %float %19 Distance %20 %21 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %distance_0657d4 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %distance_0657d4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %distance_0657d4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/distance/0657d4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/distance/0657d4.wgsl.expected.wgsl new file mode 100644 index 0000000000..37716a744d --- /dev/null +++ b/test/tint/builtins/gen/var/distance/0657d4.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn distance_0657d4() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var res : f32 = distance(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + distance_0657d4(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + distance_0657d4(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + distance_0657d4(); +} diff --git a/test/tint/builtins/gen/var/distance/9646ea.wgsl b/test/tint/builtins/gen/var/distance/9646ea.wgsl new file mode 100644 index 0000000000..fdd8827a3c --- /dev/null +++ b/test/tint/builtins/gen/var/distance/9646ea.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn distance(vec<4, f32>, vec<4, f32>) -> f32 +fn distance_9646ea() { + var arg_0 = vec4(); + var arg_1 = vec4(); + var res: f32 = distance(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + distance_9646ea(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + distance_9646ea(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + distance_9646ea(); +} diff --git a/test/tint/builtins/gen/var/distance/9646ea.wgsl.expected.glsl b/test/tint/builtins/gen/var/distance/9646ea.wgsl.expected.glsl new file mode 100644 index 0000000000..c13093cf5d --- /dev/null +++ b/test/tint/builtins/gen/var/distance/9646ea.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void distance_9646ea() { + vec4 arg_0 = vec4(0.0f); + vec4 arg_1 = vec4(0.0f); + float res = distance(arg_0, arg_1); +} + +vec4 vertex_main() { + distance_9646ea(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void distance_9646ea() { + vec4 arg_0 = vec4(0.0f); + vec4 arg_1 = vec4(0.0f); + float res = distance(arg_0, arg_1); +} + +void fragment_main() { + distance_9646ea(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void distance_9646ea() { + vec4 arg_0 = vec4(0.0f); + vec4 arg_1 = vec4(0.0f); + float res = distance(arg_0, arg_1); +} + +void compute_main() { + distance_9646ea(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/distance/9646ea.wgsl.expected.hlsl b/test/tint/builtins/gen/var/distance/9646ea.wgsl.expected.hlsl new file mode 100644 index 0000000000..31d25bb5ac --- /dev/null +++ b/test/tint/builtins/gen/var/distance/9646ea.wgsl.expected.hlsl @@ -0,0 +1,32 @@ +void distance_9646ea() { + float4 arg_0 = (0.0f).xxxx; + float4 arg_1 = (0.0f).xxxx; + float res = distance(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + distance_9646ea(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + distance_9646ea(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + distance_9646ea(); + return; +} diff --git a/test/tint/builtins/gen/var/distance/9646ea.wgsl.expected.msl b/test/tint/builtins/gen/var/distance/9646ea.wgsl.expected.msl new file mode 100644 index 0000000000..640769f649 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/9646ea.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void distance_9646ea() { + float4 arg_0 = float4(0.0f); + float4 arg_1 = float4(0.0f); + float res = distance(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + distance_9646ea(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + distance_9646ea(); + return; +} + +kernel void compute_main() { + distance_9646ea(); + return; +} + diff --git a/test/tint/builtins/gen/var/distance/9646ea.wgsl.expected.spvasm b/test/tint/builtins/gen/var/distance/9646ea.wgsl.expected.spvasm new file mode 100644 index 0000000000..3909a97072 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/9646ea.wgsl.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %distance_9646ea "distance_9646ea" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Function_float = OpTypePointer Function %float + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%distance_9646ea = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %arg_1 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %5 + OpStore %arg_1 %5 + %18 = OpLoad %v4float %arg_0 + %19 = OpLoad %v4float %arg_1 + %16 = OpExtInst %float %17 Distance %18 %19 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %distance_9646ea + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %distance_9646ea + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %distance_9646ea + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/distance/9646ea.wgsl.expected.wgsl b/test/tint/builtins/gen/var/distance/9646ea.wgsl.expected.wgsl new file mode 100644 index 0000000000..e2023ef255 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/9646ea.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn distance_9646ea() { + var arg_0 = vec4(); + var arg_1 = vec4(); + var res : f32 = distance(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + distance_9646ea(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + distance_9646ea(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + distance_9646ea(); +} diff --git a/test/tint/builtins/gen/var/distance/aa4055.wgsl b/test/tint/builtins/gen/var/distance/aa4055.wgsl new file mode 100644 index 0000000000..192d0926fc --- /dev/null +++ b/test/tint/builtins/gen/var/distance/aa4055.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn distance(vec<2, f32>, vec<2, f32>) -> f32 +fn distance_aa4055() { + var arg_0 = vec2(); + var arg_1 = vec2(); + var res: f32 = distance(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + distance_aa4055(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + distance_aa4055(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + distance_aa4055(); +} diff --git a/test/tint/builtins/gen/var/distance/aa4055.wgsl.expected.glsl b/test/tint/builtins/gen/var/distance/aa4055.wgsl.expected.glsl new file mode 100644 index 0000000000..391ff0d312 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/aa4055.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void distance_aa4055() { + vec2 arg_0 = vec2(0.0f); + vec2 arg_1 = vec2(0.0f); + float res = distance(arg_0, arg_1); +} + +vec4 vertex_main() { + distance_aa4055(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void distance_aa4055() { + vec2 arg_0 = vec2(0.0f); + vec2 arg_1 = vec2(0.0f); + float res = distance(arg_0, arg_1); +} + +void fragment_main() { + distance_aa4055(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void distance_aa4055() { + vec2 arg_0 = vec2(0.0f); + vec2 arg_1 = vec2(0.0f); + float res = distance(arg_0, arg_1); +} + +void compute_main() { + distance_aa4055(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/distance/aa4055.wgsl.expected.hlsl b/test/tint/builtins/gen/var/distance/aa4055.wgsl.expected.hlsl new file mode 100644 index 0000000000..49d49f9e13 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/aa4055.wgsl.expected.hlsl @@ -0,0 +1,32 @@ +void distance_aa4055() { + float2 arg_0 = (0.0f).xx; + float2 arg_1 = (0.0f).xx; + float res = distance(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + distance_aa4055(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + distance_aa4055(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + distance_aa4055(); + return; +} diff --git a/test/tint/builtins/gen/var/distance/aa4055.wgsl.expected.msl b/test/tint/builtins/gen/var/distance/aa4055.wgsl.expected.msl new file mode 100644 index 0000000000..748f9f0db2 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/aa4055.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void distance_aa4055() { + float2 arg_0 = float2(0.0f); + float2 arg_1 = float2(0.0f); + float res = distance(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + distance_aa4055(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + distance_aa4055(); + return; +} + +kernel void compute_main() { + distance_aa4055(); + return; +} + diff --git a/test/tint/builtins/gen/var/distance/aa4055.wgsl.expected.spvasm b/test/tint/builtins/gen/var/distance/aa4055.wgsl.expected.spvasm new file mode 100644 index 0000000000..92c9b13271 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/aa4055.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %distance_aa4055 "distance_aa4055" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %14 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float +%_ptr_Function_float = OpTypePointer Function %float + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%distance_aa4055 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %14 + %arg_1 = OpVariable %_ptr_Function_v2float Function %14 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + %20 = OpLoad %v2float %arg_0 + %21 = OpLoad %v2float %arg_1 + %18 = OpExtInst %float %19 Distance %20 %21 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %distance_aa4055 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %distance_aa4055 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %distance_aa4055 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/distance/aa4055.wgsl.expected.wgsl b/test/tint/builtins/gen/var/distance/aa4055.wgsl.expected.wgsl new file mode 100644 index 0000000000..ed6a4db575 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/aa4055.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn distance_aa4055() { + var arg_0 = vec2(); + var arg_1 = vec2(); + var res : f32 = distance(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + distance_aa4055(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + distance_aa4055(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + distance_aa4055(); +} diff --git a/test/tint/builtins/gen/var/distance/cfed73.wgsl b/test/tint/builtins/gen/var/distance/cfed73.wgsl new file mode 100644 index 0000000000..497731a9f3 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/cfed73.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn distance(f32, f32) -> f32 +fn distance_cfed73() { + var arg_0 = 1.0; + var arg_1 = 1.0; + var res: f32 = distance(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + distance_cfed73(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + distance_cfed73(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + distance_cfed73(); +} diff --git a/test/tint/builtins/gen/var/distance/cfed73.wgsl.expected.glsl b/test/tint/builtins/gen/var/distance/cfed73.wgsl.expected.glsl new file mode 100644 index 0000000000..916a23d68d --- /dev/null +++ b/test/tint/builtins/gen/var/distance/cfed73.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void distance_cfed73() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float res = distance(arg_0, arg_1); +} + +vec4 vertex_main() { + distance_cfed73(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void distance_cfed73() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float res = distance(arg_0, arg_1); +} + +void fragment_main() { + distance_cfed73(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void distance_cfed73() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float res = distance(arg_0, arg_1); +} + +void compute_main() { + distance_cfed73(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/distance/cfed73.wgsl.expected.hlsl b/test/tint/builtins/gen/var/distance/cfed73.wgsl.expected.hlsl new file mode 100644 index 0000000000..b2345aa74d --- /dev/null +++ b/test/tint/builtins/gen/var/distance/cfed73.wgsl.expected.hlsl @@ -0,0 +1,32 @@ +void distance_cfed73() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float res = distance(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + distance_cfed73(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + distance_cfed73(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + distance_cfed73(); + return; +} diff --git a/test/tint/builtins/gen/var/distance/cfed73.wgsl.expected.msl b/test/tint/builtins/gen/var/distance/cfed73.wgsl.expected.msl new file mode 100644 index 0000000000..5f68fe8887 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/cfed73.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void distance_cfed73() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float res = fabs(arg_0 - arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + distance_cfed73(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + distance_cfed73(); + return; +} + +kernel void compute_main() { + distance_cfed73(); + return; +} + diff --git a/test/tint/builtins/gen/var/distance/cfed73.wgsl.expected.spvasm b/test/tint/builtins/gen/var/distance/cfed73.wgsl.expected.spvasm new file mode 100644 index 0000000000..49a0f989d1 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/cfed73.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %distance_cfed73 "distance_cfed73" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %22 = OpTypeFunction %v4float +%distance_cfed73 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %arg_1 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + OpStore %arg_1 %float_1 + %19 = OpLoad %float %arg_0 + %20 = OpLoad %float %arg_1 + %17 = OpExtInst %float %18 Distance %19 %20 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %distance_cfed73 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %distance_cfed73 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %distance_cfed73 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/distance/cfed73.wgsl.expected.wgsl b/test/tint/builtins/gen/var/distance/cfed73.wgsl.expected.wgsl new file mode 100644 index 0000000000..6464628ddf --- /dev/null +++ b/test/tint/builtins/gen/var/distance/cfed73.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn distance_cfed73() { + var arg_0 = 1.0; + var arg_1 = 1.0; + var res : f32 = distance(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + distance_cfed73(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + distance_cfed73(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + distance_cfed73(); +} diff --git a/test/tint/builtins/gen/var/dot/0c577b.wgsl b/test/tint/builtins/gen/var/dot/0c577b.wgsl new file mode 100644 index 0000000000..274216412d --- /dev/null +++ b/test/tint/builtins/gen/var/dot/0c577b.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dot(vec<4, f32>, vec<4, f32>) -> f32 +fn dot_0c577b() { + var arg_0 = vec4(); + var arg_1 = vec4(); + var res: f32 = dot(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + dot_0c577b(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + dot_0c577b(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + dot_0c577b(); +} diff --git a/test/tint/builtins/gen/var/dot/0c577b.wgsl.expected.glsl b/test/tint/builtins/gen/var/dot/0c577b.wgsl.expected.glsl new file mode 100644 index 0000000000..82d5eb9d18 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/0c577b.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void dot_0c577b() { + vec4 arg_0 = vec4(0.0f); + vec4 arg_1 = vec4(0.0f); + float res = dot(arg_0, arg_1); +} + +vec4 vertex_main() { + dot_0c577b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void dot_0c577b() { + vec4 arg_0 = vec4(0.0f); + vec4 arg_1 = vec4(0.0f); + float res = dot(arg_0, arg_1); +} + +void fragment_main() { + dot_0c577b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void dot_0c577b() { + vec4 arg_0 = vec4(0.0f); + vec4 arg_1 = vec4(0.0f); + float res = dot(arg_0, arg_1); +} + +void compute_main() { + dot_0c577b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dot/0c577b.wgsl.expected.hlsl b/test/tint/builtins/gen/var/dot/0c577b.wgsl.expected.hlsl new file mode 100644 index 0000000000..9ffbdc32ae --- /dev/null +++ b/test/tint/builtins/gen/var/dot/0c577b.wgsl.expected.hlsl @@ -0,0 +1,32 @@ +void dot_0c577b() { + float4 arg_0 = (0.0f).xxxx; + float4 arg_1 = (0.0f).xxxx; + float res = dot(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot_0c577b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot_0c577b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot_0c577b(); + return; +} diff --git a/test/tint/builtins/gen/var/dot/0c577b.wgsl.expected.msl b/test/tint/builtins/gen/var/dot/0c577b.wgsl.expected.msl new file mode 100644 index 0000000000..5641d75c2f --- /dev/null +++ b/test/tint/builtins/gen/var/dot/0c577b.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void dot_0c577b() { + float4 arg_0 = float4(0.0f); + float4 arg_1 = float4(0.0f); + float res = dot(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + dot_0c577b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + dot_0c577b(); + return; +} + +kernel void compute_main() { + dot_0c577b(); + return; +} + diff --git a/test/tint/builtins/gen/var/dot/0c577b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dot/0c577b.wgsl.expected.spvasm new file mode 100644 index 0000000000..3ab41ab4f4 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/0c577b.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %dot_0c577b "dot_0c577b" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Function_float = OpTypePointer Function %float + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %dot_0c577b = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %arg_1 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %5 + OpStore %arg_1 %5 + %17 = OpLoad %v4float %arg_0 + %18 = OpLoad %v4float %arg_1 + %16 = OpDot %float %17 %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %dot_0c577b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %dot_0c577b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %dot_0c577b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dot/0c577b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dot/0c577b.wgsl.expected.wgsl new file mode 100644 index 0000000000..d09814836a --- /dev/null +++ b/test/tint/builtins/gen/var/dot/0c577b.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn dot_0c577b() { + var arg_0 = vec4(); + var arg_1 = vec4(); + var res : f32 = dot(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + dot_0c577b(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + dot_0c577b(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + dot_0c577b(); +} diff --git a/test/tint/builtins/gen/var/dot/7548a0.wgsl b/test/tint/builtins/gen/var/dot/7548a0.wgsl new file mode 100644 index 0000000000..c4f4a8fbb1 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/7548a0.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dot(vec<3, u32>, vec<3, u32>) -> u32 +fn dot_7548a0() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var res: u32 = dot(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + dot_7548a0(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + dot_7548a0(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + dot_7548a0(); +} diff --git a/test/tint/builtins/gen/var/dot/7548a0.wgsl.expected.glsl b/test/tint/builtins/gen/var/dot/7548a0.wgsl.expected.glsl new file mode 100644 index 0000000000..c70297d8e4 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/7548a0.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es + +uint tint_int_dot(uvec3 a, uvec3 b) { + return a[0]*b[0] + a[1]*b[1] + a[2]*b[2]; +} + +void dot_7548a0() { + uvec3 arg_0 = uvec3(0u); + uvec3 arg_1 = uvec3(0u); + uint res = tint_int_dot(arg_0, arg_1); +} + +vec4 vertex_main() { + dot_7548a0(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uint tint_int_dot(uvec3 a, uvec3 b) { + return a[0]*b[0] + a[1]*b[1] + a[2]*b[2]; +} + +void dot_7548a0() { + uvec3 arg_0 = uvec3(0u); + uvec3 arg_1 = uvec3(0u); + uint res = tint_int_dot(arg_0, arg_1); +} + +void fragment_main() { + dot_7548a0(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uint tint_int_dot(uvec3 a, uvec3 b) { + return a[0]*b[0] + a[1]*b[1] + a[2]*b[2]; +} + +void dot_7548a0() { + uvec3 arg_0 = uvec3(0u); + uvec3 arg_1 = uvec3(0u); + uint res = tint_int_dot(arg_0, arg_1); +} + +void compute_main() { + dot_7548a0(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dot/7548a0.wgsl.expected.hlsl b/test/tint/builtins/gen/var/dot/7548a0.wgsl.expected.hlsl new file mode 100644 index 0000000000..4c889b1441 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/7548a0.wgsl.expected.hlsl @@ -0,0 +1,32 @@ +void dot_7548a0() { + uint3 arg_0 = (0u).xxx; + uint3 arg_1 = (0u).xxx; + uint res = dot(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot_7548a0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot_7548a0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot_7548a0(); + return; +} diff --git a/test/tint/builtins/gen/var/dot/7548a0.wgsl.expected.msl b/test/tint/builtins/gen/var/dot/7548a0.wgsl.expected.msl new file mode 100644 index 0000000000..383b56f177 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/7548a0.wgsl.expected.msl @@ -0,0 +1,40 @@ +#include + +using namespace metal; + +template +T tint_dot3(vec a, vec b) { + return a[0]*b[0] + a[1]*b[1] + a[2]*b[2]; +} +void dot_7548a0() { + uint3 arg_0 = uint3(0u); + uint3 arg_1 = uint3(0u); + uint res = tint_dot3(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + dot_7548a0(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + dot_7548a0(); + return; +} + +kernel void compute_main() { + dot_7548a0(); + return; +} + diff --git a/test/tint/builtins/gen/var/dot/7548a0.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dot/7548a0.wgsl.expected.spvasm new file mode 100644 index 0000000000..7212878836 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/7548a0.wgsl.expected.spvasm @@ -0,0 +1,87 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 49 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %dot_7548a0 "dot_7548a0" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %15 = OpConstantNull %v3uint +%_ptr_Function_v3uint = OpTypePointer Function %v3uint +%_ptr_Function_uint = OpTypePointer Function %uint + %34 = OpConstantNull %uint + %35 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %dot_7548a0 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3uint Function %15 + %arg_1 = OpVariable %_ptr_Function_v3uint Function %15 + %res = OpVariable %_ptr_Function_uint Function %34 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %20 = OpLoad %v3uint %arg_0 + %21 = OpLoad %v3uint %arg_1 + %22 = OpCompositeExtract %uint %20 0 + %23 = OpCompositeExtract %uint %21 0 + %24 = OpIMul %uint %22 %23 + %25 = OpCompositeExtract %uint %20 1 + %26 = OpCompositeExtract %uint %21 1 + %27 = OpIMul %uint %25 %26 + %28 = OpIAdd %uint %24 %27 + %29 = OpCompositeExtract %uint %20 2 + %30 = OpCompositeExtract %uint %21 2 + %31 = OpIMul %uint %29 %30 + %19 = OpIAdd %uint %28 %31 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %35 + %37 = OpLabel + %38 = OpFunctionCall %void %dot_7548a0 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %40 = OpLabel + %41 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %41 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %44 = OpLabel + %45 = OpFunctionCall %void %dot_7548a0 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %47 = OpLabel + %48 = OpFunctionCall %void %dot_7548a0 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dot/7548a0.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dot/7548a0.wgsl.expected.wgsl new file mode 100644 index 0000000000..867b1261d3 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/7548a0.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn dot_7548a0() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var res : u32 = dot(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + dot_7548a0(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + dot_7548a0(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + dot_7548a0(); +} diff --git a/test/tint/builtins/gen/var/dot/883f0e.wgsl b/test/tint/builtins/gen/var/dot/883f0e.wgsl new file mode 100644 index 0000000000..699bce7123 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/883f0e.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dot(vec<2, f32>, vec<2, f32>) -> f32 +fn dot_883f0e() { + var arg_0 = vec2(); + var arg_1 = vec2(); + var res: f32 = dot(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + dot_883f0e(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + dot_883f0e(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + dot_883f0e(); +} diff --git a/test/tint/builtins/gen/var/dot/883f0e.wgsl.expected.glsl b/test/tint/builtins/gen/var/dot/883f0e.wgsl.expected.glsl new file mode 100644 index 0000000000..4eec4f9a87 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/883f0e.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void dot_883f0e() { + vec2 arg_0 = vec2(0.0f); + vec2 arg_1 = vec2(0.0f); + float res = dot(arg_0, arg_1); +} + +vec4 vertex_main() { + dot_883f0e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void dot_883f0e() { + vec2 arg_0 = vec2(0.0f); + vec2 arg_1 = vec2(0.0f); + float res = dot(arg_0, arg_1); +} + +void fragment_main() { + dot_883f0e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void dot_883f0e() { + vec2 arg_0 = vec2(0.0f); + vec2 arg_1 = vec2(0.0f); + float res = dot(arg_0, arg_1); +} + +void compute_main() { + dot_883f0e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dot/883f0e.wgsl.expected.hlsl b/test/tint/builtins/gen/var/dot/883f0e.wgsl.expected.hlsl new file mode 100644 index 0000000000..f38608aa9a --- /dev/null +++ b/test/tint/builtins/gen/var/dot/883f0e.wgsl.expected.hlsl @@ -0,0 +1,32 @@ +void dot_883f0e() { + float2 arg_0 = (0.0f).xx; + float2 arg_1 = (0.0f).xx; + float res = dot(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot_883f0e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot_883f0e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot_883f0e(); + return; +} diff --git a/test/tint/builtins/gen/var/dot/883f0e.wgsl.expected.msl b/test/tint/builtins/gen/var/dot/883f0e.wgsl.expected.msl new file mode 100644 index 0000000000..b039afafb1 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/883f0e.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void dot_883f0e() { + float2 arg_0 = float2(0.0f); + float2 arg_1 = float2(0.0f); + float res = dot(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + dot_883f0e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + dot_883f0e(); + return; +} + +kernel void compute_main() { + dot_883f0e(); + return; +} + diff --git a/test/tint/builtins/gen/var/dot/883f0e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dot/883f0e.wgsl.expected.spvasm new file mode 100644 index 0000000000..0292485abe --- /dev/null +++ b/test/tint/builtins/gen/var/dot/883f0e.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %dot_883f0e "dot_883f0e" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %14 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float +%_ptr_Function_float = OpTypePointer Function %float + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %dot_883f0e = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %14 + %arg_1 = OpVariable %_ptr_Function_v2float Function %14 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + %19 = OpLoad %v2float %arg_0 + %20 = OpLoad %v2float %arg_1 + %18 = OpDot %float %19 %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %dot_883f0e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %dot_883f0e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %dot_883f0e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dot/883f0e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dot/883f0e.wgsl.expected.wgsl new file mode 100644 index 0000000000..57a9b6e2ed --- /dev/null +++ b/test/tint/builtins/gen/var/dot/883f0e.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn dot_883f0e() { + var arg_0 = vec2(); + var arg_1 = vec2(); + var res : f32 = dot(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + dot_883f0e(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + dot_883f0e(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + dot_883f0e(); +} diff --git a/test/tint/builtins/gen/var/dot/97c7ee.wgsl b/test/tint/builtins/gen/var/dot/97c7ee.wgsl new file mode 100644 index 0000000000..cc042d02d9 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/97c7ee.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dot(vec<2, u32>, vec<2, u32>) -> u32 +fn dot_97c7ee() { + var arg_0 = vec2(); + var arg_1 = vec2(); + var res: u32 = dot(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + dot_97c7ee(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + dot_97c7ee(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + dot_97c7ee(); +} diff --git a/test/tint/builtins/gen/var/dot/97c7ee.wgsl.expected.glsl b/test/tint/builtins/gen/var/dot/97c7ee.wgsl.expected.glsl new file mode 100644 index 0000000000..4db4b19ed2 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/97c7ee.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es + +uint tint_int_dot(uvec2 a, uvec2 b) { + return a[0]*b[0] + a[1]*b[1]; +} + +void dot_97c7ee() { + uvec2 arg_0 = uvec2(0u); + uvec2 arg_1 = uvec2(0u); + uint res = tint_int_dot(arg_0, arg_1); +} + +vec4 vertex_main() { + dot_97c7ee(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uint tint_int_dot(uvec2 a, uvec2 b) { + return a[0]*b[0] + a[1]*b[1]; +} + +void dot_97c7ee() { + uvec2 arg_0 = uvec2(0u); + uvec2 arg_1 = uvec2(0u); + uint res = tint_int_dot(arg_0, arg_1); +} + +void fragment_main() { + dot_97c7ee(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uint tint_int_dot(uvec2 a, uvec2 b) { + return a[0]*b[0] + a[1]*b[1]; +} + +void dot_97c7ee() { + uvec2 arg_0 = uvec2(0u); + uvec2 arg_1 = uvec2(0u); + uint res = tint_int_dot(arg_0, arg_1); +} + +void compute_main() { + dot_97c7ee(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dot/97c7ee.wgsl.expected.hlsl b/test/tint/builtins/gen/var/dot/97c7ee.wgsl.expected.hlsl new file mode 100644 index 0000000000..d3d8cf4746 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/97c7ee.wgsl.expected.hlsl @@ -0,0 +1,32 @@ +void dot_97c7ee() { + uint2 arg_0 = (0u).xx; + uint2 arg_1 = (0u).xx; + uint res = dot(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot_97c7ee(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot_97c7ee(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot_97c7ee(); + return; +} diff --git a/test/tint/builtins/gen/var/dot/97c7ee.wgsl.expected.msl b/test/tint/builtins/gen/var/dot/97c7ee.wgsl.expected.msl new file mode 100644 index 0000000000..5fa5114e5e --- /dev/null +++ b/test/tint/builtins/gen/var/dot/97c7ee.wgsl.expected.msl @@ -0,0 +1,40 @@ +#include + +using namespace metal; + +template +T tint_dot2(vec a, vec b) { + return a[0]*b[0] + a[1]*b[1]; +} +void dot_97c7ee() { + uint2 arg_0 = uint2(0u); + uint2 arg_1 = uint2(0u); + uint res = tint_dot2(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + dot_97c7ee(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + dot_97c7ee(); + return; +} + +kernel void compute_main() { + dot_97c7ee(); + return; +} + diff --git a/test/tint/builtins/gen/var/dot/97c7ee.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dot/97c7ee.wgsl.expected.spvasm new file mode 100644 index 0000000000..b3879a61da --- /dev/null +++ b/test/tint/builtins/gen/var/dot/97c7ee.wgsl.expected.spvasm @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %dot_97c7ee "dot_97c7ee" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %15 = OpConstantNull %v2uint +%_ptr_Function_v2uint = OpTypePointer Function %v2uint +%_ptr_Function_uint = OpTypePointer Function %uint + %30 = OpConstantNull %uint + %31 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %dot_97c7ee = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2uint Function %15 + %arg_1 = OpVariable %_ptr_Function_v2uint Function %15 + %res = OpVariable %_ptr_Function_uint Function %30 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %20 = OpLoad %v2uint %arg_0 + %21 = OpLoad %v2uint %arg_1 + %22 = OpCompositeExtract %uint %20 0 + %23 = OpCompositeExtract %uint %21 0 + %24 = OpIMul %uint %22 %23 + %25 = OpCompositeExtract %uint %20 1 + %26 = OpCompositeExtract %uint %21 1 + %27 = OpIMul %uint %25 %26 + %19 = OpIAdd %uint %24 %27 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %31 + %33 = OpLabel + %34 = OpFunctionCall %void %dot_97c7ee + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %37 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %40 = OpLabel + %41 = OpFunctionCall %void %dot_97c7ee + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %43 = OpLabel + %44 = OpFunctionCall %void %dot_97c7ee + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dot/97c7ee.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dot/97c7ee.wgsl.expected.wgsl new file mode 100644 index 0000000000..6a750d19d1 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/97c7ee.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn dot_97c7ee() { + var arg_0 = vec2(); + var arg_1 = vec2(); + var res : u32 = dot(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + dot_97c7ee(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + dot_97c7ee(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + dot_97c7ee(); +} diff --git a/test/tint/builtins/gen/var/dot/ba4246.wgsl b/test/tint/builtins/gen/var/dot/ba4246.wgsl new file mode 100644 index 0000000000..f5cedcdf51 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/ba4246.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dot(vec<3, f32>, vec<3, f32>) -> f32 +fn dot_ba4246() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var res: f32 = dot(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + dot_ba4246(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + dot_ba4246(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + dot_ba4246(); +} diff --git a/test/tint/builtins/gen/var/dot/ba4246.wgsl.expected.glsl b/test/tint/builtins/gen/var/dot/ba4246.wgsl.expected.glsl new file mode 100644 index 0000000000..6c29d852b7 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/ba4246.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void dot_ba4246() { + vec3 arg_0 = vec3(0.0f); + vec3 arg_1 = vec3(0.0f); + float res = dot(arg_0, arg_1); +} + +vec4 vertex_main() { + dot_ba4246(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void dot_ba4246() { + vec3 arg_0 = vec3(0.0f); + vec3 arg_1 = vec3(0.0f); + float res = dot(arg_0, arg_1); +} + +void fragment_main() { + dot_ba4246(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void dot_ba4246() { + vec3 arg_0 = vec3(0.0f); + vec3 arg_1 = vec3(0.0f); + float res = dot(arg_0, arg_1); +} + +void compute_main() { + dot_ba4246(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dot/ba4246.wgsl.expected.hlsl b/test/tint/builtins/gen/var/dot/ba4246.wgsl.expected.hlsl new file mode 100644 index 0000000000..426f56da23 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/ba4246.wgsl.expected.hlsl @@ -0,0 +1,32 @@ +void dot_ba4246() { + float3 arg_0 = (0.0f).xxx; + float3 arg_1 = (0.0f).xxx; + float res = dot(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot_ba4246(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot_ba4246(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot_ba4246(); + return; +} diff --git a/test/tint/builtins/gen/var/dot/ba4246.wgsl.expected.msl b/test/tint/builtins/gen/var/dot/ba4246.wgsl.expected.msl new file mode 100644 index 0000000000..775db06dcc --- /dev/null +++ b/test/tint/builtins/gen/var/dot/ba4246.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void dot_ba4246() { + float3 arg_0 = float3(0.0f); + float3 arg_1 = float3(0.0f); + float res = dot(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + dot_ba4246(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + dot_ba4246(); + return; +} + +kernel void compute_main() { + dot_ba4246(); + return; +} + diff --git a/test/tint/builtins/gen/var/dot/ba4246.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dot/ba4246.wgsl.expected.spvasm new file mode 100644 index 0000000000..2e99e39692 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/ba4246.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %dot_ba4246 "dot_ba4246" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %14 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float +%_ptr_Function_float = OpTypePointer Function %float + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %dot_ba4246 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %14 + %arg_1 = OpVariable %_ptr_Function_v3float Function %14 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + %19 = OpLoad %v3float %arg_0 + %20 = OpLoad %v3float %arg_1 + %18 = OpDot %float %19 %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %dot_ba4246 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %dot_ba4246 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %dot_ba4246 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dot/ba4246.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dot/ba4246.wgsl.expected.wgsl new file mode 100644 index 0000000000..77cdb592cb --- /dev/null +++ b/test/tint/builtins/gen/var/dot/ba4246.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn dot_ba4246() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var res : f32 = dot(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + dot_ba4246(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + dot_ba4246(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + dot_ba4246(); +} diff --git a/test/tint/builtins/gen/var/dot/e994c7.wgsl b/test/tint/builtins/gen/var/dot/e994c7.wgsl new file mode 100644 index 0000000000..302f0f9606 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/e994c7.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dot(vec<4, u32>, vec<4, u32>) -> u32 +fn dot_e994c7() { + var arg_0 = vec4(); + var arg_1 = vec4(); + var res: u32 = dot(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + dot_e994c7(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + dot_e994c7(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + dot_e994c7(); +} diff --git a/test/tint/builtins/gen/var/dot/e994c7.wgsl.expected.glsl b/test/tint/builtins/gen/var/dot/e994c7.wgsl.expected.glsl new file mode 100644 index 0000000000..097eb9fdb2 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/e994c7.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es + +uint tint_int_dot(uvec4 a, uvec4 b) { + return a[0]*b[0] + a[1]*b[1] + a[2]*b[2] + a[3]*b[3]; +} + +void dot_e994c7() { + uvec4 arg_0 = uvec4(0u); + uvec4 arg_1 = uvec4(0u); + uint res = tint_int_dot(arg_0, arg_1); +} + +vec4 vertex_main() { + dot_e994c7(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uint tint_int_dot(uvec4 a, uvec4 b) { + return a[0]*b[0] + a[1]*b[1] + a[2]*b[2] + a[3]*b[3]; +} + +void dot_e994c7() { + uvec4 arg_0 = uvec4(0u); + uvec4 arg_1 = uvec4(0u); + uint res = tint_int_dot(arg_0, arg_1); +} + +void fragment_main() { + dot_e994c7(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uint tint_int_dot(uvec4 a, uvec4 b) { + return a[0]*b[0] + a[1]*b[1] + a[2]*b[2] + a[3]*b[3]; +} + +void dot_e994c7() { + uvec4 arg_0 = uvec4(0u); + uvec4 arg_1 = uvec4(0u); + uint res = tint_int_dot(arg_0, arg_1); +} + +void compute_main() { + dot_e994c7(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dot/e994c7.wgsl.expected.hlsl b/test/tint/builtins/gen/var/dot/e994c7.wgsl.expected.hlsl new file mode 100644 index 0000000000..2e609e9fb7 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/e994c7.wgsl.expected.hlsl @@ -0,0 +1,32 @@ +void dot_e994c7() { + uint4 arg_0 = (0u).xxxx; + uint4 arg_1 = (0u).xxxx; + uint res = dot(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot_e994c7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot_e994c7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot_e994c7(); + return; +} diff --git a/test/tint/builtins/gen/var/dot/e994c7.wgsl.expected.msl b/test/tint/builtins/gen/var/dot/e994c7.wgsl.expected.msl new file mode 100644 index 0000000000..48c480a2ee --- /dev/null +++ b/test/tint/builtins/gen/var/dot/e994c7.wgsl.expected.msl @@ -0,0 +1,40 @@ +#include + +using namespace metal; + +template +T tint_dot4(vec a, vec b) { + return a[0]*b[0] + a[1]*b[1] + a[2]*b[2] + a[3]*b[3]; +} +void dot_e994c7() { + uint4 arg_0 = uint4(0u); + uint4 arg_1 = uint4(0u); + uint res = tint_dot4(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + dot_e994c7(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + dot_e994c7(); + return; +} + +kernel void compute_main() { + dot_e994c7(); + return; +} + diff --git a/test/tint/builtins/gen/var/dot/e994c7.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dot/e994c7.wgsl.expected.spvasm new file mode 100644 index 0000000000..0e9a6dea4e --- /dev/null +++ b/test/tint/builtins/gen/var/dot/e994c7.wgsl.expected.spvasm @@ -0,0 +1,91 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 53 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %dot_e994c7 "dot_e994c7" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + %15 = OpConstantNull %v4uint +%_ptr_Function_v4uint = OpTypePointer Function %v4uint +%_ptr_Function_uint = OpTypePointer Function %uint + %38 = OpConstantNull %uint + %39 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %dot_e994c7 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4uint Function %15 + %arg_1 = OpVariable %_ptr_Function_v4uint Function %15 + %res = OpVariable %_ptr_Function_uint Function %38 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %20 = OpLoad %v4uint %arg_0 + %21 = OpLoad %v4uint %arg_1 + %22 = OpCompositeExtract %uint %20 0 + %23 = OpCompositeExtract %uint %21 0 + %24 = OpIMul %uint %22 %23 + %25 = OpCompositeExtract %uint %20 1 + %26 = OpCompositeExtract %uint %21 1 + %27 = OpIMul %uint %25 %26 + %28 = OpIAdd %uint %24 %27 + %29 = OpCompositeExtract %uint %20 2 + %30 = OpCompositeExtract %uint %21 2 + %31 = OpIMul %uint %29 %30 + %32 = OpIAdd %uint %28 %31 + %33 = OpCompositeExtract %uint %20 3 + %34 = OpCompositeExtract %uint %21 3 + %35 = OpIMul %uint %33 %34 + %19 = OpIAdd %uint %32 %35 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %39 + %41 = OpLabel + %42 = OpFunctionCall %void %dot_e994c7 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %44 = OpLabel + %45 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %45 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %48 = OpLabel + %49 = OpFunctionCall %void %dot_e994c7 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %51 = OpLabel + %52 = OpFunctionCall %void %dot_e994c7 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dot/e994c7.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dot/e994c7.wgsl.expected.wgsl new file mode 100644 index 0000000000..67fff9b32f --- /dev/null +++ b/test/tint/builtins/gen/var/dot/e994c7.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn dot_e994c7() { + var arg_0 = vec4(); + var arg_1 = vec4(); + var res : u32 = dot(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + dot_e994c7(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + dot_e994c7(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + dot_e994c7(); +} diff --git a/test/tint/builtins/gen/var/dot/ef6b1d.wgsl b/test/tint/builtins/gen/var/dot/ef6b1d.wgsl new file mode 100644 index 0000000000..0aa8cf576b --- /dev/null +++ b/test/tint/builtins/gen/var/dot/ef6b1d.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dot(vec<4, i32>, vec<4, i32>) -> i32 +fn dot_ef6b1d() { + var arg_0 = vec4(); + var arg_1 = vec4(); + var res: i32 = dot(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + dot_ef6b1d(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + dot_ef6b1d(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + dot_ef6b1d(); +} diff --git a/test/tint/builtins/gen/var/dot/ef6b1d.wgsl.expected.glsl b/test/tint/builtins/gen/var/dot/ef6b1d.wgsl.expected.glsl new file mode 100644 index 0000000000..cb1c1d5050 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/ef6b1d.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es + +int tint_int_dot(ivec4 a, ivec4 b) { + return a[0]*b[0] + a[1]*b[1] + a[2]*b[2] + a[3]*b[3]; +} + +void dot_ef6b1d() { + ivec4 arg_0 = ivec4(0); + ivec4 arg_1 = ivec4(0); + int res = tint_int_dot(arg_0, arg_1); +} + +vec4 vertex_main() { + dot_ef6b1d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +int tint_int_dot(ivec4 a, ivec4 b) { + return a[0]*b[0] + a[1]*b[1] + a[2]*b[2] + a[3]*b[3]; +} + +void dot_ef6b1d() { + ivec4 arg_0 = ivec4(0); + ivec4 arg_1 = ivec4(0); + int res = tint_int_dot(arg_0, arg_1); +} + +void fragment_main() { + dot_ef6b1d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +int tint_int_dot(ivec4 a, ivec4 b) { + return a[0]*b[0] + a[1]*b[1] + a[2]*b[2] + a[3]*b[3]; +} + +void dot_ef6b1d() { + ivec4 arg_0 = ivec4(0); + ivec4 arg_1 = ivec4(0); + int res = tint_int_dot(arg_0, arg_1); +} + +void compute_main() { + dot_ef6b1d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dot/ef6b1d.wgsl.expected.hlsl b/test/tint/builtins/gen/var/dot/ef6b1d.wgsl.expected.hlsl new file mode 100644 index 0000000000..0889c70e61 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/ef6b1d.wgsl.expected.hlsl @@ -0,0 +1,32 @@ +void dot_ef6b1d() { + int4 arg_0 = (0).xxxx; + int4 arg_1 = (0).xxxx; + int res = dot(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot_ef6b1d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot_ef6b1d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot_ef6b1d(); + return; +} diff --git a/test/tint/builtins/gen/var/dot/ef6b1d.wgsl.expected.msl b/test/tint/builtins/gen/var/dot/ef6b1d.wgsl.expected.msl new file mode 100644 index 0000000000..dcbda3d012 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/ef6b1d.wgsl.expected.msl @@ -0,0 +1,40 @@ +#include + +using namespace metal; + +template +T tint_dot4(vec a, vec b) { + return a[0]*b[0] + a[1]*b[1] + a[2]*b[2] + a[3]*b[3]; +} +void dot_ef6b1d() { + int4 arg_0 = int4(0); + int4 arg_1 = int4(0); + int res = tint_dot4(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + dot_ef6b1d(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + dot_ef6b1d(); + return; +} + +kernel void compute_main() { + dot_ef6b1d(); + return; +} + diff --git a/test/tint/builtins/gen/var/dot/ef6b1d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dot/ef6b1d.wgsl.expected.spvasm new file mode 100644 index 0000000000..22f397dfc3 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/ef6b1d.wgsl.expected.spvasm @@ -0,0 +1,91 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 53 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %dot_ef6b1d "dot_ef6b1d" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %15 = OpConstantNull %v4int +%_ptr_Function_v4int = OpTypePointer Function %v4int +%_ptr_Function_int = OpTypePointer Function %int + %38 = OpConstantNull %int + %39 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %dot_ef6b1d = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4int Function %15 + %arg_1 = OpVariable %_ptr_Function_v4int Function %15 + %res = OpVariable %_ptr_Function_int Function %38 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %20 = OpLoad %v4int %arg_0 + %21 = OpLoad %v4int %arg_1 + %22 = OpCompositeExtract %int %20 0 + %23 = OpCompositeExtract %int %21 0 + %24 = OpIMul %int %22 %23 + %25 = OpCompositeExtract %int %20 1 + %26 = OpCompositeExtract %int %21 1 + %27 = OpIMul %int %25 %26 + %28 = OpIAdd %int %24 %27 + %29 = OpCompositeExtract %int %20 2 + %30 = OpCompositeExtract %int %21 2 + %31 = OpIMul %int %29 %30 + %32 = OpIAdd %int %28 %31 + %33 = OpCompositeExtract %int %20 3 + %34 = OpCompositeExtract %int %21 3 + %35 = OpIMul %int %33 %34 + %19 = OpIAdd %int %32 %35 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %39 + %41 = OpLabel + %42 = OpFunctionCall %void %dot_ef6b1d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %44 = OpLabel + %45 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %45 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %48 = OpLabel + %49 = OpFunctionCall %void %dot_ef6b1d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %51 = OpLabel + %52 = OpFunctionCall %void %dot_ef6b1d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dot/ef6b1d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dot/ef6b1d.wgsl.expected.wgsl new file mode 100644 index 0000000000..aae5da9081 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/ef6b1d.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn dot_ef6b1d() { + var arg_0 = vec4(); + var arg_1 = vec4(); + var res : i32 = dot(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + dot_ef6b1d(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + dot_ef6b1d(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + dot_ef6b1d(); +} diff --git a/test/tint/builtins/gen/var/dot/f1312c.wgsl b/test/tint/builtins/gen/var/dot/f1312c.wgsl new file mode 100644 index 0000000000..a8ed93f7d5 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/f1312c.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dot(vec<3, i32>, vec<3, i32>) -> i32 +fn dot_f1312c() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var res: i32 = dot(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + dot_f1312c(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + dot_f1312c(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + dot_f1312c(); +} diff --git a/test/tint/builtins/gen/var/dot/f1312c.wgsl.expected.glsl b/test/tint/builtins/gen/var/dot/f1312c.wgsl.expected.glsl new file mode 100644 index 0000000000..9699e6fac5 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/f1312c.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es + +int tint_int_dot(ivec3 a, ivec3 b) { + return a[0]*b[0] + a[1]*b[1] + a[2]*b[2]; +} + +void dot_f1312c() { + ivec3 arg_0 = ivec3(0); + ivec3 arg_1 = ivec3(0); + int res = tint_int_dot(arg_0, arg_1); +} + +vec4 vertex_main() { + dot_f1312c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +int tint_int_dot(ivec3 a, ivec3 b) { + return a[0]*b[0] + a[1]*b[1] + a[2]*b[2]; +} + +void dot_f1312c() { + ivec3 arg_0 = ivec3(0); + ivec3 arg_1 = ivec3(0); + int res = tint_int_dot(arg_0, arg_1); +} + +void fragment_main() { + dot_f1312c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +int tint_int_dot(ivec3 a, ivec3 b) { + return a[0]*b[0] + a[1]*b[1] + a[2]*b[2]; +} + +void dot_f1312c() { + ivec3 arg_0 = ivec3(0); + ivec3 arg_1 = ivec3(0); + int res = tint_int_dot(arg_0, arg_1); +} + +void compute_main() { + dot_f1312c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dot/f1312c.wgsl.expected.hlsl b/test/tint/builtins/gen/var/dot/f1312c.wgsl.expected.hlsl new file mode 100644 index 0000000000..6562925b32 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/f1312c.wgsl.expected.hlsl @@ -0,0 +1,32 @@ +void dot_f1312c() { + int3 arg_0 = (0).xxx; + int3 arg_1 = (0).xxx; + int res = dot(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot_f1312c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot_f1312c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot_f1312c(); + return; +} diff --git a/test/tint/builtins/gen/var/dot/f1312c.wgsl.expected.msl b/test/tint/builtins/gen/var/dot/f1312c.wgsl.expected.msl new file mode 100644 index 0000000000..22d6fb32ee --- /dev/null +++ b/test/tint/builtins/gen/var/dot/f1312c.wgsl.expected.msl @@ -0,0 +1,40 @@ +#include + +using namespace metal; + +template +T tint_dot3(vec a, vec b) { + return a[0]*b[0] + a[1]*b[1] + a[2]*b[2]; +} +void dot_f1312c() { + int3 arg_0 = int3(0); + int3 arg_1 = int3(0); + int res = tint_dot3(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + dot_f1312c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + dot_f1312c(); + return; +} + +kernel void compute_main() { + dot_f1312c(); + return; +} + diff --git a/test/tint/builtins/gen/var/dot/f1312c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dot/f1312c.wgsl.expected.spvasm new file mode 100644 index 0000000000..bc03d168a3 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/f1312c.wgsl.expected.spvasm @@ -0,0 +1,87 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 49 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %dot_f1312c "dot_f1312c" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %15 = OpConstantNull %v3int +%_ptr_Function_v3int = OpTypePointer Function %v3int +%_ptr_Function_int = OpTypePointer Function %int + %34 = OpConstantNull %int + %35 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %dot_f1312c = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3int Function %15 + %arg_1 = OpVariable %_ptr_Function_v3int Function %15 + %res = OpVariable %_ptr_Function_int Function %34 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %20 = OpLoad %v3int %arg_0 + %21 = OpLoad %v3int %arg_1 + %22 = OpCompositeExtract %int %20 0 + %23 = OpCompositeExtract %int %21 0 + %24 = OpIMul %int %22 %23 + %25 = OpCompositeExtract %int %20 1 + %26 = OpCompositeExtract %int %21 1 + %27 = OpIMul %int %25 %26 + %28 = OpIAdd %int %24 %27 + %29 = OpCompositeExtract %int %20 2 + %30 = OpCompositeExtract %int %21 2 + %31 = OpIMul %int %29 %30 + %19 = OpIAdd %int %28 %31 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %35 + %37 = OpLabel + %38 = OpFunctionCall %void %dot_f1312c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %40 = OpLabel + %41 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %41 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %44 = OpLabel + %45 = OpFunctionCall %void %dot_f1312c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %47 = OpLabel + %48 = OpFunctionCall %void %dot_f1312c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dot/f1312c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dot/f1312c.wgsl.expected.wgsl new file mode 100644 index 0000000000..7b402b4e42 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/f1312c.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn dot_f1312c() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var res : i32 = dot(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + dot_f1312c(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + dot_f1312c(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + dot_f1312c(); +} diff --git a/test/tint/builtins/gen/var/dot/fc5f7c.wgsl b/test/tint/builtins/gen/var/dot/fc5f7c.wgsl new file mode 100644 index 0000000000..db7080193f --- /dev/null +++ b/test/tint/builtins/gen/var/dot/fc5f7c.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dot(vec<2, i32>, vec<2, i32>) -> i32 +fn dot_fc5f7c() { + var arg_0 = vec2(); + var arg_1 = vec2(); + var res: i32 = dot(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + dot_fc5f7c(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + dot_fc5f7c(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + dot_fc5f7c(); +} diff --git a/test/tint/builtins/gen/var/dot/fc5f7c.wgsl.expected.glsl b/test/tint/builtins/gen/var/dot/fc5f7c.wgsl.expected.glsl new file mode 100644 index 0000000000..64e9e0cafc --- /dev/null +++ b/test/tint/builtins/gen/var/dot/fc5f7c.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es + +int tint_int_dot(ivec2 a, ivec2 b) { + return a[0]*b[0] + a[1]*b[1]; +} + +void dot_fc5f7c() { + ivec2 arg_0 = ivec2(0); + ivec2 arg_1 = ivec2(0); + int res = tint_int_dot(arg_0, arg_1); +} + +vec4 vertex_main() { + dot_fc5f7c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +int tint_int_dot(ivec2 a, ivec2 b) { + return a[0]*b[0] + a[1]*b[1]; +} + +void dot_fc5f7c() { + ivec2 arg_0 = ivec2(0); + ivec2 arg_1 = ivec2(0); + int res = tint_int_dot(arg_0, arg_1); +} + +void fragment_main() { + dot_fc5f7c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +int tint_int_dot(ivec2 a, ivec2 b) { + return a[0]*b[0] + a[1]*b[1]; +} + +void dot_fc5f7c() { + ivec2 arg_0 = ivec2(0); + ivec2 arg_1 = ivec2(0); + int res = tint_int_dot(arg_0, arg_1); +} + +void compute_main() { + dot_fc5f7c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dot/fc5f7c.wgsl.expected.hlsl b/test/tint/builtins/gen/var/dot/fc5f7c.wgsl.expected.hlsl new file mode 100644 index 0000000000..19af42f9f5 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/fc5f7c.wgsl.expected.hlsl @@ -0,0 +1,32 @@ +void dot_fc5f7c() { + int2 arg_0 = (0).xx; + int2 arg_1 = (0).xx; + int res = dot(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot_fc5f7c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot_fc5f7c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot_fc5f7c(); + return; +} diff --git a/test/tint/builtins/gen/var/dot/fc5f7c.wgsl.expected.msl b/test/tint/builtins/gen/var/dot/fc5f7c.wgsl.expected.msl new file mode 100644 index 0000000000..ca3576932c --- /dev/null +++ b/test/tint/builtins/gen/var/dot/fc5f7c.wgsl.expected.msl @@ -0,0 +1,40 @@ +#include + +using namespace metal; + +template +T tint_dot2(vec a, vec b) { + return a[0]*b[0] + a[1]*b[1]; +} +void dot_fc5f7c() { + int2 arg_0 = int2(0); + int2 arg_1 = int2(0); + int res = tint_dot2(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + dot_fc5f7c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + dot_fc5f7c(); + return; +} + +kernel void compute_main() { + dot_fc5f7c(); + return; +} + diff --git a/test/tint/builtins/gen/var/dot/fc5f7c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dot/fc5f7c.wgsl.expected.spvasm new file mode 100644 index 0000000000..81ca2fd01f --- /dev/null +++ b/test/tint/builtins/gen/var/dot/fc5f7c.wgsl.expected.spvasm @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %dot_fc5f7c "dot_fc5f7c" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %15 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int +%_ptr_Function_int = OpTypePointer Function %int + %30 = OpConstantNull %int + %31 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %dot_fc5f7c = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2int Function %15 + %arg_1 = OpVariable %_ptr_Function_v2int Function %15 + %res = OpVariable %_ptr_Function_int Function %30 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %20 = OpLoad %v2int %arg_0 + %21 = OpLoad %v2int %arg_1 + %22 = OpCompositeExtract %int %20 0 + %23 = OpCompositeExtract %int %21 0 + %24 = OpIMul %int %22 %23 + %25 = OpCompositeExtract %int %20 1 + %26 = OpCompositeExtract %int %21 1 + %27 = OpIMul %int %25 %26 + %19 = OpIAdd %int %24 %27 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %31 + %33 = OpLabel + %34 = OpFunctionCall %void %dot_fc5f7c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %37 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %40 = OpLabel + %41 = OpFunctionCall %void %dot_fc5f7c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %43 = OpLabel + %44 = OpFunctionCall %void %dot_fc5f7c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dot/fc5f7c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dot/fc5f7c.wgsl.expected.wgsl new file mode 100644 index 0000000000..f2d3f6763c --- /dev/null +++ b/test/tint/builtins/gen/var/dot/fc5f7c.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn dot_fc5f7c() { + var arg_0 = vec2(); + var arg_1 = vec2(); + var res : i32 = dot(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + dot_fc5f7c(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + dot_fc5f7c(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + dot_fc5f7c(); +} diff --git a/test/tint/builtins/gen/var/dpdx/0763f7.wgsl b/test/tint/builtins/gen/var/dpdx/0763f7.wgsl new file mode 100644 index 0000000000..6a7314b964 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdx/0763f7.wgsl @@ -0,0 +1,35 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdx(vec<3, f32>) -> vec<3, f32> +fn dpdx_0763f7() { + var arg_0 = vec3(); + var res: vec3 = dpdx(arg_0); +} + +@stage(fragment) +fn fragment_main() { + dpdx_0763f7(); +} diff --git a/test/tint/builtins/gen/var/dpdx/0763f7.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdx/0763f7.wgsl.expected.glsl new file mode 100644 index 0000000000..4b8112140c --- /dev/null +++ b/test/tint/builtins/gen/var/dpdx/0763f7.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void dpdx_0763f7() { + vec3 arg_0 = vec3(0.0f); + vec3 res = dFdx(arg_0); +} + +void fragment_main() { + dpdx_0763f7(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdx/0763f7.wgsl.expected.hlsl b/test/tint/builtins/gen/var/dpdx/0763f7.wgsl.expected.hlsl new file mode 100644 index 0000000000..452f7005fa --- /dev/null +++ b/test/tint/builtins/gen/var/dpdx/0763f7.wgsl.expected.hlsl @@ -0,0 +1,9 @@ +void dpdx_0763f7() { + float3 arg_0 = (0.0f).xxx; + float3 res = ddx(arg_0); +} + +void fragment_main() { + dpdx_0763f7(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdx/0763f7.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdx/0763f7.wgsl.expected.msl new file mode 100644 index 0000000000..6fdb57eadc --- /dev/null +++ b/test/tint/builtins/gen/var/dpdx/0763f7.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void dpdx_0763f7() { + float3 arg_0 = float3(0.0f); + float3 res = dfdx(arg_0); +} + +fragment void fragment_main() { + dpdx_0763f7(); + return; +} + diff --git a/test/tint/builtins/gen/var/dpdx/0763f7.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdx/0763f7.wgsl.expected.spvasm new file mode 100644 index 0000000000..a797d841c8 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdx/0763f7.wgsl.expected.spvasm @@ -0,0 +1,34 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %dpdx_0763f7 "dpdx_0763f7" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %7 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float +%dpdx_0763f7 = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %7 + %res = OpVariable %_ptr_Function_v3float Function %7 + OpStore %arg_0 %7 + %11 = OpLoad %v3float %arg_0 + %10 = OpDPdx %v3float %11 + OpStore %res %10 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %dpdx_0763f7 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dpdx/0763f7.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdx/0763f7.wgsl.expected.wgsl new file mode 100644 index 0000000000..83b7c77b9f --- /dev/null +++ b/test/tint/builtins/gen/var/dpdx/0763f7.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn dpdx_0763f7() { + var arg_0 = vec3(); + var res : vec3 = dpdx(arg_0); +} + +@stage(fragment) +fn fragment_main() { + dpdx_0763f7(); +} diff --git a/test/tint/builtins/gen/var/dpdx/99edb1.wgsl b/test/tint/builtins/gen/var/dpdx/99edb1.wgsl new file mode 100644 index 0000000000..cc540ea815 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdx/99edb1.wgsl @@ -0,0 +1,35 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdx(vec<2, f32>) -> vec<2, f32> +fn dpdx_99edb1() { + var arg_0 = vec2(); + var res: vec2 = dpdx(arg_0); +} + +@stage(fragment) +fn fragment_main() { + dpdx_99edb1(); +} diff --git a/test/tint/builtins/gen/var/dpdx/99edb1.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdx/99edb1.wgsl.expected.glsl new file mode 100644 index 0000000000..a112826fa7 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdx/99edb1.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void dpdx_99edb1() { + vec2 arg_0 = vec2(0.0f); + vec2 res = dFdx(arg_0); +} + +void fragment_main() { + dpdx_99edb1(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdx/99edb1.wgsl.expected.hlsl b/test/tint/builtins/gen/var/dpdx/99edb1.wgsl.expected.hlsl new file mode 100644 index 0000000000..5251f081cc --- /dev/null +++ b/test/tint/builtins/gen/var/dpdx/99edb1.wgsl.expected.hlsl @@ -0,0 +1,9 @@ +void dpdx_99edb1() { + float2 arg_0 = (0.0f).xx; + float2 res = ddx(arg_0); +} + +void fragment_main() { + dpdx_99edb1(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdx/99edb1.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdx/99edb1.wgsl.expected.msl new file mode 100644 index 0000000000..c9d152ac24 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdx/99edb1.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void dpdx_99edb1() { + float2 arg_0 = float2(0.0f); + float2 res = dfdx(arg_0); +} + +fragment void fragment_main() { + dpdx_99edb1(); + return; +} + diff --git a/test/tint/builtins/gen/var/dpdx/99edb1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdx/99edb1.wgsl.expected.spvasm new file mode 100644 index 0000000000..0aa334a7d5 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdx/99edb1.wgsl.expected.spvasm @@ -0,0 +1,34 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %dpdx_99edb1 "dpdx_99edb1" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %7 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float +%dpdx_99edb1 = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %7 + %res = OpVariable %_ptr_Function_v2float Function %7 + OpStore %arg_0 %7 + %11 = OpLoad %v2float %arg_0 + %10 = OpDPdx %v2float %11 + OpStore %res %10 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %dpdx_99edb1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dpdx/99edb1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdx/99edb1.wgsl.expected.wgsl new file mode 100644 index 0000000000..7fa9efe56c --- /dev/null +++ b/test/tint/builtins/gen/var/dpdx/99edb1.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn dpdx_99edb1() { + var arg_0 = vec2(); + var res : vec2 = dpdx(arg_0); +} + +@stage(fragment) +fn fragment_main() { + dpdx_99edb1(); +} diff --git a/test/tint/builtins/gen/var/dpdx/c487fa.wgsl b/test/tint/builtins/gen/var/dpdx/c487fa.wgsl new file mode 100644 index 0000000000..ff04efb958 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdx/c487fa.wgsl @@ -0,0 +1,35 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdx(vec<4, f32>) -> vec<4, f32> +fn dpdx_c487fa() { + var arg_0 = vec4(); + var res: vec4 = dpdx(arg_0); +} + +@stage(fragment) +fn fragment_main() { + dpdx_c487fa(); +} diff --git a/test/tint/builtins/gen/var/dpdx/c487fa.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdx/c487fa.wgsl.expected.glsl new file mode 100644 index 0000000000..750d4af2f2 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdx/c487fa.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void dpdx_c487fa() { + vec4 arg_0 = vec4(0.0f); + vec4 res = dFdx(arg_0); +} + +void fragment_main() { + dpdx_c487fa(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdx/c487fa.wgsl.expected.hlsl b/test/tint/builtins/gen/var/dpdx/c487fa.wgsl.expected.hlsl new file mode 100644 index 0000000000..b36fbdd768 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdx/c487fa.wgsl.expected.hlsl @@ -0,0 +1,9 @@ +void dpdx_c487fa() { + float4 arg_0 = (0.0f).xxxx; + float4 res = ddx(arg_0); +} + +void fragment_main() { + dpdx_c487fa(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdx/c487fa.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdx/c487fa.wgsl.expected.msl new file mode 100644 index 0000000000..50ee8868de --- /dev/null +++ b/test/tint/builtins/gen/var/dpdx/c487fa.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void dpdx_c487fa() { + float4 arg_0 = float4(0.0f); + float4 res = dfdx(arg_0); +} + +fragment void fragment_main() { + dpdx_c487fa(); + return; +} + diff --git a/test/tint/builtins/gen/var/dpdx/c487fa.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdx/c487fa.wgsl.expected.spvasm new file mode 100644 index 0000000000..3ef2fd8897 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdx/c487fa.wgsl.expected.spvasm @@ -0,0 +1,34 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %dpdx_c487fa "dpdx_c487fa" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %7 = OpConstantNull %v4float +%_ptr_Function_v4float = OpTypePointer Function %v4float +%dpdx_c487fa = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %7 + %res = OpVariable %_ptr_Function_v4float Function %7 + OpStore %arg_0 %7 + %11 = OpLoad %v4float %arg_0 + %10 = OpDPdx %v4float %11 + OpStore %res %10 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %dpdx_c487fa + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dpdx/c487fa.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdx/c487fa.wgsl.expected.wgsl new file mode 100644 index 0000000000..f7aa222a27 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdx/c487fa.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn dpdx_c487fa() { + var arg_0 = vec4(); + var res : vec4 = dpdx(arg_0); +} + +@stage(fragment) +fn fragment_main() { + dpdx_c487fa(); +} diff --git a/test/tint/builtins/gen/var/dpdx/e263de.wgsl b/test/tint/builtins/gen/var/dpdx/e263de.wgsl new file mode 100644 index 0000000000..7247c64601 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdx/e263de.wgsl @@ -0,0 +1,35 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdx(f32) -> f32 +fn dpdx_e263de() { + var arg_0 = 1.0; + var res: f32 = dpdx(arg_0); +} + +@stage(fragment) +fn fragment_main() { + dpdx_e263de(); +} diff --git a/test/tint/builtins/gen/var/dpdx/e263de.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdx/e263de.wgsl.expected.glsl new file mode 100644 index 0000000000..7debcdb80c --- /dev/null +++ b/test/tint/builtins/gen/var/dpdx/e263de.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void dpdx_e263de() { + float arg_0 = 1.0f; + float res = dFdx(arg_0); +} + +void fragment_main() { + dpdx_e263de(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdx/e263de.wgsl.expected.hlsl b/test/tint/builtins/gen/var/dpdx/e263de.wgsl.expected.hlsl new file mode 100644 index 0000000000..ef8ef066b6 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdx/e263de.wgsl.expected.hlsl @@ -0,0 +1,9 @@ +void dpdx_e263de() { + float arg_0 = 1.0f; + float res = ddx(arg_0); +} + +void fragment_main() { + dpdx_e263de(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdx/e263de.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdx/e263de.wgsl.expected.msl new file mode 100644 index 0000000000..81401f4ab3 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdx/e263de.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void dpdx_e263de() { + float arg_0 = 1.0f; + float res = dfdx(arg_0); +} + +fragment void fragment_main() { + dpdx_e263de(); + return; +} + diff --git a/test/tint/builtins/gen/var/dpdx/e263de.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdx/e263de.wgsl.expected.spvasm new file mode 100644 index 0000000000..8346357d0a --- /dev/null +++ b/test/tint/builtins/gen/var/dpdx/e263de.wgsl.expected.spvasm @@ -0,0 +1,34 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %dpdx_e263de "dpdx_e263de" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %9 = OpConstantNull %float +%dpdx_e263de = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %9 + %res = OpVariable %_ptr_Function_float Function %9 + OpStore %arg_0 %float_1 + %11 = OpLoad %float %arg_0 + %10 = OpDPdx %float %11 + OpStore %res %10 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %dpdx_e263de + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dpdx/e263de.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdx/e263de.wgsl.expected.wgsl new file mode 100644 index 0000000000..aff2cf188d --- /dev/null +++ b/test/tint/builtins/gen/var/dpdx/e263de.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn dpdx_e263de() { + var arg_0 = 1.0; + var res : f32 = dpdx(arg_0); +} + +@stage(fragment) +fn fragment_main() { + dpdx_e263de(); +} diff --git a/test/tint/builtins/gen/var/dpdxCoarse/029152.wgsl b/test/tint/builtins/gen/var/dpdxCoarse/029152.wgsl new file mode 100644 index 0000000000..a565a80feb --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxCoarse/029152.wgsl @@ -0,0 +1,35 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdxCoarse(f32) -> f32 +fn dpdxCoarse_029152() { + var arg_0 = 1.0; + var res: f32 = dpdxCoarse(arg_0); +} + +@stage(fragment) +fn fragment_main() { + dpdxCoarse_029152(); +} diff --git a/test/tint/builtins/gen/var/dpdxCoarse/029152.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdxCoarse/029152.wgsl.expected.glsl new file mode 100644 index 0000000000..22fcf55f6c --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxCoarse/029152.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void dpdxCoarse_029152() { + float arg_0 = 1.0f; + float res = dFdx(arg_0); +} + +void fragment_main() { + dpdxCoarse_029152(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdxCoarse/029152.wgsl.expected.hlsl b/test/tint/builtins/gen/var/dpdxCoarse/029152.wgsl.expected.hlsl new file mode 100644 index 0000000000..e2ee49789e --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxCoarse/029152.wgsl.expected.hlsl @@ -0,0 +1,9 @@ +void dpdxCoarse_029152() { + float arg_0 = 1.0f; + float res = ddx_coarse(arg_0); +} + +void fragment_main() { + dpdxCoarse_029152(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdxCoarse/029152.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdxCoarse/029152.wgsl.expected.msl new file mode 100644 index 0000000000..82e95e8eb5 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxCoarse/029152.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void dpdxCoarse_029152() { + float arg_0 = 1.0f; + float res = dfdx(arg_0); +} + +fragment void fragment_main() { + dpdxCoarse_029152(); + return; +} + diff --git a/test/tint/builtins/gen/var/dpdxCoarse/029152.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdxCoarse/029152.wgsl.expected.spvasm new file mode 100644 index 0000000000..c61f62b88b --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxCoarse/029152.wgsl.expected.spvasm @@ -0,0 +1,35 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpCapability DerivativeControl + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %dpdxCoarse_029152 "dpdxCoarse_029152" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %9 = OpConstantNull %float +%dpdxCoarse_029152 = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %9 + %res = OpVariable %_ptr_Function_float Function %9 + OpStore %arg_0 %float_1 + %11 = OpLoad %float %arg_0 + %10 = OpDPdxCoarse %float %11 + OpStore %res %10 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %dpdxCoarse_029152 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dpdxCoarse/029152.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdxCoarse/029152.wgsl.expected.wgsl new file mode 100644 index 0000000000..d243b10b32 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxCoarse/029152.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn dpdxCoarse_029152() { + var arg_0 = 1.0; + var res : f32 = dpdxCoarse(arg_0); +} + +@stage(fragment) +fn fragment_main() { + dpdxCoarse_029152(); +} diff --git a/test/tint/builtins/gen/var/dpdxCoarse/9581cf.wgsl b/test/tint/builtins/gen/var/dpdxCoarse/9581cf.wgsl new file mode 100644 index 0000000000..4f30edfe42 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxCoarse/9581cf.wgsl @@ -0,0 +1,35 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdxCoarse(vec<2, f32>) -> vec<2, f32> +fn dpdxCoarse_9581cf() { + var arg_0 = vec2(); + var res: vec2 = dpdxCoarse(arg_0); +} + +@stage(fragment) +fn fragment_main() { + dpdxCoarse_9581cf(); +} diff --git a/test/tint/builtins/gen/var/dpdxCoarse/9581cf.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdxCoarse/9581cf.wgsl.expected.glsl new file mode 100644 index 0000000000..c65e7f2be0 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxCoarse/9581cf.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void dpdxCoarse_9581cf() { + vec2 arg_0 = vec2(0.0f); + vec2 res = dFdx(arg_0); +} + +void fragment_main() { + dpdxCoarse_9581cf(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdxCoarse/9581cf.wgsl.expected.hlsl b/test/tint/builtins/gen/var/dpdxCoarse/9581cf.wgsl.expected.hlsl new file mode 100644 index 0000000000..54a39b4037 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxCoarse/9581cf.wgsl.expected.hlsl @@ -0,0 +1,9 @@ +void dpdxCoarse_9581cf() { + float2 arg_0 = (0.0f).xx; + float2 res = ddx_coarse(arg_0); +} + +void fragment_main() { + dpdxCoarse_9581cf(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdxCoarse/9581cf.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdxCoarse/9581cf.wgsl.expected.msl new file mode 100644 index 0000000000..d36bcaa078 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxCoarse/9581cf.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void dpdxCoarse_9581cf() { + float2 arg_0 = float2(0.0f); + float2 res = dfdx(arg_0); +} + +fragment void fragment_main() { + dpdxCoarse_9581cf(); + return; +} + diff --git a/test/tint/builtins/gen/var/dpdxCoarse/9581cf.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdxCoarse/9581cf.wgsl.expected.spvasm new file mode 100644 index 0000000000..72c01956e0 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxCoarse/9581cf.wgsl.expected.spvasm @@ -0,0 +1,35 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpCapability DerivativeControl + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %dpdxCoarse_9581cf "dpdxCoarse_9581cf" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %7 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float +%dpdxCoarse_9581cf = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %7 + %res = OpVariable %_ptr_Function_v2float Function %7 + OpStore %arg_0 %7 + %11 = OpLoad %v2float %arg_0 + %10 = OpDPdxCoarse %v2float %11 + OpStore %res %10 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %dpdxCoarse_9581cf + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dpdxCoarse/9581cf.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdxCoarse/9581cf.wgsl.expected.wgsl new file mode 100644 index 0000000000..e2ff427071 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxCoarse/9581cf.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn dpdxCoarse_9581cf() { + var arg_0 = vec2(); + var res : vec2 = dpdxCoarse(arg_0); +} + +@stage(fragment) +fn fragment_main() { + dpdxCoarse_9581cf(); +} diff --git a/test/tint/builtins/gen/var/dpdxCoarse/c28641.wgsl b/test/tint/builtins/gen/var/dpdxCoarse/c28641.wgsl new file mode 100644 index 0000000000..18052855c6 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxCoarse/c28641.wgsl @@ -0,0 +1,35 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdxCoarse(vec<4, f32>) -> vec<4, f32> +fn dpdxCoarse_c28641() { + var arg_0 = vec4(); + var res: vec4 = dpdxCoarse(arg_0); +} + +@stage(fragment) +fn fragment_main() { + dpdxCoarse_c28641(); +} diff --git a/test/tint/builtins/gen/var/dpdxCoarse/c28641.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdxCoarse/c28641.wgsl.expected.glsl new file mode 100644 index 0000000000..11ac01c572 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxCoarse/c28641.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void dpdxCoarse_c28641() { + vec4 arg_0 = vec4(0.0f); + vec4 res = dFdx(arg_0); +} + +void fragment_main() { + dpdxCoarse_c28641(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdxCoarse/c28641.wgsl.expected.hlsl b/test/tint/builtins/gen/var/dpdxCoarse/c28641.wgsl.expected.hlsl new file mode 100644 index 0000000000..202bff3922 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxCoarse/c28641.wgsl.expected.hlsl @@ -0,0 +1,9 @@ +void dpdxCoarse_c28641() { + float4 arg_0 = (0.0f).xxxx; + float4 res = ddx_coarse(arg_0); +} + +void fragment_main() { + dpdxCoarse_c28641(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdxCoarse/c28641.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdxCoarse/c28641.wgsl.expected.msl new file mode 100644 index 0000000000..a86c65764e --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxCoarse/c28641.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void dpdxCoarse_c28641() { + float4 arg_0 = float4(0.0f); + float4 res = dfdx(arg_0); +} + +fragment void fragment_main() { + dpdxCoarse_c28641(); + return; +} + diff --git a/test/tint/builtins/gen/var/dpdxCoarse/c28641.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdxCoarse/c28641.wgsl.expected.spvasm new file mode 100644 index 0000000000..ce6a0ef918 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxCoarse/c28641.wgsl.expected.spvasm @@ -0,0 +1,35 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpCapability DerivativeControl + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %dpdxCoarse_c28641 "dpdxCoarse_c28641" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %7 = OpConstantNull %v4float +%_ptr_Function_v4float = OpTypePointer Function %v4float +%dpdxCoarse_c28641 = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %7 + %res = OpVariable %_ptr_Function_v4float Function %7 + OpStore %arg_0 %7 + %11 = OpLoad %v4float %arg_0 + %10 = OpDPdxCoarse %v4float %11 + OpStore %res %10 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %dpdxCoarse_c28641 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dpdxCoarse/c28641.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdxCoarse/c28641.wgsl.expected.wgsl new file mode 100644 index 0000000000..50ffb6595f --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxCoarse/c28641.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn dpdxCoarse_c28641() { + var arg_0 = vec4(); + var res : vec4 = dpdxCoarse(arg_0); +} + +@stage(fragment) +fn fragment_main() { + dpdxCoarse_c28641(); +} diff --git a/test/tint/builtins/gen/var/dpdxCoarse/f64d7b.wgsl b/test/tint/builtins/gen/var/dpdxCoarse/f64d7b.wgsl new file mode 100644 index 0000000000..fa36014c68 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxCoarse/f64d7b.wgsl @@ -0,0 +1,35 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdxCoarse(vec<3, f32>) -> vec<3, f32> +fn dpdxCoarse_f64d7b() { + var arg_0 = vec3(); + var res: vec3 = dpdxCoarse(arg_0); +} + +@stage(fragment) +fn fragment_main() { + dpdxCoarse_f64d7b(); +} diff --git a/test/tint/builtins/gen/var/dpdxCoarse/f64d7b.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdxCoarse/f64d7b.wgsl.expected.glsl new file mode 100644 index 0000000000..842689b084 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxCoarse/f64d7b.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void dpdxCoarse_f64d7b() { + vec3 arg_0 = vec3(0.0f); + vec3 res = dFdx(arg_0); +} + +void fragment_main() { + dpdxCoarse_f64d7b(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdxCoarse/f64d7b.wgsl.expected.hlsl b/test/tint/builtins/gen/var/dpdxCoarse/f64d7b.wgsl.expected.hlsl new file mode 100644 index 0000000000..e5d5ca6398 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxCoarse/f64d7b.wgsl.expected.hlsl @@ -0,0 +1,9 @@ +void dpdxCoarse_f64d7b() { + float3 arg_0 = (0.0f).xxx; + float3 res = ddx_coarse(arg_0); +} + +void fragment_main() { + dpdxCoarse_f64d7b(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdxCoarse/f64d7b.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdxCoarse/f64d7b.wgsl.expected.msl new file mode 100644 index 0000000000..af992b26fd --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxCoarse/f64d7b.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void dpdxCoarse_f64d7b() { + float3 arg_0 = float3(0.0f); + float3 res = dfdx(arg_0); +} + +fragment void fragment_main() { + dpdxCoarse_f64d7b(); + return; +} + diff --git a/test/tint/builtins/gen/var/dpdxCoarse/f64d7b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdxCoarse/f64d7b.wgsl.expected.spvasm new file mode 100644 index 0000000000..a58ab28f40 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxCoarse/f64d7b.wgsl.expected.spvasm @@ -0,0 +1,35 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpCapability DerivativeControl + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %dpdxCoarse_f64d7b "dpdxCoarse_f64d7b" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %7 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float +%dpdxCoarse_f64d7b = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %7 + %res = OpVariable %_ptr_Function_v3float Function %7 + OpStore %arg_0 %7 + %11 = OpLoad %v3float %arg_0 + %10 = OpDPdxCoarse %v3float %11 + OpStore %res %10 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %dpdxCoarse_f64d7b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dpdxCoarse/f64d7b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdxCoarse/f64d7b.wgsl.expected.wgsl new file mode 100644 index 0000000000..82763b8aa8 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxCoarse/f64d7b.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn dpdxCoarse_f64d7b() { + var arg_0 = vec3(); + var res : vec3 = dpdxCoarse(arg_0); +} + +@stage(fragment) +fn fragment_main() { + dpdxCoarse_f64d7b(); +} diff --git a/test/tint/builtins/gen/var/dpdxFine/8c5069.wgsl b/test/tint/builtins/gen/var/dpdxFine/8c5069.wgsl new file mode 100644 index 0000000000..3d78fc807c --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxFine/8c5069.wgsl @@ -0,0 +1,35 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdxFine(vec<4, f32>) -> vec<4, f32> +fn dpdxFine_8c5069() { + var arg_0 = vec4(); + var res: vec4 = dpdxFine(arg_0); +} + +@stage(fragment) +fn fragment_main() { + dpdxFine_8c5069(); +} diff --git a/test/tint/builtins/gen/var/dpdxFine/8c5069.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdxFine/8c5069.wgsl.expected.glsl new file mode 100644 index 0000000000..0a43a92245 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxFine/8c5069.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void dpdxFine_8c5069() { + vec4 arg_0 = vec4(0.0f); + vec4 res = dFdx(arg_0); +} + +void fragment_main() { + dpdxFine_8c5069(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdxFine/8c5069.wgsl.expected.hlsl b/test/tint/builtins/gen/var/dpdxFine/8c5069.wgsl.expected.hlsl new file mode 100644 index 0000000000..b348c27344 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxFine/8c5069.wgsl.expected.hlsl @@ -0,0 +1,9 @@ +void dpdxFine_8c5069() { + float4 arg_0 = (0.0f).xxxx; + float4 res = ddx_fine(arg_0); +} + +void fragment_main() { + dpdxFine_8c5069(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdxFine/8c5069.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdxFine/8c5069.wgsl.expected.msl new file mode 100644 index 0000000000..0ed9d358e1 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxFine/8c5069.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void dpdxFine_8c5069() { + float4 arg_0 = float4(0.0f); + float4 res = dfdx(arg_0); +} + +fragment void fragment_main() { + dpdxFine_8c5069(); + return; +} + diff --git a/test/tint/builtins/gen/var/dpdxFine/8c5069.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdxFine/8c5069.wgsl.expected.spvasm new file mode 100644 index 0000000000..8b5116096b --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxFine/8c5069.wgsl.expected.spvasm @@ -0,0 +1,35 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpCapability DerivativeControl + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %dpdxFine_8c5069 "dpdxFine_8c5069" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %7 = OpConstantNull %v4float +%_ptr_Function_v4float = OpTypePointer Function %v4float +%dpdxFine_8c5069 = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %7 + %res = OpVariable %_ptr_Function_v4float Function %7 + OpStore %arg_0 %7 + %11 = OpLoad %v4float %arg_0 + %10 = OpDPdxFine %v4float %11 + OpStore %res %10 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %dpdxFine_8c5069 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dpdxFine/8c5069.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdxFine/8c5069.wgsl.expected.wgsl new file mode 100644 index 0000000000..d19330bb50 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxFine/8c5069.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn dpdxFine_8c5069() { + var arg_0 = vec4(); + var res : vec4 = dpdxFine(arg_0); +} + +@stage(fragment) +fn fragment_main() { + dpdxFine_8c5069(); +} diff --git a/test/tint/builtins/gen/var/dpdxFine/9631de.wgsl b/test/tint/builtins/gen/var/dpdxFine/9631de.wgsl new file mode 100644 index 0000000000..2d80b50925 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxFine/9631de.wgsl @@ -0,0 +1,35 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdxFine(vec<2, f32>) -> vec<2, f32> +fn dpdxFine_9631de() { + var arg_0 = vec2(); + var res: vec2 = dpdxFine(arg_0); +} + +@stage(fragment) +fn fragment_main() { + dpdxFine_9631de(); +} diff --git a/test/tint/builtins/gen/var/dpdxFine/9631de.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdxFine/9631de.wgsl.expected.glsl new file mode 100644 index 0000000000..d1c4c17f41 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxFine/9631de.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void dpdxFine_9631de() { + vec2 arg_0 = vec2(0.0f); + vec2 res = dFdx(arg_0); +} + +void fragment_main() { + dpdxFine_9631de(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdxFine/9631de.wgsl.expected.hlsl b/test/tint/builtins/gen/var/dpdxFine/9631de.wgsl.expected.hlsl new file mode 100644 index 0000000000..1e4b48df34 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxFine/9631de.wgsl.expected.hlsl @@ -0,0 +1,9 @@ +void dpdxFine_9631de() { + float2 arg_0 = (0.0f).xx; + float2 res = ddx_fine(arg_0); +} + +void fragment_main() { + dpdxFine_9631de(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdxFine/9631de.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdxFine/9631de.wgsl.expected.msl new file mode 100644 index 0000000000..0416ec58d8 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxFine/9631de.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void dpdxFine_9631de() { + float2 arg_0 = float2(0.0f); + float2 res = dfdx(arg_0); +} + +fragment void fragment_main() { + dpdxFine_9631de(); + return; +} + diff --git a/test/tint/builtins/gen/var/dpdxFine/9631de.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdxFine/9631de.wgsl.expected.spvasm new file mode 100644 index 0000000000..ea0dbf6c06 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxFine/9631de.wgsl.expected.spvasm @@ -0,0 +1,35 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpCapability DerivativeControl + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %dpdxFine_9631de "dpdxFine_9631de" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %7 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float +%dpdxFine_9631de = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %7 + %res = OpVariable %_ptr_Function_v2float Function %7 + OpStore %arg_0 %7 + %11 = OpLoad %v2float %arg_0 + %10 = OpDPdxFine %v2float %11 + OpStore %res %10 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %dpdxFine_9631de + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dpdxFine/9631de.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdxFine/9631de.wgsl.expected.wgsl new file mode 100644 index 0000000000..179b071e83 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxFine/9631de.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn dpdxFine_9631de() { + var arg_0 = vec2(); + var res : vec2 = dpdxFine(arg_0); +} + +@stage(fragment) +fn fragment_main() { + dpdxFine_9631de(); +} diff --git a/test/tint/builtins/gen/var/dpdxFine/f401a2.wgsl b/test/tint/builtins/gen/var/dpdxFine/f401a2.wgsl new file mode 100644 index 0000000000..1dfeb73da3 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxFine/f401a2.wgsl @@ -0,0 +1,35 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdxFine(f32) -> f32 +fn dpdxFine_f401a2() { + var arg_0 = 1.0; + var res: f32 = dpdxFine(arg_0); +} + +@stage(fragment) +fn fragment_main() { + dpdxFine_f401a2(); +} diff --git a/test/tint/builtins/gen/var/dpdxFine/f401a2.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdxFine/f401a2.wgsl.expected.glsl new file mode 100644 index 0000000000..5840665b14 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxFine/f401a2.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void dpdxFine_f401a2() { + float arg_0 = 1.0f; + float res = dFdx(arg_0); +} + +void fragment_main() { + dpdxFine_f401a2(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdxFine/f401a2.wgsl.expected.hlsl b/test/tint/builtins/gen/var/dpdxFine/f401a2.wgsl.expected.hlsl new file mode 100644 index 0000000000..4c1d8c4fa6 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxFine/f401a2.wgsl.expected.hlsl @@ -0,0 +1,9 @@ +void dpdxFine_f401a2() { + float arg_0 = 1.0f; + float res = ddx_fine(arg_0); +} + +void fragment_main() { + dpdxFine_f401a2(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdxFine/f401a2.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdxFine/f401a2.wgsl.expected.msl new file mode 100644 index 0000000000..6d33b99f78 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxFine/f401a2.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void dpdxFine_f401a2() { + float arg_0 = 1.0f; + float res = dfdx(arg_0); +} + +fragment void fragment_main() { + dpdxFine_f401a2(); + return; +} + diff --git a/test/tint/builtins/gen/var/dpdxFine/f401a2.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdxFine/f401a2.wgsl.expected.spvasm new file mode 100644 index 0000000000..3806d733b4 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxFine/f401a2.wgsl.expected.spvasm @@ -0,0 +1,35 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpCapability DerivativeControl + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %dpdxFine_f401a2 "dpdxFine_f401a2" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %9 = OpConstantNull %float +%dpdxFine_f401a2 = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %9 + %res = OpVariable %_ptr_Function_float Function %9 + OpStore %arg_0 %float_1 + %11 = OpLoad %float %arg_0 + %10 = OpDPdxFine %float %11 + OpStore %res %10 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %dpdxFine_f401a2 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dpdxFine/f401a2.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdxFine/f401a2.wgsl.expected.wgsl new file mode 100644 index 0000000000..9b9d0225c7 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxFine/f401a2.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn dpdxFine_f401a2() { + var arg_0 = 1.0; + var res : f32 = dpdxFine(arg_0); +} + +@stage(fragment) +fn fragment_main() { + dpdxFine_f401a2(); +} diff --git a/test/tint/builtins/gen/var/dpdxFine/f92fb6.wgsl b/test/tint/builtins/gen/var/dpdxFine/f92fb6.wgsl new file mode 100644 index 0000000000..4849001251 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxFine/f92fb6.wgsl @@ -0,0 +1,35 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdxFine(vec<3, f32>) -> vec<3, f32> +fn dpdxFine_f92fb6() { + var arg_0 = vec3(); + var res: vec3 = dpdxFine(arg_0); +} + +@stage(fragment) +fn fragment_main() { + dpdxFine_f92fb6(); +} diff --git a/test/tint/builtins/gen/var/dpdxFine/f92fb6.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdxFine/f92fb6.wgsl.expected.glsl new file mode 100644 index 0000000000..6e72e58745 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxFine/f92fb6.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void dpdxFine_f92fb6() { + vec3 arg_0 = vec3(0.0f); + vec3 res = dFdx(arg_0); +} + +void fragment_main() { + dpdxFine_f92fb6(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdxFine/f92fb6.wgsl.expected.hlsl b/test/tint/builtins/gen/var/dpdxFine/f92fb6.wgsl.expected.hlsl new file mode 100644 index 0000000000..0177f32b7d --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxFine/f92fb6.wgsl.expected.hlsl @@ -0,0 +1,9 @@ +void dpdxFine_f92fb6() { + float3 arg_0 = (0.0f).xxx; + float3 res = ddx_fine(arg_0); +} + +void fragment_main() { + dpdxFine_f92fb6(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdxFine/f92fb6.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdxFine/f92fb6.wgsl.expected.msl new file mode 100644 index 0000000000..020368e6b7 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxFine/f92fb6.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void dpdxFine_f92fb6() { + float3 arg_0 = float3(0.0f); + float3 res = dfdx(arg_0); +} + +fragment void fragment_main() { + dpdxFine_f92fb6(); + return; +} + diff --git a/test/tint/builtins/gen/var/dpdxFine/f92fb6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdxFine/f92fb6.wgsl.expected.spvasm new file mode 100644 index 0000000000..eec936d714 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxFine/f92fb6.wgsl.expected.spvasm @@ -0,0 +1,35 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpCapability DerivativeControl + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %dpdxFine_f92fb6 "dpdxFine_f92fb6" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %7 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float +%dpdxFine_f92fb6 = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %7 + %res = OpVariable %_ptr_Function_v3float Function %7 + OpStore %arg_0 %7 + %11 = OpLoad %v3float %arg_0 + %10 = OpDPdxFine %v3float %11 + OpStore %res %10 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %dpdxFine_f92fb6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dpdxFine/f92fb6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdxFine/f92fb6.wgsl.expected.wgsl new file mode 100644 index 0000000000..8a680118c1 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxFine/f92fb6.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn dpdxFine_f92fb6() { + var arg_0 = vec3(); + var res : vec3 = dpdxFine(arg_0); +} + +@stage(fragment) +fn fragment_main() { + dpdxFine_f92fb6(); +} diff --git a/test/tint/builtins/gen/var/dpdy/699a05.wgsl b/test/tint/builtins/gen/var/dpdy/699a05.wgsl new file mode 100644 index 0000000000..2300266729 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdy/699a05.wgsl @@ -0,0 +1,35 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdy(vec<4, f32>) -> vec<4, f32> +fn dpdy_699a05() { + var arg_0 = vec4(); + var res: vec4 = dpdy(arg_0); +} + +@stage(fragment) +fn fragment_main() { + dpdy_699a05(); +} diff --git a/test/tint/builtins/gen/var/dpdy/699a05.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdy/699a05.wgsl.expected.glsl new file mode 100644 index 0000000000..7dd547a6fa --- /dev/null +++ b/test/tint/builtins/gen/var/dpdy/699a05.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void dpdy_699a05() { + vec4 arg_0 = vec4(0.0f); + vec4 res = dFdy(arg_0); +} + +void fragment_main() { + dpdy_699a05(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdy/699a05.wgsl.expected.hlsl b/test/tint/builtins/gen/var/dpdy/699a05.wgsl.expected.hlsl new file mode 100644 index 0000000000..32602bee6b --- /dev/null +++ b/test/tint/builtins/gen/var/dpdy/699a05.wgsl.expected.hlsl @@ -0,0 +1,9 @@ +void dpdy_699a05() { + float4 arg_0 = (0.0f).xxxx; + float4 res = ddy(arg_0); +} + +void fragment_main() { + dpdy_699a05(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdy/699a05.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdy/699a05.wgsl.expected.msl new file mode 100644 index 0000000000..fedc72ef3e --- /dev/null +++ b/test/tint/builtins/gen/var/dpdy/699a05.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void dpdy_699a05() { + float4 arg_0 = float4(0.0f); + float4 res = dfdy(arg_0); +} + +fragment void fragment_main() { + dpdy_699a05(); + return; +} + diff --git a/test/tint/builtins/gen/var/dpdy/699a05.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdy/699a05.wgsl.expected.spvasm new file mode 100644 index 0000000000..8664d492f1 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdy/699a05.wgsl.expected.spvasm @@ -0,0 +1,34 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %dpdy_699a05 "dpdy_699a05" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %7 = OpConstantNull %v4float +%_ptr_Function_v4float = OpTypePointer Function %v4float +%dpdy_699a05 = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %7 + %res = OpVariable %_ptr_Function_v4float Function %7 + OpStore %arg_0 %7 + %11 = OpLoad %v4float %arg_0 + %10 = OpDPdy %v4float %11 + OpStore %res %10 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %dpdy_699a05 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dpdy/699a05.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdy/699a05.wgsl.expected.wgsl new file mode 100644 index 0000000000..afd333de99 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdy/699a05.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn dpdy_699a05() { + var arg_0 = vec4(); + var res : vec4 = dpdy(arg_0); +} + +@stage(fragment) +fn fragment_main() { + dpdy_699a05(); +} diff --git a/test/tint/builtins/gen/var/dpdy/7f8d84.wgsl b/test/tint/builtins/gen/var/dpdy/7f8d84.wgsl new file mode 100644 index 0000000000..9c39cb8ccd --- /dev/null +++ b/test/tint/builtins/gen/var/dpdy/7f8d84.wgsl @@ -0,0 +1,35 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdy(f32) -> f32 +fn dpdy_7f8d84() { + var arg_0 = 1.0; + var res: f32 = dpdy(arg_0); +} + +@stage(fragment) +fn fragment_main() { + dpdy_7f8d84(); +} diff --git a/test/tint/builtins/gen/var/dpdy/7f8d84.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdy/7f8d84.wgsl.expected.glsl new file mode 100644 index 0000000000..298a7951b1 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdy/7f8d84.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void dpdy_7f8d84() { + float arg_0 = 1.0f; + float res = dFdy(arg_0); +} + +void fragment_main() { + dpdy_7f8d84(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdy/7f8d84.wgsl.expected.hlsl b/test/tint/builtins/gen/var/dpdy/7f8d84.wgsl.expected.hlsl new file mode 100644 index 0000000000..566c64bb64 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdy/7f8d84.wgsl.expected.hlsl @@ -0,0 +1,9 @@ +void dpdy_7f8d84() { + float arg_0 = 1.0f; + float res = ddy(arg_0); +} + +void fragment_main() { + dpdy_7f8d84(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdy/7f8d84.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdy/7f8d84.wgsl.expected.msl new file mode 100644 index 0000000000..5651aa7755 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdy/7f8d84.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void dpdy_7f8d84() { + float arg_0 = 1.0f; + float res = dfdy(arg_0); +} + +fragment void fragment_main() { + dpdy_7f8d84(); + return; +} + diff --git a/test/tint/builtins/gen/var/dpdy/7f8d84.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdy/7f8d84.wgsl.expected.spvasm new file mode 100644 index 0000000000..4480737a10 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdy/7f8d84.wgsl.expected.spvasm @@ -0,0 +1,34 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %dpdy_7f8d84 "dpdy_7f8d84" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %9 = OpConstantNull %float +%dpdy_7f8d84 = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %9 + %res = OpVariable %_ptr_Function_float Function %9 + OpStore %arg_0 %float_1 + %11 = OpLoad %float %arg_0 + %10 = OpDPdy %float %11 + OpStore %res %10 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %dpdy_7f8d84 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dpdy/7f8d84.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdy/7f8d84.wgsl.expected.wgsl new file mode 100644 index 0000000000..aa3d3e834d --- /dev/null +++ b/test/tint/builtins/gen/var/dpdy/7f8d84.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn dpdy_7f8d84() { + var arg_0 = 1.0; + var res : f32 = dpdy(arg_0); +} + +@stage(fragment) +fn fragment_main() { + dpdy_7f8d84(); +} diff --git a/test/tint/builtins/gen/var/dpdy/a8b56e.wgsl b/test/tint/builtins/gen/var/dpdy/a8b56e.wgsl new file mode 100644 index 0000000000..9774ec2f59 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdy/a8b56e.wgsl @@ -0,0 +1,35 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdy(vec<2, f32>) -> vec<2, f32> +fn dpdy_a8b56e() { + var arg_0 = vec2(); + var res: vec2 = dpdy(arg_0); +} + +@stage(fragment) +fn fragment_main() { + dpdy_a8b56e(); +} diff --git a/test/tint/builtins/gen/var/dpdy/a8b56e.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdy/a8b56e.wgsl.expected.glsl new file mode 100644 index 0000000000..b9d4fcc059 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdy/a8b56e.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void dpdy_a8b56e() { + vec2 arg_0 = vec2(0.0f); + vec2 res = dFdy(arg_0); +} + +void fragment_main() { + dpdy_a8b56e(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdy/a8b56e.wgsl.expected.hlsl b/test/tint/builtins/gen/var/dpdy/a8b56e.wgsl.expected.hlsl new file mode 100644 index 0000000000..87d014da6b --- /dev/null +++ b/test/tint/builtins/gen/var/dpdy/a8b56e.wgsl.expected.hlsl @@ -0,0 +1,9 @@ +void dpdy_a8b56e() { + float2 arg_0 = (0.0f).xx; + float2 res = ddy(arg_0); +} + +void fragment_main() { + dpdy_a8b56e(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdy/a8b56e.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdy/a8b56e.wgsl.expected.msl new file mode 100644 index 0000000000..fb3233e159 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdy/a8b56e.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void dpdy_a8b56e() { + float2 arg_0 = float2(0.0f); + float2 res = dfdy(arg_0); +} + +fragment void fragment_main() { + dpdy_a8b56e(); + return; +} + diff --git a/test/tint/builtins/gen/var/dpdy/a8b56e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdy/a8b56e.wgsl.expected.spvasm new file mode 100644 index 0000000000..432eb0f715 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdy/a8b56e.wgsl.expected.spvasm @@ -0,0 +1,34 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %dpdy_a8b56e "dpdy_a8b56e" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %7 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float +%dpdy_a8b56e = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %7 + %res = OpVariable %_ptr_Function_v2float Function %7 + OpStore %arg_0 %7 + %11 = OpLoad %v2float %arg_0 + %10 = OpDPdy %v2float %11 + OpStore %res %10 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %dpdy_a8b56e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dpdy/a8b56e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdy/a8b56e.wgsl.expected.wgsl new file mode 100644 index 0000000000..3c525a1478 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdy/a8b56e.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn dpdy_a8b56e() { + var arg_0 = vec2(); + var res : vec2 = dpdy(arg_0); +} + +@stage(fragment) +fn fragment_main() { + dpdy_a8b56e(); +} diff --git a/test/tint/builtins/gen/var/dpdy/feb40f.wgsl b/test/tint/builtins/gen/var/dpdy/feb40f.wgsl new file mode 100644 index 0000000000..927411e99d --- /dev/null +++ b/test/tint/builtins/gen/var/dpdy/feb40f.wgsl @@ -0,0 +1,35 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdy(vec<3, f32>) -> vec<3, f32> +fn dpdy_feb40f() { + var arg_0 = vec3(); + var res: vec3 = dpdy(arg_0); +} + +@stage(fragment) +fn fragment_main() { + dpdy_feb40f(); +} diff --git a/test/tint/builtins/gen/var/dpdy/feb40f.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdy/feb40f.wgsl.expected.glsl new file mode 100644 index 0000000000..100bd2def5 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdy/feb40f.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void dpdy_feb40f() { + vec3 arg_0 = vec3(0.0f); + vec3 res = dFdy(arg_0); +} + +void fragment_main() { + dpdy_feb40f(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdy/feb40f.wgsl.expected.hlsl b/test/tint/builtins/gen/var/dpdy/feb40f.wgsl.expected.hlsl new file mode 100644 index 0000000000..1dc58b95ab --- /dev/null +++ b/test/tint/builtins/gen/var/dpdy/feb40f.wgsl.expected.hlsl @@ -0,0 +1,9 @@ +void dpdy_feb40f() { + float3 arg_0 = (0.0f).xxx; + float3 res = ddy(arg_0); +} + +void fragment_main() { + dpdy_feb40f(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdy/feb40f.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdy/feb40f.wgsl.expected.msl new file mode 100644 index 0000000000..867b92f975 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdy/feb40f.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void dpdy_feb40f() { + float3 arg_0 = float3(0.0f); + float3 res = dfdy(arg_0); +} + +fragment void fragment_main() { + dpdy_feb40f(); + return; +} + diff --git a/test/tint/builtins/gen/var/dpdy/feb40f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdy/feb40f.wgsl.expected.spvasm new file mode 100644 index 0000000000..27dd550f34 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdy/feb40f.wgsl.expected.spvasm @@ -0,0 +1,34 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %dpdy_feb40f "dpdy_feb40f" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %7 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float +%dpdy_feb40f = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %7 + %res = OpVariable %_ptr_Function_v3float Function %7 + OpStore %arg_0 %7 + %11 = OpLoad %v3float %arg_0 + %10 = OpDPdy %v3float %11 + OpStore %res %10 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %dpdy_feb40f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dpdy/feb40f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdy/feb40f.wgsl.expected.wgsl new file mode 100644 index 0000000000..e5cf66bfb5 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdy/feb40f.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn dpdy_feb40f() { + var arg_0 = vec3(); + var res : vec3 = dpdy(arg_0); +} + +@stage(fragment) +fn fragment_main() { + dpdy_feb40f(); +} diff --git a/test/tint/builtins/gen/var/dpdyCoarse/3e1ab4.wgsl b/test/tint/builtins/gen/var/dpdyCoarse/3e1ab4.wgsl new file mode 100644 index 0000000000..5ff70f2e2a --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyCoarse/3e1ab4.wgsl @@ -0,0 +1,35 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdyCoarse(vec<2, f32>) -> vec<2, f32> +fn dpdyCoarse_3e1ab4() { + var arg_0 = vec2(); + var res: vec2 = dpdyCoarse(arg_0); +} + +@stage(fragment) +fn fragment_main() { + dpdyCoarse_3e1ab4(); +} diff --git a/test/tint/builtins/gen/var/dpdyCoarse/3e1ab4.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdyCoarse/3e1ab4.wgsl.expected.glsl new file mode 100644 index 0000000000..cbed1c7818 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyCoarse/3e1ab4.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void dpdyCoarse_3e1ab4() { + vec2 arg_0 = vec2(0.0f); + vec2 res = dFdy(arg_0); +} + +void fragment_main() { + dpdyCoarse_3e1ab4(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdyCoarse/3e1ab4.wgsl.expected.hlsl b/test/tint/builtins/gen/var/dpdyCoarse/3e1ab4.wgsl.expected.hlsl new file mode 100644 index 0000000000..1820d16199 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyCoarse/3e1ab4.wgsl.expected.hlsl @@ -0,0 +1,9 @@ +void dpdyCoarse_3e1ab4() { + float2 arg_0 = (0.0f).xx; + float2 res = ddy_coarse(arg_0); +} + +void fragment_main() { + dpdyCoarse_3e1ab4(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdyCoarse/3e1ab4.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdyCoarse/3e1ab4.wgsl.expected.msl new file mode 100644 index 0000000000..59a448b478 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyCoarse/3e1ab4.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void dpdyCoarse_3e1ab4() { + float2 arg_0 = float2(0.0f); + float2 res = dfdy(arg_0); +} + +fragment void fragment_main() { + dpdyCoarse_3e1ab4(); + return; +} + diff --git a/test/tint/builtins/gen/var/dpdyCoarse/3e1ab4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdyCoarse/3e1ab4.wgsl.expected.spvasm new file mode 100644 index 0000000000..bd5f5b3be7 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyCoarse/3e1ab4.wgsl.expected.spvasm @@ -0,0 +1,35 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpCapability DerivativeControl + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %dpdyCoarse_3e1ab4 "dpdyCoarse_3e1ab4" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %7 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float +%dpdyCoarse_3e1ab4 = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %7 + %res = OpVariable %_ptr_Function_v2float Function %7 + OpStore %arg_0 %7 + %11 = OpLoad %v2float %arg_0 + %10 = OpDPdyCoarse %v2float %11 + OpStore %res %10 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %dpdyCoarse_3e1ab4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dpdyCoarse/3e1ab4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdyCoarse/3e1ab4.wgsl.expected.wgsl new file mode 100644 index 0000000000..0a46975d71 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyCoarse/3e1ab4.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn dpdyCoarse_3e1ab4() { + var arg_0 = vec2(); + var res : vec2 = dpdyCoarse(arg_0); +} + +@stage(fragment) +fn fragment_main() { + dpdyCoarse_3e1ab4(); +} diff --git a/test/tint/builtins/gen/var/dpdyCoarse/445d24.wgsl b/test/tint/builtins/gen/var/dpdyCoarse/445d24.wgsl new file mode 100644 index 0000000000..3e72e2f8be --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyCoarse/445d24.wgsl @@ -0,0 +1,35 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdyCoarse(vec<4, f32>) -> vec<4, f32> +fn dpdyCoarse_445d24() { + var arg_0 = vec4(); + var res: vec4 = dpdyCoarse(arg_0); +} + +@stage(fragment) +fn fragment_main() { + dpdyCoarse_445d24(); +} diff --git a/test/tint/builtins/gen/var/dpdyCoarse/445d24.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdyCoarse/445d24.wgsl.expected.glsl new file mode 100644 index 0000000000..048d6d9d69 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyCoarse/445d24.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void dpdyCoarse_445d24() { + vec4 arg_0 = vec4(0.0f); + vec4 res = dFdy(arg_0); +} + +void fragment_main() { + dpdyCoarse_445d24(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdyCoarse/445d24.wgsl.expected.hlsl b/test/tint/builtins/gen/var/dpdyCoarse/445d24.wgsl.expected.hlsl new file mode 100644 index 0000000000..0f2904c8c0 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyCoarse/445d24.wgsl.expected.hlsl @@ -0,0 +1,9 @@ +void dpdyCoarse_445d24() { + float4 arg_0 = (0.0f).xxxx; + float4 res = ddy_coarse(arg_0); +} + +void fragment_main() { + dpdyCoarse_445d24(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdyCoarse/445d24.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdyCoarse/445d24.wgsl.expected.msl new file mode 100644 index 0000000000..17ae635ce2 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyCoarse/445d24.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void dpdyCoarse_445d24() { + float4 arg_0 = float4(0.0f); + float4 res = dfdy(arg_0); +} + +fragment void fragment_main() { + dpdyCoarse_445d24(); + return; +} + diff --git a/test/tint/builtins/gen/var/dpdyCoarse/445d24.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdyCoarse/445d24.wgsl.expected.spvasm new file mode 100644 index 0000000000..7fc9b3e886 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyCoarse/445d24.wgsl.expected.spvasm @@ -0,0 +1,35 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpCapability DerivativeControl + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %dpdyCoarse_445d24 "dpdyCoarse_445d24" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %7 = OpConstantNull %v4float +%_ptr_Function_v4float = OpTypePointer Function %v4float +%dpdyCoarse_445d24 = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %7 + %res = OpVariable %_ptr_Function_v4float Function %7 + OpStore %arg_0 %7 + %11 = OpLoad %v4float %arg_0 + %10 = OpDPdyCoarse %v4float %11 + OpStore %res %10 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %dpdyCoarse_445d24 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dpdyCoarse/445d24.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdyCoarse/445d24.wgsl.expected.wgsl new file mode 100644 index 0000000000..e1e9f85cbb --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyCoarse/445d24.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn dpdyCoarse_445d24() { + var arg_0 = vec4(); + var res : vec4 = dpdyCoarse(arg_0); +} + +@stage(fragment) +fn fragment_main() { + dpdyCoarse_445d24(); +} diff --git a/test/tint/builtins/gen/var/dpdyCoarse/870a7e.wgsl b/test/tint/builtins/gen/var/dpdyCoarse/870a7e.wgsl new file mode 100644 index 0000000000..c06358b327 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyCoarse/870a7e.wgsl @@ -0,0 +1,35 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdyCoarse(f32) -> f32 +fn dpdyCoarse_870a7e() { + var arg_0 = 1.0; + var res: f32 = dpdyCoarse(arg_0); +} + +@stage(fragment) +fn fragment_main() { + dpdyCoarse_870a7e(); +} diff --git a/test/tint/builtins/gen/var/dpdyCoarse/870a7e.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdyCoarse/870a7e.wgsl.expected.glsl new file mode 100644 index 0000000000..a0e2cd77b6 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyCoarse/870a7e.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void dpdyCoarse_870a7e() { + float arg_0 = 1.0f; + float res = dFdy(arg_0); +} + +void fragment_main() { + dpdyCoarse_870a7e(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdyCoarse/870a7e.wgsl.expected.hlsl b/test/tint/builtins/gen/var/dpdyCoarse/870a7e.wgsl.expected.hlsl new file mode 100644 index 0000000000..c5c4e1e399 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyCoarse/870a7e.wgsl.expected.hlsl @@ -0,0 +1,9 @@ +void dpdyCoarse_870a7e() { + float arg_0 = 1.0f; + float res = ddy_coarse(arg_0); +} + +void fragment_main() { + dpdyCoarse_870a7e(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdyCoarse/870a7e.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdyCoarse/870a7e.wgsl.expected.msl new file mode 100644 index 0000000000..88e086cf00 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyCoarse/870a7e.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void dpdyCoarse_870a7e() { + float arg_0 = 1.0f; + float res = dfdy(arg_0); +} + +fragment void fragment_main() { + dpdyCoarse_870a7e(); + return; +} + diff --git a/test/tint/builtins/gen/var/dpdyCoarse/870a7e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdyCoarse/870a7e.wgsl.expected.spvasm new file mode 100644 index 0000000000..b0bc403fdc --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyCoarse/870a7e.wgsl.expected.spvasm @@ -0,0 +1,35 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpCapability DerivativeControl + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %dpdyCoarse_870a7e "dpdyCoarse_870a7e" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %9 = OpConstantNull %float +%dpdyCoarse_870a7e = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %9 + %res = OpVariable %_ptr_Function_float Function %9 + OpStore %arg_0 %float_1 + %11 = OpLoad %float %arg_0 + %10 = OpDPdyCoarse %float %11 + OpStore %res %10 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %dpdyCoarse_870a7e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dpdyCoarse/870a7e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdyCoarse/870a7e.wgsl.expected.wgsl new file mode 100644 index 0000000000..a5fbe1939b --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyCoarse/870a7e.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn dpdyCoarse_870a7e() { + var arg_0 = 1.0; + var res : f32 = dpdyCoarse(arg_0); +} + +@stage(fragment) +fn fragment_main() { + dpdyCoarse_870a7e(); +} diff --git a/test/tint/builtins/gen/var/dpdyCoarse/ae1873.wgsl b/test/tint/builtins/gen/var/dpdyCoarse/ae1873.wgsl new file mode 100644 index 0000000000..120e799a87 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyCoarse/ae1873.wgsl @@ -0,0 +1,35 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdyCoarse(vec<3, f32>) -> vec<3, f32> +fn dpdyCoarse_ae1873() { + var arg_0 = vec3(); + var res: vec3 = dpdyCoarse(arg_0); +} + +@stage(fragment) +fn fragment_main() { + dpdyCoarse_ae1873(); +} diff --git a/test/tint/builtins/gen/var/dpdyCoarse/ae1873.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdyCoarse/ae1873.wgsl.expected.glsl new file mode 100644 index 0000000000..74aa42a1f2 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyCoarse/ae1873.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void dpdyCoarse_ae1873() { + vec3 arg_0 = vec3(0.0f); + vec3 res = dFdy(arg_0); +} + +void fragment_main() { + dpdyCoarse_ae1873(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdyCoarse/ae1873.wgsl.expected.hlsl b/test/tint/builtins/gen/var/dpdyCoarse/ae1873.wgsl.expected.hlsl new file mode 100644 index 0000000000..3518fc69f0 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyCoarse/ae1873.wgsl.expected.hlsl @@ -0,0 +1,9 @@ +void dpdyCoarse_ae1873() { + float3 arg_0 = (0.0f).xxx; + float3 res = ddy_coarse(arg_0); +} + +void fragment_main() { + dpdyCoarse_ae1873(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdyCoarse/ae1873.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdyCoarse/ae1873.wgsl.expected.msl new file mode 100644 index 0000000000..b24d9489b1 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyCoarse/ae1873.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void dpdyCoarse_ae1873() { + float3 arg_0 = float3(0.0f); + float3 res = dfdy(arg_0); +} + +fragment void fragment_main() { + dpdyCoarse_ae1873(); + return; +} + diff --git a/test/tint/builtins/gen/var/dpdyCoarse/ae1873.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdyCoarse/ae1873.wgsl.expected.spvasm new file mode 100644 index 0000000000..89cc4b9e13 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyCoarse/ae1873.wgsl.expected.spvasm @@ -0,0 +1,35 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpCapability DerivativeControl + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %dpdyCoarse_ae1873 "dpdyCoarse_ae1873" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %7 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float +%dpdyCoarse_ae1873 = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %7 + %res = OpVariable %_ptr_Function_v3float Function %7 + OpStore %arg_0 %7 + %11 = OpLoad %v3float %arg_0 + %10 = OpDPdyCoarse %v3float %11 + OpStore %res %10 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %dpdyCoarse_ae1873 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dpdyCoarse/ae1873.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdyCoarse/ae1873.wgsl.expected.wgsl new file mode 100644 index 0000000000..7cb6ef6a5e --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyCoarse/ae1873.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn dpdyCoarse_ae1873() { + var arg_0 = vec3(); + var res : vec3 = dpdyCoarse(arg_0); +} + +@stage(fragment) +fn fragment_main() { + dpdyCoarse_ae1873(); +} diff --git a/test/tint/builtins/gen/var/dpdyFine/1fb7ab.wgsl b/test/tint/builtins/gen/var/dpdyFine/1fb7ab.wgsl new file mode 100644 index 0000000000..14de6871fa --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyFine/1fb7ab.wgsl @@ -0,0 +1,35 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdyFine(vec<3, f32>) -> vec<3, f32> +fn dpdyFine_1fb7ab() { + var arg_0 = vec3(); + var res: vec3 = dpdyFine(arg_0); +} + +@stage(fragment) +fn fragment_main() { + dpdyFine_1fb7ab(); +} diff --git a/test/tint/builtins/gen/var/dpdyFine/1fb7ab.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdyFine/1fb7ab.wgsl.expected.glsl new file mode 100644 index 0000000000..ec2f9957cc --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyFine/1fb7ab.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void dpdyFine_1fb7ab() { + vec3 arg_0 = vec3(0.0f); + vec3 res = dFdy(arg_0); +} + +void fragment_main() { + dpdyFine_1fb7ab(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdyFine/1fb7ab.wgsl.expected.hlsl b/test/tint/builtins/gen/var/dpdyFine/1fb7ab.wgsl.expected.hlsl new file mode 100644 index 0000000000..e20864095e --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyFine/1fb7ab.wgsl.expected.hlsl @@ -0,0 +1,9 @@ +void dpdyFine_1fb7ab() { + float3 arg_0 = (0.0f).xxx; + float3 res = ddy_fine(arg_0); +} + +void fragment_main() { + dpdyFine_1fb7ab(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdyFine/1fb7ab.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdyFine/1fb7ab.wgsl.expected.msl new file mode 100644 index 0000000000..d58e455fa5 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyFine/1fb7ab.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void dpdyFine_1fb7ab() { + float3 arg_0 = float3(0.0f); + float3 res = dfdy(arg_0); +} + +fragment void fragment_main() { + dpdyFine_1fb7ab(); + return; +} + diff --git a/test/tint/builtins/gen/var/dpdyFine/1fb7ab.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdyFine/1fb7ab.wgsl.expected.spvasm new file mode 100644 index 0000000000..56521ec052 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyFine/1fb7ab.wgsl.expected.spvasm @@ -0,0 +1,35 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpCapability DerivativeControl + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %dpdyFine_1fb7ab "dpdyFine_1fb7ab" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %7 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float +%dpdyFine_1fb7ab = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %7 + %res = OpVariable %_ptr_Function_v3float Function %7 + OpStore %arg_0 %7 + %11 = OpLoad %v3float %arg_0 + %10 = OpDPdyFine %v3float %11 + OpStore %res %10 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %dpdyFine_1fb7ab + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dpdyFine/1fb7ab.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdyFine/1fb7ab.wgsl.expected.wgsl new file mode 100644 index 0000000000..a8b3457504 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyFine/1fb7ab.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn dpdyFine_1fb7ab() { + var arg_0 = vec3(); + var res : vec3 = dpdyFine(arg_0); +} + +@stage(fragment) +fn fragment_main() { + dpdyFine_1fb7ab(); +} diff --git a/test/tint/builtins/gen/var/dpdyFine/6eb673.wgsl b/test/tint/builtins/gen/var/dpdyFine/6eb673.wgsl new file mode 100644 index 0000000000..751332930e --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyFine/6eb673.wgsl @@ -0,0 +1,35 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdyFine(f32) -> f32 +fn dpdyFine_6eb673() { + var arg_0 = 1.0; + var res: f32 = dpdyFine(arg_0); +} + +@stage(fragment) +fn fragment_main() { + dpdyFine_6eb673(); +} diff --git a/test/tint/builtins/gen/var/dpdyFine/6eb673.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdyFine/6eb673.wgsl.expected.glsl new file mode 100644 index 0000000000..1762ecfe3d --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyFine/6eb673.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void dpdyFine_6eb673() { + float arg_0 = 1.0f; + float res = dFdy(arg_0); +} + +void fragment_main() { + dpdyFine_6eb673(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdyFine/6eb673.wgsl.expected.hlsl b/test/tint/builtins/gen/var/dpdyFine/6eb673.wgsl.expected.hlsl new file mode 100644 index 0000000000..ddec2103fb --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyFine/6eb673.wgsl.expected.hlsl @@ -0,0 +1,9 @@ +void dpdyFine_6eb673() { + float arg_0 = 1.0f; + float res = ddy_fine(arg_0); +} + +void fragment_main() { + dpdyFine_6eb673(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdyFine/6eb673.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdyFine/6eb673.wgsl.expected.msl new file mode 100644 index 0000000000..57adf6b9e8 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyFine/6eb673.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void dpdyFine_6eb673() { + float arg_0 = 1.0f; + float res = dfdy(arg_0); +} + +fragment void fragment_main() { + dpdyFine_6eb673(); + return; +} + diff --git a/test/tint/builtins/gen/var/dpdyFine/6eb673.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdyFine/6eb673.wgsl.expected.spvasm new file mode 100644 index 0000000000..cac131b00a --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyFine/6eb673.wgsl.expected.spvasm @@ -0,0 +1,35 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpCapability DerivativeControl + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %dpdyFine_6eb673 "dpdyFine_6eb673" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %9 = OpConstantNull %float +%dpdyFine_6eb673 = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %9 + %res = OpVariable %_ptr_Function_float Function %9 + OpStore %arg_0 %float_1 + %11 = OpLoad %float %arg_0 + %10 = OpDPdyFine %float %11 + OpStore %res %10 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %dpdyFine_6eb673 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dpdyFine/6eb673.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdyFine/6eb673.wgsl.expected.wgsl new file mode 100644 index 0000000000..b6a2e54b92 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyFine/6eb673.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn dpdyFine_6eb673() { + var arg_0 = 1.0; + var res : f32 = dpdyFine(arg_0); +} + +@stage(fragment) +fn fragment_main() { + dpdyFine_6eb673(); +} diff --git a/test/tint/builtins/gen/var/dpdyFine/d0a648.wgsl b/test/tint/builtins/gen/var/dpdyFine/d0a648.wgsl new file mode 100644 index 0000000000..ab2f873ca6 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyFine/d0a648.wgsl @@ -0,0 +1,35 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdyFine(vec<4, f32>) -> vec<4, f32> +fn dpdyFine_d0a648() { + var arg_0 = vec4(); + var res: vec4 = dpdyFine(arg_0); +} + +@stage(fragment) +fn fragment_main() { + dpdyFine_d0a648(); +} diff --git a/test/tint/builtins/gen/var/dpdyFine/d0a648.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdyFine/d0a648.wgsl.expected.glsl new file mode 100644 index 0000000000..41f6256a6b --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyFine/d0a648.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void dpdyFine_d0a648() { + vec4 arg_0 = vec4(0.0f); + vec4 res = dFdy(arg_0); +} + +void fragment_main() { + dpdyFine_d0a648(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdyFine/d0a648.wgsl.expected.hlsl b/test/tint/builtins/gen/var/dpdyFine/d0a648.wgsl.expected.hlsl new file mode 100644 index 0000000000..0384f5ce31 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyFine/d0a648.wgsl.expected.hlsl @@ -0,0 +1,9 @@ +void dpdyFine_d0a648() { + float4 arg_0 = (0.0f).xxxx; + float4 res = ddy_fine(arg_0); +} + +void fragment_main() { + dpdyFine_d0a648(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdyFine/d0a648.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdyFine/d0a648.wgsl.expected.msl new file mode 100644 index 0000000000..73afd1b1d4 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyFine/d0a648.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void dpdyFine_d0a648() { + float4 arg_0 = float4(0.0f); + float4 res = dfdy(arg_0); +} + +fragment void fragment_main() { + dpdyFine_d0a648(); + return; +} + diff --git a/test/tint/builtins/gen/var/dpdyFine/d0a648.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdyFine/d0a648.wgsl.expected.spvasm new file mode 100644 index 0000000000..4f2cf98e65 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyFine/d0a648.wgsl.expected.spvasm @@ -0,0 +1,35 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpCapability DerivativeControl + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %dpdyFine_d0a648 "dpdyFine_d0a648" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %7 = OpConstantNull %v4float +%_ptr_Function_v4float = OpTypePointer Function %v4float +%dpdyFine_d0a648 = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %7 + %res = OpVariable %_ptr_Function_v4float Function %7 + OpStore %arg_0 %7 + %11 = OpLoad %v4float %arg_0 + %10 = OpDPdyFine %v4float %11 + OpStore %res %10 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %dpdyFine_d0a648 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dpdyFine/d0a648.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdyFine/d0a648.wgsl.expected.wgsl new file mode 100644 index 0000000000..5a1f817ac0 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyFine/d0a648.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn dpdyFine_d0a648() { + var arg_0 = vec4(); + var res : vec4 = dpdyFine(arg_0); +} + +@stage(fragment) +fn fragment_main() { + dpdyFine_d0a648(); +} diff --git a/test/tint/builtins/gen/var/dpdyFine/df33aa.wgsl b/test/tint/builtins/gen/var/dpdyFine/df33aa.wgsl new file mode 100644 index 0000000000..819c688aac --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyFine/df33aa.wgsl @@ -0,0 +1,35 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdyFine(vec<2, f32>) -> vec<2, f32> +fn dpdyFine_df33aa() { + var arg_0 = vec2(); + var res: vec2 = dpdyFine(arg_0); +} + +@stage(fragment) +fn fragment_main() { + dpdyFine_df33aa(); +} diff --git a/test/tint/builtins/gen/var/dpdyFine/df33aa.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdyFine/df33aa.wgsl.expected.glsl new file mode 100644 index 0000000000..e9489e37e6 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyFine/df33aa.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void dpdyFine_df33aa() { + vec2 arg_0 = vec2(0.0f); + vec2 res = dFdy(arg_0); +} + +void fragment_main() { + dpdyFine_df33aa(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdyFine/df33aa.wgsl.expected.hlsl b/test/tint/builtins/gen/var/dpdyFine/df33aa.wgsl.expected.hlsl new file mode 100644 index 0000000000..d68bfb36df --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyFine/df33aa.wgsl.expected.hlsl @@ -0,0 +1,9 @@ +void dpdyFine_df33aa() { + float2 arg_0 = (0.0f).xx; + float2 res = ddy_fine(arg_0); +} + +void fragment_main() { + dpdyFine_df33aa(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdyFine/df33aa.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdyFine/df33aa.wgsl.expected.msl new file mode 100644 index 0000000000..6c0c0fcddc --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyFine/df33aa.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void dpdyFine_df33aa() { + float2 arg_0 = float2(0.0f); + float2 res = dfdy(arg_0); +} + +fragment void fragment_main() { + dpdyFine_df33aa(); + return; +} + diff --git a/test/tint/builtins/gen/var/dpdyFine/df33aa.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdyFine/df33aa.wgsl.expected.spvasm new file mode 100644 index 0000000000..1a9ef5b20d --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyFine/df33aa.wgsl.expected.spvasm @@ -0,0 +1,35 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpCapability DerivativeControl + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %dpdyFine_df33aa "dpdyFine_df33aa" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %7 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float +%dpdyFine_df33aa = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %7 + %res = OpVariable %_ptr_Function_v2float Function %7 + OpStore %arg_0 %7 + %11 = OpLoad %v2float %arg_0 + %10 = OpDPdyFine %v2float %11 + OpStore %res %10 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %dpdyFine_df33aa + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dpdyFine/df33aa.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdyFine/df33aa.wgsl.expected.wgsl new file mode 100644 index 0000000000..46d0d1b9ae --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyFine/df33aa.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn dpdyFine_df33aa() { + var arg_0 = vec2(); + var res : vec2 = dpdyFine(arg_0); +} + +@stage(fragment) +fn fragment_main() { + dpdyFine_df33aa(); +} diff --git a/test/tint/builtins/gen/var/exp/0f70eb.wgsl b/test/tint/builtins/gen/var/exp/0f70eb.wgsl new file mode 100644 index 0000000000..dbcfeab1ae --- /dev/null +++ b/test/tint/builtins/gen/var/exp/0f70eb.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn exp(vec<4, f32>) -> vec<4, f32> +fn exp_0f70eb() { + var arg_0 = vec4(); + var res: vec4 = exp(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + exp_0f70eb(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + exp_0f70eb(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + exp_0f70eb(); +} diff --git a/test/tint/builtins/gen/var/exp/0f70eb.wgsl.expected.glsl b/test/tint/builtins/gen/var/exp/0f70eb.wgsl.expected.glsl new file mode 100644 index 0000000000..7de8d8c417 --- /dev/null +++ b/test/tint/builtins/gen/var/exp/0f70eb.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void exp_0f70eb() { + vec4 arg_0 = vec4(0.0f); + vec4 res = exp(arg_0); +} + +vec4 vertex_main() { + exp_0f70eb(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void exp_0f70eb() { + vec4 arg_0 = vec4(0.0f); + vec4 res = exp(arg_0); +} + +void fragment_main() { + exp_0f70eb(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void exp_0f70eb() { + vec4 arg_0 = vec4(0.0f); + vec4 res = exp(arg_0); +} + +void compute_main() { + exp_0f70eb(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/exp/0f70eb.wgsl.expected.hlsl b/test/tint/builtins/gen/var/exp/0f70eb.wgsl.expected.hlsl new file mode 100644 index 0000000000..c99c41ae17 --- /dev/null +++ b/test/tint/builtins/gen/var/exp/0f70eb.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void exp_0f70eb() { + float4 arg_0 = (0.0f).xxxx; + float4 res = exp(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp_0f70eb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp_0f70eb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp_0f70eb(); + return; +} diff --git a/test/tint/builtins/gen/var/exp/0f70eb.wgsl.expected.msl b/test/tint/builtins/gen/var/exp/0f70eb.wgsl.expected.msl new file mode 100644 index 0000000000..fefd0a2757 --- /dev/null +++ b/test/tint/builtins/gen/var/exp/0f70eb.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void exp_0f70eb() { + float4 arg_0 = float4(0.0f); + float4 res = exp(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + exp_0f70eb(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + exp_0f70eb(); + return; +} + +kernel void compute_main() { + exp_0f70eb(); + return; +} + diff --git a/test/tint/builtins/gen/var/exp/0f70eb.wgsl.expected.spvasm b/test/tint/builtins/gen/var/exp/0f70eb.wgsl.expected.spvasm new file mode 100644 index 0000000000..18b79bb925 --- /dev/null +++ b/test/tint/builtins/gen/var/exp/0f70eb.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %exp_0f70eb "exp_0f70eb" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %exp_0f70eb = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %5 + %17 = OpLoad %v4float %arg_0 + %15 = OpExtInst %v4float %16 Exp %17 + OpStore %res %15 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %exp_0f70eb + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %exp_0f70eb + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %exp_0f70eb + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/exp/0f70eb.wgsl.expected.wgsl b/test/tint/builtins/gen/var/exp/0f70eb.wgsl.expected.wgsl new file mode 100644 index 0000000000..9c62eea0c9 --- /dev/null +++ b/test/tint/builtins/gen/var/exp/0f70eb.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn exp_0f70eb() { + var arg_0 = vec4(); + var res : vec4 = exp(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + exp_0f70eb(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + exp_0f70eb(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + exp_0f70eb(); +} diff --git a/test/tint/builtins/gen/var/exp/1951e7.wgsl b/test/tint/builtins/gen/var/exp/1951e7.wgsl new file mode 100644 index 0000000000..9517b8403a --- /dev/null +++ b/test/tint/builtins/gen/var/exp/1951e7.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn exp(vec<2, f32>) -> vec<2, f32> +fn exp_1951e7() { + var arg_0 = vec2(); + var res: vec2 = exp(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + exp_1951e7(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + exp_1951e7(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + exp_1951e7(); +} diff --git a/test/tint/builtins/gen/var/exp/1951e7.wgsl.expected.glsl b/test/tint/builtins/gen/var/exp/1951e7.wgsl.expected.glsl new file mode 100644 index 0000000000..159debe91f --- /dev/null +++ b/test/tint/builtins/gen/var/exp/1951e7.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void exp_1951e7() { + vec2 arg_0 = vec2(0.0f); + vec2 res = exp(arg_0); +} + +vec4 vertex_main() { + exp_1951e7(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void exp_1951e7() { + vec2 arg_0 = vec2(0.0f); + vec2 res = exp(arg_0); +} + +void fragment_main() { + exp_1951e7(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void exp_1951e7() { + vec2 arg_0 = vec2(0.0f); + vec2 res = exp(arg_0); +} + +void compute_main() { + exp_1951e7(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/exp/1951e7.wgsl.expected.hlsl b/test/tint/builtins/gen/var/exp/1951e7.wgsl.expected.hlsl new file mode 100644 index 0000000000..b809cecfb5 --- /dev/null +++ b/test/tint/builtins/gen/var/exp/1951e7.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void exp_1951e7() { + float2 arg_0 = (0.0f).xx; + float2 res = exp(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp_1951e7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp_1951e7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp_1951e7(); + return; +} diff --git a/test/tint/builtins/gen/var/exp/1951e7.wgsl.expected.msl b/test/tint/builtins/gen/var/exp/1951e7.wgsl.expected.msl new file mode 100644 index 0000000000..3b0e694012 --- /dev/null +++ b/test/tint/builtins/gen/var/exp/1951e7.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void exp_1951e7() { + float2 arg_0 = float2(0.0f); + float2 res = exp(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + exp_1951e7(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + exp_1951e7(); + return; +} + +kernel void compute_main() { + exp_1951e7(); + return; +} + diff --git a/test/tint/builtins/gen/var/exp/1951e7.wgsl.expected.spvasm b/test/tint/builtins/gen/var/exp/1951e7.wgsl.expected.spvasm new file mode 100644 index 0000000000..83e21b7a53 --- /dev/null +++ b/test/tint/builtins/gen/var/exp/1951e7.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %exp_1951e7 "exp_1951e7" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %14 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %exp_1951e7 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %14 + %res = OpVariable %_ptr_Function_v2float Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %v2float %arg_0 + %17 = OpExtInst %v2float %18 Exp %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %exp_1951e7 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %exp_1951e7 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %exp_1951e7 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/exp/1951e7.wgsl.expected.wgsl b/test/tint/builtins/gen/var/exp/1951e7.wgsl.expected.wgsl new file mode 100644 index 0000000000..22c08d91d7 --- /dev/null +++ b/test/tint/builtins/gen/var/exp/1951e7.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn exp_1951e7() { + var arg_0 = vec2(); + var res : vec2 = exp(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + exp_1951e7(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + exp_1951e7(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + exp_1951e7(); +} diff --git a/test/tint/builtins/gen/var/exp/771fd2.wgsl b/test/tint/builtins/gen/var/exp/771fd2.wgsl new file mode 100644 index 0000000000..8ee0c82068 --- /dev/null +++ b/test/tint/builtins/gen/var/exp/771fd2.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn exp(f32) -> f32 +fn exp_771fd2() { + var arg_0 = 1.0; + var res: f32 = exp(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + exp_771fd2(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + exp_771fd2(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + exp_771fd2(); +} diff --git a/test/tint/builtins/gen/var/exp/771fd2.wgsl.expected.glsl b/test/tint/builtins/gen/var/exp/771fd2.wgsl.expected.glsl new file mode 100644 index 0000000000..3c874f6191 --- /dev/null +++ b/test/tint/builtins/gen/var/exp/771fd2.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void exp_771fd2() { + float arg_0 = 1.0f; + float res = exp(arg_0); +} + +vec4 vertex_main() { + exp_771fd2(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void exp_771fd2() { + float arg_0 = 1.0f; + float res = exp(arg_0); +} + +void fragment_main() { + exp_771fd2(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void exp_771fd2() { + float arg_0 = 1.0f; + float res = exp(arg_0); +} + +void compute_main() { + exp_771fd2(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/exp/771fd2.wgsl.expected.hlsl b/test/tint/builtins/gen/var/exp/771fd2.wgsl.expected.hlsl new file mode 100644 index 0000000000..578cedb5ce --- /dev/null +++ b/test/tint/builtins/gen/var/exp/771fd2.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void exp_771fd2() { + float arg_0 = 1.0f; + float res = exp(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp_771fd2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp_771fd2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp_771fd2(); + return; +} diff --git a/test/tint/builtins/gen/var/exp/771fd2.wgsl.expected.msl b/test/tint/builtins/gen/var/exp/771fd2.wgsl.expected.msl new file mode 100644 index 0000000000..0e3c093e4f --- /dev/null +++ b/test/tint/builtins/gen/var/exp/771fd2.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void exp_771fd2() { + float arg_0 = 1.0f; + float res = exp(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + exp_771fd2(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + exp_771fd2(); + return; +} + +kernel void compute_main() { + exp_771fd2(); + return; +} + diff --git a/test/tint/builtins/gen/var/exp/771fd2.wgsl.expected.spvasm b/test/tint/builtins/gen/var/exp/771fd2.wgsl.expected.spvasm new file mode 100644 index 0000000000..83173a6e58 --- /dev/null +++ b/test/tint/builtins/gen/var/exp/771fd2.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %exp_771fd2 "exp_771fd2" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %20 = OpTypeFunction %v4float + %exp_771fd2 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + %18 = OpLoad %float %arg_0 + %16 = OpExtInst %float %17 Exp %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %exp_771fd2 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %exp_771fd2 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %exp_771fd2 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/exp/771fd2.wgsl.expected.wgsl b/test/tint/builtins/gen/var/exp/771fd2.wgsl.expected.wgsl new file mode 100644 index 0000000000..892fa9726c --- /dev/null +++ b/test/tint/builtins/gen/var/exp/771fd2.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn exp_771fd2() { + var arg_0 = 1.0; + var res : f32 = exp(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + exp_771fd2(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + exp_771fd2(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + exp_771fd2(); +} diff --git a/test/tint/builtins/gen/var/exp/d98450.wgsl b/test/tint/builtins/gen/var/exp/d98450.wgsl new file mode 100644 index 0000000000..fae8a40c38 --- /dev/null +++ b/test/tint/builtins/gen/var/exp/d98450.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn exp(vec<3, f32>) -> vec<3, f32> +fn exp_d98450() { + var arg_0 = vec3(); + var res: vec3 = exp(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + exp_d98450(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + exp_d98450(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + exp_d98450(); +} diff --git a/test/tint/builtins/gen/var/exp/d98450.wgsl.expected.glsl b/test/tint/builtins/gen/var/exp/d98450.wgsl.expected.glsl new file mode 100644 index 0000000000..495a77ad2d --- /dev/null +++ b/test/tint/builtins/gen/var/exp/d98450.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void exp_d98450() { + vec3 arg_0 = vec3(0.0f); + vec3 res = exp(arg_0); +} + +vec4 vertex_main() { + exp_d98450(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void exp_d98450() { + vec3 arg_0 = vec3(0.0f); + vec3 res = exp(arg_0); +} + +void fragment_main() { + exp_d98450(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void exp_d98450() { + vec3 arg_0 = vec3(0.0f); + vec3 res = exp(arg_0); +} + +void compute_main() { + exp_d98450(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/exp/d98450.wgsl.expected.hlsl b/test/tint/builtins/gen/var/exp/d98450.wgsl.expected.hlsl new file mode 100644 index 0000000000..090d2fc4df --- /dev/null +++ b/test/tint/builtins/gen/var/exp/d98450.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void exp_d98450() { + float3 arg_0 = (0.0f).xxx; + float3 res = exp(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp_d98450(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp_d98450(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp_d98450(); + return; +} diff --git a/test/tint/builtins/gen/var/exp/d98450.wgsl.expected.msl b/test/tint/builtins/gen/var/exp/d98450.wgsl.expected.msl new file mode 100644 index 0000000000..3dcaac10a3 --- /dev/null +++ b/test/tint/builtins/gen/var/exp/d98450.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void exp_d98450() { + float3 arg_0 = float3(0.0f); + float3 res = exp(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + exp_d98450(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + exp_d98450(); + return; +} + +kernel void compute_main() { + exp_d98450(); + return; +} + diff --git a/test/tint/builtins/gen/var/exp/d98450.wgsl.expected.spvasm b/test/tint/builtins/gen/var/exp/d98450.wgsl.expected.spvasm new file mode 100644 index 0000000000..905659e3ec --- /dev/null +++ b/test/tint/builtins/gen/var/exp/d98450.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %exp_d98450 "exp_d98450" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %14 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %exp_d98450 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %14 + %res = OpVariable %_ptr_Function_v3float Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %v3float %arg_0 + %17 = OpExtInst %v3float %18 Exp %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %exp_d98450 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %exp_d98450 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %exp_d98450 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/exp/d98450.wgsl.expected.wgsl b/test/tint/builtins/gen/var/exp/d98450.wgsl.expected.wgsl new file mode 100644 index 0000000000..9cb0d52d3d --- /dev/null +++ b/test/tint/builtins/gen/var/exp/d98450.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn exp_d98450() { + var arg_0 = vec3(); + var res : vec3 = exp(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + exp_d98450(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + exp_d98450(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + exp_d98450(); +} diff --git a/test/tint/builtins/gen/var/exp2/1f8680.wgsl b/test/tint/builtins/gen/var/exp2/1f8680.wgsl new file mode 100644 index 0000000000..60cc0e74b8 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/1f8680.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn exp2(vec<3, f32>) -> vec<3, f32> +fn exp2_1f8680() { + var arg_0 = vec3(); + var res: vec3 = exp2(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + exp2_1f8680(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + exp2_1f8680(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + exp2_1f8680(); +} diff --git a/test/tint/builtins/gen/var/exp2/1f8680.wgsl.expected.glsl b/test/tint/builtins/gen/var/exp2/1f8680.wgsl.expected.glsl new file mode 100644 index 0000000000..0cb5d7a4a1 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/1f8680.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void exp2_1f8680() { + vec3 arg_0 = vec3(0.0f); + vec3 res = exp2(arg_0); +} + +vec4 vertex_main() { + exp2_1f8680(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void exp2_1f8680() { + vec3 arg_0 = vec3(0.0f); + vec3 res = exp2(arg_0); +} + +void fragment_main() { + exp2_1f8680(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void exp2_1f8680() { + vec3 arg_0 = vec3(0.0f); + vec3 res = exp2(arg_0); +} + +void compute_main() { + exp2_1f8680(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/exp2/1f8680.wgsl.expected.hlsl b/test/tint/builtins/gen/var/exp2/1f8680.wgsl.expected.hlsl new file mode 100644 index 0000000000..5265000f00 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/1f8680.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void exp2_1f8680() { + float3 arg_0 = (0.0f).xxx; + float3 res = exp2(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp2_1f8680(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp2_1f8680(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp2_1f8680(); + return; +} diff --git a/test/tint/builtins/gen/var/exp2/1f8680.wgsl.expected.msl b/test/tint/builtins/gen/var/exp2/1f8680.wgsl.expected.msl new file mode 100644 index 0000000000..85188c44a6 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/1f8680.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void exp2_1f8680() { + float3 arg_0 = float3(0.0f); + float3 res = exp2(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + exp2_1f8680(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + exp2_1f8680(); + return; +} + +kernel void compute_main() { + exp2_1f8680(); + return; +} + diff --git a/test/tint/builtins/gen/var/exp2/1f8680.wgsl.expected.spvasm b/test/tint/builtins/gen/var/exp2/1f8680.wgsl.expected.spvasm new file mode 100644 index 0000000000..efcb2f9c12 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/1f8680.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %exp2_1f8680 "exp2_1f8680" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %14 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%exp2_1f8680 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %14 + %res = OpVariable %_ptr_Function_v3float Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %v3float %arg_0 + %17 = OpExtInst %v3float %18 Exp2 %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %exp2_1f8680 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %exp2_1f8680 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %exp2_1f8680 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/exp2/1f8680.wgsl.expected.wgsl b/test/tint/builtins/gen/var/exp2/1f8680.wgsl.expected.wgsl new file mode 100644 index 0000000000..1311b3f045 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/1f8680.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn exp2_1f8680() { + var arg_0 = vec3(); + var res : vec3 = exp2(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + exp2_1f8680(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + exp2_1f8680(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + exp2_1f8680(); +} diff --git a/test/tint/builtins/gen/var/exp2/a9d0a7.wgsl b/test/tint/builtins/gen/var/exp2/a9d0a7.wgsl new file mode 100644 index 0000000000..918930b7a3 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/a9d0a7.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn exp2(vec<4, f32>) -> vec<4, f32> +fn exp2_a9d0a7() { + var arg_0 = vec4(); + var res: vec4 = exp2(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + exp2_a9d0a7(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + exp2_a9d0a7(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + exp2_a9d0a7(); +} diff --git a/test/tint/builtins/gen/var/exp2/a9d0a7.wgsl.expected.glsl b/test/tint/builtins/gen/var/exp2/a9d0a7.wgsl.expected.glsl new file mode 100644 index 0000000000..bbf87b31ea --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/a9d0a7.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void exp2_a9d0a7() { + vec4 arg_0 = vec4(0.0f); + vec4 res = exp2(arg_0); +} + +vec4 vertex_main() { + exp2_a9d0a7(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void exp2_a9d0a7() { + vec4 arg_0 = vec4(0.0f); + vec4 res = exp2(arg_0); +} + +void fragment_main() { + exp2_a9d0a7(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void exp2_a9d0a7() { + vec4 arg_0 = vec4(0.0f); + vec4 res = exp2(arg_0); +} + +void compute_main() { + exp2_a9d0a7(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/exp2/a9d0a7.wgsl.expected.hlsl b/test/tint/builtins/gen/var/exp2/a9d0a7.wgsl.expected.hlsl new file mode 100644 index 0000000000..9223653db8 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/a9d0a7.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void exp2_a9d0a7() { + float4 arg_0 = (0.0f).xxxx; + float4 res = exp2(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp2_a9d0a7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp2_a9d0a7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp2_a9d0a7(); + return; +} diff --git a/test/tint/builtins/gen/var/exp2/a9d0a7.wgsl.expected.msl b/test/tint/builtins/gen/var/exp2/a9d0a7.wgsl.expected.msl new file mode 100644 index 0000000000..ee5cb73ed2 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/a9d0a7.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void exp2_a9d0a7() { + float4 arg_0 = float4(0.0f); + float4 res = exp2(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + exp2_a9d0a7(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + exp2_a9d0a7(); + return; +} + +kernel void compute_main() { + exp2_a9d0a7(); + return; +} + diff --git a/test/tint/builtins/gen/var/exp2/a9d0a7.wgsl.expected.spvasm b/test/tint/builtins/gen/var/exp2/a9d0a7.wgsl.expected.spvasm new file mode 100644 index 0000000000..eab9cbe9cf --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/a9d0a7.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %exp2_a9d0a7 "exp2_a9d0a7" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%exp2_a9d0a7 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %5 + %17 = OpLoad %v4float %arg_0 + %15 = OpExtInst %v4float %16 Exp2 %17 + OpStore %res %15 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %exp2_a9d0a7 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %exp2_a9d0a7 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %exp2_a9d0a7 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/exp2/a9d0a7.wgsl.expected.wgsl b/test/tint/builtins/gen/var/exp2/a9d0a7.wgsl.expected.wgsl new file mode 100644 index 0000000000..db5f690815 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/a9d0a7.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn exp2_a9d0a7() { + var arg_0 = vec4(); + var res : vec4 = exp2(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + exp2_a9d0a7(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + exp2_a9d0a7(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + exp2_a9d0a7(); +} diff --git a/test/tint/builtins/gen/var/exp2/d6777c.wgsl b/test/tint/builtins/gen/var/exp2/d6777c.wgsl new file mode 100644 index 0000000000..6f77edca80 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/d6777c.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn exp2(vec<2, f32>) -> vec<2, f32> +fn exp2_d6777c() { + var arg_0 = vec2(); + var res: vec2 = exp2(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + exp2_d6777c(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + exp2_d6777c(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + exp2_d6777c(); +} diff --git a/test/tint/builtins/gen/var/exp2/d6777c.wgsl.expected.glsl b/test/tint/builtins/gen/var/exp2/d6777c.wgsl.expected.glsl new file mode 100644 index 0000000000..cc18345665 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/d6777c.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void exp2_d6777c() { + vec2 arg_0 = vec2(0.0f); + vec2 res = exp2(arg_0); +} + +vec4 vertex_main() { + exp2_d6777c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void exp2_d6777c() { + vec2 arg_0 = vec2(0.0f); + vec2 res = exp2(arg_0); +} + +void fragment_main() { + exp2_d6777c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void exp2_d6777c() { + vec2 arg_0 = vec2(0.0f); + vec2 res = exp2(arg_0); +} + +void compute_main() { + exp2_d6777c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/exp2/d6777c.wgsl.expected.hlsl b/test/tint/builtins/gen/var/exp2/d6777c.wgsl.expected.hlsl new file mode 100644 index 0000000000..487bb0ac28 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/d6777c.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void exp2_d6777c() { + float2 arg_0 = (0.0f).xx; + float2 res = exp2(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp2_d6777c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp2_d6777c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp2_d6777c(); + return; +} diff --git a/test/tint/builtins/gen/var/exp2/d6777c.wgsl.expected.msl b/test/tint/builtins/gen/var/exp2/d6777c.wgsl.expected.msl new file mode 100644 index 0000000000..dcda2879fc --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/d6777c.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void exp2_d6777c() { + float2 arg_0 = float2(0.0f); + float2 res = exp2(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + exp2_d6777c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + exp2_d6777c(); + return; +} + +kernel void compute_main() { + exp2_d6777c(); + return; +} + diff --git a/test/tint/builtins/gen/var/exp2/d6777c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/exp2/d6777c.wgsl.expected.spvasm new file mode 100644 index 0000000000..8902f1bd43 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/d6777c.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %exp2_d6777c "exp2_d6777c" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %14 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%exp2_d6777c = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %14 + %res = OpVariable %_ptr_Function_v2float Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %v2float %arg_0 + %17 = OpExtInst %v2float %18 Exp2 %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %exp2_d6777c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %exp2_d6777c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %exp2_d6777c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/exp2/d6777c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/exp2/d6777c.wgsl.expected.wgsl new file mode 100644 index 0000000000..e78ca2e99e --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/d6777c.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn exp2_d6777c() { + var arg_0 = vec2(); + var res : vec2 = exp2(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + exp2_d6777c(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + exp2_d6777c(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + exp2_d6777c(); +} diff --git a/test/tint/builtins/gen/var/exp2/dea523.wgsl b/test/tint/builtins/gen/var/exp2/dea523.wgsl new file mode 100644 index 0000000000..434d0f6fe9 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/dea523.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn exp2(f32) -> f32 +fn exp2_dea523() { + var arg_0 = 1.0; + var res: f32 = exp2(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + exp2_dea523(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + exp2_dea523(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + exp2_dea523(); +} diff --git a/test/tint/builtins/gen/var/exp2/dea523.wgsl.expected.glsl b/test/tint/builtins/gen/var/exp2/dea523.wgsl.expected.glsl new file mode 100644 index 0000000000..0599396c99 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/dea523.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void exp2_dea523() { + float arg_0 = 1.0f; + float res = exp2(arg_0); +} + +vec4 vertex_main() { + exp2_dea523(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void exp2_dea523() { + float arg_0 = 1.0f; + float res = exp2(arg_0); +} + +void fragment_main() { + exp2_dea523(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void exp2_dea523() { + float arg_0 = 1.0f; + float res = exp2(arg_0); +} + +void compute_main() { + exp2_dea523(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/exp2/dea523.wgsl.expected.hlsl b/test/tint/builtins/gen/var/exp2/dea523.wgsl.expected.hlsl new file mode 100644 index 0000000000..d276db9823 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/dea523.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void exp2_dea523() { + float arg_0 = 1.0f; + float res = exp2(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp2_dea523(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp2_dea523(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp2_dea523(); + return; +} diff --git a/test/tint/builtins/gen/var/exp2/dea523.wgsl.expected.msl b/test/tint/builtins/gen/var/exp2/dea523.wgsl.expected.msl new file mode 100644 index 0000000000..38c0029036 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/dea523.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void exp2_dea523() { + float arg_0 = 1.0f; + float res = exp2(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + exp2_dea523(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + exp2_dea523(); + return; +} + +kernel void compute_main() { + exp2_dea523(); + return; +} + diff --git a/test/tint/builtins/gen/var/exp2/dea523.wgsl.expected.spvasm b/test/tint/builtins/gen/var/exp2/dea523.wgsl.expected.spvasm new file mode 100644 index 0000000000..b350153939 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/dea523.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %exp2_dea523 "exp2_dea523" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %20 = OpTypeFunction %v4float +%exp2_dea523 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + %18 = OpLoad %float %arg_0 + %16 = OpExtInst %float %17 Exp2 %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %exp2_dea523 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %exp2_dea523 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %exp2_dea523 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/exp2/dea523.wgsl.expected.wgsl b/test/tint/builtins/gen/var/exp2/dea523.wgsl.expected.wgsl new file mode 100644 index 0000000000..f47e367cbb --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/dea523.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn exp2_dea523() { + var arg_0 = 1.0; + var res : f32 = exp2(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + exp2_dea523(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + exp2_dea523(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + exp2_dea523(); +} diff --git a/test/tint/builtins/gen/var/extractBits/12b197.wgsl b/test/tint/builtins/gen/var/extractBits/12b197.wgsl new file mode 100644 index 0000000000..75d988bda1 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/12b197.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn extractBits(vec<3, u32>, u32, u32) -> vec<3, u32> +fn extractBits_12b197() { + var arg_0 = vec3(); + var arg_1 = 1u; + var arg_2 = 1u; + var res: vec3 = extractBits(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + extractBits_12b197(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + extractBits_12b197(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + extractBits_12b197(); +} diff --git a/test/tint/builtins/gen/var/extractBits/12b197.wgsl.expected.glsl b/test/tint/builtins/gen/var/extractBits/12b197.wgsl.expected.glsl new file mode 100644 index 0000000000..3ad6ce84d7 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/12b197.wgsl.expected.glsl @@ -0,0 +1,76 @@ +#version 310 es + +uvec3 tint_extract_bits(uvec3 v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_12b197() { + uvec3 arg_0 = uvec3(0u); + uint arg_1 = 1u; + uint arg_2 = 1u; + uvec3 res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + extractBits_12b197(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uvec3 tint_extract_bits(uvec3 v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_12b197() { + uvec3 arg_0 = uvec3(0u); + uint arg_1 = 1u; + uint arg_2 = 1u; + uvec3 res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +void fragment_main() { + extractBits_12b197(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uvec3 tint_extract_bits(uvec3 v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_12b197() { + uvec3 arg_0 = uvec3(0u); + uint arg_1 = 1u; + uint arg_2 = 1u; + uvec3 res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +void compute_main() { + extractBits_12b197(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/extractBits/12b197.wgsl.expected.hlsl b/test/tint/builtins/gen/var/extractBits/12b197.wgsl.expected.hlsl new file mode 100644 index 0000000000..bfd2b857b5 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/12b197.wgsl.expected.hlsl @@ -0,0 +1,41 @@ +uint3 tint_extract_bits(uint3 v, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint shl = (32u - e); + const uint shr = (shl + s); + return ((v << uint3((shl).xxx)) >> uint3((shr).xxx)); +} + +void extractBits_12b197() { + uint3 arg_0 = (0u).xxx; + uint arg_1 = 1u; + uint arg_2 = 1u; + uint3 res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + extractBits_12b197(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + extractBits_12b197(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + extractBits_12b197(); + return; +} diff --git a/test/tint/builtins/gen/var/extractBits/12b197.wgsl.expected.msl b/test/tint/builtins/gen/var/extractBits/12b197.wgsl.expected.msl new file mode 100644 index 0000000000..74f5767824 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/12b197.wgsl.expected.msl @@ -0,0 +1,42 @@ +#include + +using namespace metal; +uint3 tint_extract_bits(uint3 v, uint offset, uint count) { + uint const s = min(offset, 32u); + uint const e = min(32u, (s + count)); + return extract_bits(v, s, (e - s)); +} + +void extractBits_12b197() { + uint3 arg_0 = uint3(0u); + uint arg_1 = 1u; + uint arg_2 = 1u; + uint3 res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + extractBits_12b197(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + extractBits_12b197(); + return; +} + +kernel void compute_main() { + extractBits_12b197(); + return; +} + diff --git a/test/tint/builtins/gen/var/extractBits/12b197.wgsl.expected.spvasm b/test/tint/builtins/gen/var/extractBits/12b197.wgsl.expected.spvasm new file mode 100644 index 0000000000..e436392234 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/12b197.wgsl.expected.spvasm @@ -0,0 +1,101 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 55 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_extract_bits "tint_extract_bits" + OpName %v "v" + OpName %offset "offset" + OpName %count "count" + OpName %extractBits_12b197 "extractBits_12b197" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %9 = OpTypeFunction %v3uint %v3uint %uint %uint + %uint_32 = OpConstant %uint 32 + %void = OpTypeVoid + %24 = OpTypeFunction %void + %28 = OpConstantNull %v3uint +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %34 = OpConstantNull %uint + %41 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_extract_bits = OpFunction %v3uint None %9 + %v = OpFunctionParameter %v3uint + %offset = OpFunctionParameter %uint + %count = OpFunctionParameter %uint + %16 = OpLabel + %17 = OpExtInst %uint %18 UMin %offset %uint_32 + %21 = OpIAdd %uint %17 %count + %20 = OpExtInst %uint %18 UMin %uint_32 %21 + %23 = OpISub %uint %20 %17 + %22 = OpBitFieldUExtract %v3uint %v %17 %23 + OpReturnValue %22 + OpFunctionEnd +%extractBits_12b197 = OpFunction %void None %24 + %27 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3uint Function %28 + %arg_1 = OpVariable %_ptr_Function_uint Function %34 + %arg_2 = OpVariable %_ptr_Function_uint Function %34 + %res = OpVariable %_ptr_Function_v3uint Function %28 + OpStore %arg_0 %28 + OpStore %arg_1 %uint_1 + OpStore %arg_2 %uint_1 + %37 = OpLoad %v3uint %arg_0 + %38 = OpLoad %uint %arg_1 + %39 = OpLoad %uint %arg_2 + %36 = OpFunctionCall %v3uint %tint_extract_bits %37 %38 %39 + OpStore %res %36 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %41 + %43 = OpLabel + %44 = OpFunctionCall %void %extractBits_12b197 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %24 + %46 = OpLabel + %47 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %47 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %24 + %50 = OpLabel + %51 = OpFunctionCall %void %extractBits_12b197 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %24 + %53 = OpLabel + %54 = OpFunctionCall %void %extractBits_12b197 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/extractBits/12b197.wgsl.expected.wgsl b/test/tint/builtins/gen/var/extractBits/12b197.wgsl.expected.wgsl new file mode 100644 index 0000000000..8aa910c139 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/12b197.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn extractBits_12b197() { + var arg_0 = vec3(); + var arg_1 = 1u; + var arg_2 = 1u; + var res : vec3 = extractBits(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + extractBits_12b197(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + extractBits_12b197(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + extractBits_12b197(); +} diff --git a/test/tint/builtins/gen/var/extractBits/249874.wgsl b/test/tint/builtins/gen/var/extractBits/249874.wgsl new file mode 100644 index 0000000000..58d08773e6 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/249874.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn extractBits(i32, u32, u32) -> i32 +fn extractBits_249874() { + var arg_0 = 1; + var arg_1 = 1u; + var arg_2 = 1u; + var res: i32 = extractBits(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + extractBits_249874(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + extractBits_249874(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + extractBits_249874(); +} diff --git a/test/tint/builtins/gen/var/extractBits/249874.wgsl.expected.glsl b/test/tint/builtins/gen/var/extractBits/249874.wgsl.expected.glsl new file mode 100644 index 0000000000..1c7b829a1f --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/249874.wgsl.expected.glsl @@ -0,0 +1,76 @@ +#version 310 es + +int tint_extract_bits(int v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_249874() { + int arg_0 = 1; + uint arg_1 = 1u; + uint arg_2 = 1u; + int res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + extractBits_249874(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +int tint_extract_bits(int v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_249874() { + int arg_0 = 1; + uint arg_1 = 1u; + uint arg_2 = 1u; + int res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +void fragment_main() { + extractBits_249874(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +int tint_extract_bits(int v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_249874() { + int arg_0 = 1; + uint arg_1 = 1u; + uint arg_2 = 1u; + int res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +void compute_main() { + extractBits_249874(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/extractBits/249874.wgsl.expected.hlsl b/test/tint/builtins/gen/var/extractBits/249874.wgsl.expected.hlsl new file mode 100644 index 0000000000..bd0e6fe47e --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/249874.wgsl.expected.hlsl @@ -0,0 +1,41 @@ +int tint_extract_bits(int v, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint shl = (32u - e); + const uint shr = (shl + s); + return ((v << shl) >> shr); +} + +void extractBits_249874() { + int arg_0 = 1; + uint arg_1 = 1u; + uint arg_2 = 1u; + int res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + extractBits_249874(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + extractBits_249874(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + extractBits_249874(); + return; +} diff --git a/test/tint/builtins/gen/var/extractBits/249874.wgsl.expected.msl b/test/tint/builtins/gen/var/extractBits/249874.wgsl.expected.msl new file mode 100644 index 0000000000..fe768fe5d1 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/249874.wgsl.expected.msl @@ -0,0 +1,42 @@ +#include + +using namespace metal; +int tint_extract_bits(int v, uint offset, uint count) { + uint const s = min(offset, 32u); + uint const e = min(32u, (s + count)); + return extract_bits(v, s, (e - s)); +} + +void extractBits_249874() { + int arg_0 = 1; + uint arg_1 = 1u; + uint arg_2 = 1u; + int res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + extractBits_249874(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + extractBits_249874(); + return; +} + +kernel void compute_main() { + extractBits_249874(); + return; +} + diff --git a/test/tint/builtins/gen/var/extractBits/249874.wgsl.expected.spvasm b/test/tint/builtins/gen/var/extractBits/249874.wgsl.expected.spvasm new file mode 100644 index 0000000000..8b8dc87c52 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/249874.wgsl.expected.spvasm @@ -0,0 +1,102 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 56 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_extract_bits "tint_extract_bits" + OpName %v "v" + OpName %offset "offset" + OpName %count "count" + OpName %extractBits_249874 "extractBits_249874" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %9 = OpTypeFunction %int %int %uint %uint + %uint_32 = OpConstant %uint 32 + %void = OpTypeVoid + %24 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %31 = OpConstantNull %int + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %35 = OpConstantNull %uint + %42 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_extract_bits = OpFunction %int None %9 + %v = OpFunctionParameter %int + %offset = OpFunctionParameter %uint + %count = OpFunctionParameter %uint + %16 = OpLabel + %17 = OpExtInst %uint %18 UMin %offset %uint_32 + %21 = OpIAdd %uint %17 %count + %20 = OpExtInst %uint %18 UMin %uint_32 %21 + %23 = OpISub %uint %20 %17 + %22 = OpBitFieldSExtract %int %v %17 %23 + OpReturnValue %22 + OpFunctionEnd +%extractBits_249874 = OpFunction %void None %24 + %27 = OpLabel + %arg_0 = OpVariable %_ptr_Function_int Function %31 + %arg_1 = OpVariable %_ptr_Function_uint Function %35 + %arg_2 = OpVariable %_ptr_Function_uint Function %35 + %res = OpVariable %_ptr_Function_int Function %31 + OpStore %arg_0 %int_1 + OpStore %arg_1 %uint_1 + OpStore %arg_2 %uint_1 + %38 = OpLoad %int %arg_0 + %39 = OpLoad %uint %arg_1 + %40 = OpLoad %uint %arg_2 + %37 = OpFunctionCall %int %tint_extract_bits %38 %39 %40 + OpStore %res %37 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %42 + %44 = OpLabel + %45 = OpFunctionCall %void %extractBits_249874 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %24 + %47 = OpLabel + %48 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %48 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %24 + %51 = OpLabel + %52 = OpFunctionCall %void %extractBits_249874 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %24 + %54 = OpLabel + %55 = OpFunctionCall %void %extractBits_249874 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/extractBits/249874.wgsl.expected.wgsl b/test/tint/builtins/gen/var/extractBits/249874.wgsl.expected.wgsl new file mode 100644 index 0000000000..a7a2804c17 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/249874.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn extractBits_249874() { + var arg_0 = 1; + var arg_1 = 1u; + var arg_2 = 1u; + var res : i32 = extractBits(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + extractBits_249874(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + extractBits_249874(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + extractBits_249874(); +} diff --git a/test/tint/builtins/gen/var/extractBits/631377.wgsl b/test/tint/builtins/gen/var/extractBits/631377.wgsl new file mode 100644 index 0000000000..3785159646 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/631377.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn extractBits(vec<4, u32>, u32, u32) -> vec<4, u32> +fn extractBits_631377() { + var arg_0 = vec4(); + var arg_1 = 1u; + var arg_2 = 1u; + var res: vec4 = extractBits(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + extractBits_631377(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + extractBits_631377(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + extractBits_631377(); +} diff --git a/test/tint/builtins/gen/var/extractBits/631377.wgsl.expected.glsl b/test/tint/builtins/gen/var/extractBits/631377.wgsl.expected.glsl new file mode 100644 index 0000000000..ecb1aac35e --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/631377.wgsl.expected.glsl @@ -0,0 +1,76 @@ +#version 310 es + +uvec4 tint_extract_bits(uvec4 v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_631377() { + uvec4 arg_0 = uvec4(0u); + uint arg_1 = 1u; + uint arg_2 = 1u; + uvec4 res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + extractBits_631377(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uvec4 tint_extract_bits(uvec4 v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_631377() { + uvec4 arg_0 = uvec4(0u); + uint arg_1 = 1u; + uint arg_2 = 1u; + uvec4 res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +void fragment_main() { + extractBits_631377(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uvec4 tint_extract_bits(uvec4 v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_631377() { + uvec4 arg_0 = uvec4(0u); + uint arg_1 = 1u; + uint arg_2 = 1u; + uvec4 res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +void compute_main() { + extractBits_631377(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/extractBits/631377.wgsl.expected.hlsl b/test/tint/builtins/gen/var/extractBits/631377.wgsl.expected.hlsl new file mode 100644 index 0000000000..6ee22caf24 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/631377.wgsl.expected.hlsl @@ -0,0 +1,41 @@ +uint4 tint_extract_bits(uint4 v, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint shl = (32u - e); + const uint shr = (shl + s); + return ((v << uint4((shl).xxxx)) >> uint4((shr).xxxx)); +} + +void extractBits_631377() { + uint4 arg_0 = (0u).xxxx; + uint arg_1 = 1u; + uint arg_2 = 1u; + uint4 res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + extractBits_631377(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + extractBits_631377(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + extractBits_631377(); + return; +} diff --git a/test/tint/builtins/gen/var/extractBits/631377.wgsl.expected.msl b/test/tint/builtins/gen/var/extractBits/631377.wgsl.expected.msl new file mode 100644 index 0000000000..b19cf254be --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/631377.wgsl.expected.msl @@ -0,0 +1,42 @@ +#include + +using namespace metal; +uint4 tint_extract_bits(uint4 v, uint offset, uint count) { + uint const s = min(offset, 32u); + uint const e = min(32u, (s + count)); + return extract_bits(v, s, (e - s)); +} + +void extractBits_631377() { + uint4 arg_0 = uint4(0u); + uint arg_1 = 1u; + uint arg_2 = 1u; + uint4 res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + extractBits_631377(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + extractBits_631377(); + return; +} + +kernel void compute_main() { + extractBits_631377(); + return; +} + diff --git a/test/tint/builtins/gen/var/extractBits/631377.wgsl.expected.spvasm b/test/tint/builtins/gen/var/extractBits/631377.wgsl.expected.spvasm new file mode 100644 index 0000000000..1c51271310 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/631377.wgsl.expected.spvasm @@ -0,0 +1,101 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 55 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_extract_bits "tint_extract_bits" + OpName %v "v" + OpName %offset "offset" + OpName %count "count" + OpName %extractBits_631377 "extractBits_631377" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + %9 = OpTypeFunction %v4uint %v4uint %uint %uint + %uint_32 = OpConstant %uint 32 + %void = OpTypeVoid + %24 = OpTypeFunction %void + %28 = OpConstantNull %v4uint +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %34 = OpConstantNull %uint + %41 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_extract_bits = OpFunction %v4uint None %9 + %v = OpFunctionParameter %v4uint + %offset = OpFunctionParameter %uint + %count = OpFunctionParameter %uint + %16 = OpLabel + %17 = OpExtInst %uint %18 UMin %offset %uint_32 + %21 = OpIAdd %uint %17 %count + %20 = OpExtInst %uint %18 UMin %uint_32 %21 + %23 = OpISub %uint %20 %17 + %22 = OpBitFieldUExtract %v4uint %v %17 %23 + OpReturnValue %22 + OpFunctionEnd +%extractBits_631377 = OpFunction %void None %24 + %27 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4uint Function %28 + %arg_1 = OpVariable %_ptr_Function_uint Function %34 + %arg_2 = OpVariable %_ptr_Function_uint Function %34 + %res = OpVariable %_ptr_Function_v4uint Function %28 + OpStore %arg_0 %28 + OpStore %arg_1 %uint_1 + OpStore %arg_2 %uint_1 + %37 = OpLoad %v4uint %arg_0 + %38 = OpLoad %uint %arg_1 + %39 = OpLoad %uint %arg_2 + %36 = OpFunctionCall %v4uint %tint_extract_bits %37 %38 %39 + OpStore %res %36 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %41 + %43 = OpLabel + %44 = OpFunctionCall %void %extractBits_631377 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %24 + %46 = OpLabel + %47 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %47 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %24 + %50 = OpLabel + %51 = OpFunctionCall %void %extractBits_631377 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %24 + %53 = OpLabel + %54 = OpFunctionCall %void %extractBits_631377 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/extractBits/631377.wgsl.expected.wgsl b/test/tint/builtins/gen/var/extractBits/631377.wgsl.expected.wgsl new file mode 100644 index 0000000000..23e45d2040 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/631377.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn extractBits_631377() { + var arg_0 = vec4(); + var arg_1 = 1u; + var arg_2 = 1u; + var res : vec4 = extractBits(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + extractBits_631377(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + extractBits_631377(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + extractBits_631377(); +} diff --git a/test/tint/builtins/gen/var/extractBits/a99a8d.wgsl b/test/tint/builtins/gen/var/extractBits/a99a8d.wgsl new file mode 100644 index 0000000000..0086a4b5ba --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/a99a8d.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn extractBits(vec<2, i32>, u32, u32) -> vec<2, i32> +fn extractBits_a99a8d() { + var arg_0 = vec2(); + var arg_1 = 1u; + var arg_2 = 1u; + var res: vec2 = extractBits(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + extractBits_a99a8d(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + extractBits_a99a8d(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + extractBits_a99a8d(); +} diff --git a/test/tint/builtins/gen/var/extractBits/a99a8d.wgsl.expected.glsl b/test/tint/builtins/gen/var/extractBits/a99a8d.wgsl.expected.glsl new file mode 100644 index 0000000000..18db5eda25 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/a99a8d.wgsl.expected.glsl @@ -0,0 +1,76 @@ +#version 310 es + +ivec2 tint_extract_bits(ivec2 v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_a99a8d() { + ivec2 arg_0 = ivec2(0); + uint arg_1 = 1u; + uint arg_2 = 1u; + ivec2 res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + extractBits_a99a8d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +ivec2 tint_extract_bits(ivec2 v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_a99a8d() { + ivec2 arg_0 = ivec2(0); + uint arg_1 = 1u; + uint arg_2 = 1u; + ivec2 res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +void fragment_main() { + extractBits_a99a8d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +ivec2 tint_extract_bits(ivec2 v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_a99a8d() { + ivec2 arg_0 = ivec2(0); + uint arg_1 = 1u; + uint arg_2 = 1u; + ivec2 res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +void compute_main() { + extractBits_a99a8d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/extractBits/a99a8d.wgsl.expected.hlsl b/test/tint/builtins/gen/var/extractBits/a99a8d.wgsl.expected.hlsl new file mode 100644 index 0000000000..4307614ad5 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/a99a8d.wgsl.expected.hlsl @@ -0,0 +1,41 @@ +int2 tint_extract_bits(int2 v, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint shl = (32u - e); + const uint shr = (shl + s); + return ((v << uint2((shl).xx)) >> uint2((shr).xx)); +} + +void extractBits_a99a8d() { + int2 arg_0 = (0).xx; + uint arg_1 = 1u; + uint arg_2 = 1u; + int2 res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + extractBits_a99a8d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + extractBits_a99a8d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + extractBits_a99a8d(); + return; +} diff --git a/test/tint/builtins/gen/var/extractBits/a99a8d.wgsl.expected.msl b/test/tint/builtins/gen/var/extractBits/a99a8d.wgsl.expected.msl new file mode 100644 index 0000000000..80650664ed --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/a99a8d.wgsl.expected.msl @@ -0,0 +1,42 @@ +#include + +using namespace metal; +int2 tint_extract_bits(int2 v, uint offset, uint count) { + uint const s = min(offset, 32u); + uint const e = min(32u, (s + count)); + return extract_bits(v, s, (e - s)); +} + +void extractBits_a99a8d() { + int2 arg_0 = int2(0); + uint arg_1 = 1u; + uint arg_2 = 1u; + int2 res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + extractBits_a99a8d(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + extractBits_a99a8d(); + return; +} + +kernel void compute_main() { + extractBits_a99a8d(); + return; +} + diff --git a/test/tint/builtins/gen/var/extractBits/a99a8d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/extractBits/a99a8d.wgsl.expected.spvasm new file mode 100644 index 0000000000..717854ed3c --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/a99a8d.wgsl.expected.spvasm @@ -0,0 +1,102 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 56 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_extract_bits "tint_extract_bits" + OpName %v "v" + OpName %offset "offset" + OpName %count "count" + OpName %extractBits_a99a8d "extractBits_a99a8d" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %uint = OpTypeInt 32 0 + %9 = OpTypeFunction %v2int %v2int %uint %uint + %uint_32 = OpConstant %uint 32 + %void = OpTypeVoid + %25 = OpTypeFunction %void + %29 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %35 = OpConstantNull %uint + %42 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_extract_bits = OpFunction %v2int None %9 + %v = OpFunctionParameter %v2int + %offset = OpFunctionParameter %uint + %count = OpFunctionParameter %uint + %17 = OpLabel + %18 = OpExtInst %uint %19 UMin %offset %uint_32 + %22 = OpIAdd %uint %18 %count + %21 = OpExtInst %uint %19 UMin %uint_32 %22 + %24 = OpISub %uint %21 %18 + %23 = OpBitFieldSExtract %v2int %v %18 %24 + OpReturnValue %23 + OpFunctionEnd +%extractBits_a99a8d = OpFunction %void None %25 + %28 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2int Function %29 + %arg_1 = OpVariable %_ptr_Function_uint Function %35 + %arg_2 = OpVariable %_ptr_Function_uint Function %35 + %res = OpVariable %_ptr_Function_v2int Function %29 + OpStore %arg_0 %29 + OpStore %arg_1 %uint_1 + OpStore %arg_2 %uint_1 + %38 = OpLoad %v2int %arg_0 + %39 = OpLoad %uint %arg_1 + %40 = OpLoad %uint %arg_2 + %37 = OpFunctionCall %v2int %tint_extract_bits %38 %39 %40 + OpStore %res %37 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %42 + %44 = OpLabel + %45 = OpFunctionCall %void %extractBits_a99a8d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %25 + %47 = OpLabel + %48 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %48 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %25 + %51 = OpLabel + %52 = OpFunctionCall %void %extractBits_a99a8d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %25 + %54 = OpLabel + %55 = OpFunctionCall %void %extractBits_a99a8d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/extractBits/a99a8d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/extractBits/a99a8d.wgsl.expected.wgsl new file mode 100644 index 0000000000..de8bc4be63 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/a99a8d.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn extractBits_a99a8d() { + var arg_0 = vec2(); + var arg_1 = 1u; + var arg_2 = 1u; + var res : vec2 = extractBits(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + extractBits_a99a8d(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + extractBits_a99a8d(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + extractBits_a99a8d(); +} diff --git a/test/tint/builtins/gen/var/extractBits/ce81f8.wgsl b/test/tint/builtins/gen/var/extractBits/ce81f8.wgsl new file mode 100644 index 0000000000..1e1e5fefdb --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/ce81f8.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn extractBits(u32, u32, u32) -> u32 +fn extractBits_ce81f8() { + var arg_0 = 1u; + var arg_1 = 1u; + var arg_2 = 1u; + var res: u32 = extractBits(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + extractBits_ce81f8(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + extractBits_ce81f8(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + extractBits_ce81f8(); +} diff --git a/test/tint/builtins/gen/var/extractBits/ce81f8.wgsl.expected.glsl b/test/tint/builtins/gen/var/extractBits/ce81f8.wgsl.expected.glsl new file mode 100644 index 0000000000..117480c023 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/ce81f8.wgsl.expected.glsl @@ -0,0 +1,76 @@ +#version 310 es + +uint tint_extract_bits(uint v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_ce81f8() { + uint arg_0 = 1u; + uint arg_1 = 1u; + uint arg_2 = 1u; + uint res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + extractBits_ce81f8(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uint tint_extract_bits(uint v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_ce81f8() { + uint arg_0 = 1u; + uint arg_1 = 1u; + uint arg_2 = 1u; + uint res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +void fragment_main() { + extractBits_ce81f8(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uint tint_extract_bits(uint v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_ce81f8() { + uint arg_0 = 1u; + uint arg_1 = 1u; + uint arg_2 = 1u; + uint res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +void compute_main() { + extractBits_ce81f8(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/extractBits/ce81f8.wgsl.expected.hlsl b/test/tint/builtins/gen/var/extractBits/ce81f8.wgsl.expected.hlsl new file mode 100644 index 0000000000..944fe861ff --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/ce81f8.wgsl.expected.hlsl @@ -0,0 +1,41 @@ +uint tint_extract_bits(uint v, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint shl = (32u - e); + const uint shr = (shl + s); + return ((v << shl) >> shr); +} + +void extractBits_ce81f8() { + uint arg_0 = 1u; + uint arg_1 = 1u; + uint arg_2 = 1u; + uint res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + extractBits_ce81f8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + extractBits_ce81f8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + extractBits_ce81f8(); + return; +} diff --git a/test/tint/builtins/gen/var/extractBits/ce81f8.wgsl.expected.msl b/test/tint/builtins/gen/var/extractBits/ce81f8.wgsl.expected.msl new file mode 100644 index 0000000000..60f0680fb3 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/ce81f8.wgsl.expected.msl @@ -0,0 +1,42 @@ +#include + +using namespace metal; +uint tint_extract_bits(uint v, uint offset, uint count) { + uint const s = min(offset, 32u); + uint const e = min(32u, (s + count)); + return extract_bits(v, s, (e - s)); +} + +void extractBits_ce81f8() { + uint arg_0 = 1u; + uint arg_1 = 1u; + uint arg_2 = 1u; + uint res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + extractBits_ce81f8(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + extractBits_ce81f8(); + return; +} + +kernel void compute_main() { + extractBits_ce81f8(); + return; +} + diff --git a/test/tint/builtins/gen/var/extractBits/ce81f8.wgsl.expected.spvasm b/test/tint/builtins/gen/var/extractBits/ce81f8.wgsl.expected.spvasm new file mode 100644 index 0000000000..bd13e5e704 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/ce81f8.wgsl.expected.spvasm @@ -0,0 +1,98 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 52 +; Schema: 0 + OpCapability Shader + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_extract_bits "tint_extract_bits" + OpName %v "v" + OpName %offset "offset" + OpName %count "count" + OpName %extractBits_ce81f8 "extractBits_ce81f8" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %9 = OpTypeFunction %uint %uint %uint %uint + %uint_32 = OpConstant %uint 32 + %void = OpTypeVoid + %23 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %30 = OpConstantNull %uint + %38 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_extract_bits = OpFunction %uint None %9 + %v = OpFunctionParameter %uint + %offset = OpFunctionParameter %uint + %count = OpFunctionParameter %uint + %15 = OpLabel + %16 = OpExtInst %uint %17 UMin %offset %uint_32 + %20 = OpIAdd %uint %16 %count + %19 = OpExtInst %uint %17 UMin %uint_32 %20 + %22 = OpISub %uint %19 %16 + %21 = OpBitFieldUExtract %uint %v %16 %22 + OpReturnValue %21 + OpFunctionEnd +%extractBits_ce81f8 = OpFunction %void None %23 + %26 = OpLabel + %arg_0 = OpVariable %_ptr_Function_uint Function %30 + %arg_1 = OpVariable %_ptr_Function_uint Function %30 + %arg_2 = OpVariable %_ptr_Function_uint Function %30 + %res = OpVariable %_ptr_Function_uint Function %30 + OpStore %arg_0 %uint_1 + OpStore %arg_1 %uint_1 + OpStore %arg_2 %uint_1 + %34 = OpLoad %uint %arg_0 + %35 = OpLoad %uint %arg_1 + %36 = OpLoad %uint %arg_2 + %33 = OpFunctionCall %uint %tint_extract_bits %34 %35 %36 + OpStore %res %33 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %38 + %40 = OpLabel + %41 = OpFunctionCall %void %extractBits_ce81f8 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %23 + %43 = OpLabel + %44 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %44 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %23 + %47 = OpLabel + %48 = OpFunctionCall %void %extractBits_ce81f8 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %23 + %50 = OpLabel + %51 = OpFunctionCall %void %extractBits_ce81f8 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/extractBits/ce81f8.wgsl.expected.wgsl b/test/tint/builtins/gen/var/extractBits/ce81f8.wgsl.expected.wgsl new file mode 100644 index 0000000000..0a4a29b68c --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/ce81f8.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn extractBits_ce81f8() { + var arg_0 = 1u; + var arg_1 = 1u; + var arg_2 = 1u; + var res : u32 = extractBits(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + extractBits_ce81f8(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + extractBits_ce81f8(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + extractBits_ce81f8(); +} diff --git a/test/tint/builtins/gen/var/extractBits/e04f5d.wgsl b/test/tint/builtins/gen/var/extractBits/e04f5d.wgsl new file mode 100644 index 0000000000..940eb3320a --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/e04f5d.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn extractBits(vec<3, i32>, u32, u32) -> vec<3, i32> +fn extractBits_e04f5d() { + var arg_0 = vec3(); + var arg_1 = 1u; + var arg_2 = 1u; + var res: vec3 = extractBits(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + extractBits_e04f5d(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + extractBits_e04f5d(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + extractBits_e04f5d(); +} diff --git a/test/tint/builtins/gen/var/extractBits/e04f5d.wgsl.expected.glsl b/test/tint/builtins/gen/var/extractBits/e04f5d.wgsl.expected.glsl new file mode 100644 index 0000000000..80e3d78976 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/e04f5d.wgsl.expected.glsl @@ -0,0 +1,76 @@ +#version 310 es + +ivec3 tint_extract_bits(ivec3 v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_e04f5d() { + ivec3 arg_0 = ivec3(0); + uint arg_1 = 1u; + uint arg_2 = 1u; + ivec3 res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + extractBits_e04f5d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +ivec3 tint_extract_bits(ivec3 v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_e04f5d() { + ivec3 arg_0 = ivec3(0); + uint arg_1 = 1u; + uint arg_2 = 1u; + ivec3 res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +void fragment_main() { + extractBits_e04f5d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +ivec3 tint_extract_bits(ivec3 v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_e04f5d() { + ivec3 arg_0 = ivec3(0); + uint arg_1 = 1u; + uint arg_2 = 1u; + ivec3 res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +void compute_main() { + extractBits_e04f5d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/extractBits/e04f5d.wgsl.expected.hlsl b/test/tint/builtins/gen/var/extractBits/e04f5d.wgsl.expected.hlsl new file mode 100644 index 0000000000..f1cb606579 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/e04f5d.wgsl.expected.hlsl @@ -0,0 +1,41 @@ +int3 tint_extract_bits(int3 v, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint shl = (32u - e); + const uint shr = (shl + s); + return ((v << uint3((shl).xxx)) >> uint3((shr).xxx)); +} + +void extractBits_e04f5d() { + int3 arg_0 = (0).xxx; + uint arg_1 = 1u; + uint arg_2 = 1u; + int3 res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + extractBits_e04f5d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + extractBits_e04f5d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + extractBits_e04f5d(); + return; +} diff --git a/test/tint/builtins/gen/var/extractBits/e04f5d.wgsl.expected.msl b/test/tint/builtins/gen/var/extractBits/e04f5d.wgsl.expected.msl new file mode 100644 index 0000000000..9587087701 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/e04f5d.wgsl.expected.msl @@ -0,0 +1,42 @@ +#include + +using namespace metal; +int3 tint_extract_bits(int3 v, uint offset, uint count) { + uint const s = min(offset, 32u); + uint const e = min(32u, (s + count)); + return extract_bits(v, s, (e - s)); +} + +void extractBits_e04f5d() { + int3 arg_0 = int3(0); + uint arg_1 = 1u; + uint arg_2 = 1u; + int3 res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + extractBits_e04f5d(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + extractBits_e04f5d(); + return; +} + +kernel void compute_main() { + extractBits_e04f5d(); + return; +} + diff --git a/test/tint/builtins/gen/var/extractBits/e04f5d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/extractBits/e04f5d.wgsl.expected.spvasm new file mode 100644 index 0000000000..fd159b9c7c --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/e04f5d.wgsl.expected.spvasm @@ -0,0 +1,102 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 56 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_extract_bits "tint_extract_bits" + OpName %v "v" + OpName %offset "offset" + OpName %count "count" + OpName %extractBits_e04f5d "extractBits_e04f5d" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %uint = OpTypeInt 32 0 + %9 = OpTypeFunction %v3int %v3int %uint %uint + %uint_32 = OpConstant %uint 32 + %void = OpTypeVoid + %25 = OpTypeFunction %void + %29 = OpConstantNull %v3int +%_ptr_Function_v3int = OpTypePointer Function %v3int + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %35 = OpConstantNull %uint + %42 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_extract_bits = OpFunction %v3int None %9 + %v = OpFunctionParameter %v3int + %offset = OpFunctionParameter %uint + %count = OpFunctionParameter %uint + %17 = OpLabel + %18 = OpExtInst %uint %19 UMin %offset %uint_32 + %22 = OpIAdd %uint %18 %count + %21 = OpExtInst %uint %19 UMin %uint_32 %22 + %24 = OpISub %uint %21 %18 + %23 = OpBitFieldSExtract %v3int %v %18 %24 + OpReturnValue %23 + OpFunctionEnd +%extractBits_e04f5d = OpFunction %void None %25 + %28 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3int Function %29 + %arg_1 = OpVariable %_ptr_Function_uint Function %35 + %arg_2 = OpVariable %_ptr_Function_uint Function %35 + %res = OpVariable %_ptr_Function_v3int Function %29 + OpStore %arg_0 %29 + OpStore %arg_1 %uint_1 + OpStore %arg_2 %uint_1 + %38 = OpLoad %v3int %arg_0 + %39 = OpLoad %uint %arg_1 + %40 = OpLoad %uint %arg_2 + %37 = OpFunctionCall %v3int %tint_extract_bits %38 %39 %40 + OpStore %res %37 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %42 + %44 = OpLabel + %45 = OpFunctionCall %void %extractBits_e04f5d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %25 + %47 = OpLabel + %48 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %48 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %25 + %51 = OpLabel + %52 = OpFunctionCall %void %extractBits_e04f5d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %25 + %54 = OpLabel + %55 = OpFunctionCall %void %extractBits_e04f5d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/extractBits/e04f5d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/extractBits/e04f5d.wgsl.expected.wgsl new file mode 100644 index 0000000000..a866a10fde --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/e04f5d.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn extractBits_e04f5d() { + var arg_0 = vec3(); + var arg_1 = 1u; + var arg_2 = 1u; + var res : vec3 = extractBits(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + extractBits_e04f5d(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + extractBits_e04f5d(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + extractBits_e04f5d(); +} diff --git a/test/tint/builtins/gen/var/extractBits/f28f69.wgsl b/test/tint/builtins/gen/var/extractBits/f28f69.wgsl new file mode 100644 index 0000000000..4c40da4ce4 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/f28f69.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn extractBits(vec<2, u32>, u32, u32) -> vec<2, u32> +fn extractBits_f28f69() { + var arg_0 = vec2(); + var arg_1 = 1u; + var arg_2 = 1u; + var res: vec2 = extractBits(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + extractBits_f28f69(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + extractBits_f28f69(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + extractBits_f28f69(); +} diff --git a/test/tint/builtins/gen/var/extractBits/f28f69.wgsl.expected.glsl b/test/tint/builtins/gen/var/extractBits/f28f69.wgsl.expected.glsl new file mode 100644 index 0000000000..a5b640be43 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/f28f69.wgsl.expected.glsl @@ -0,0 +1,76 @@ +#version 310 es + +uvec2 tint_extract_bits(uvec2 v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_f28f69() { + uvec2 arg_0 = uvec2(0u); + uint arg_1 = 1u; + uint arg_2 = 1u; + uvec2 res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + extractBits_f28f69(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uvec2 tint_extract_bits(uvec2 v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_f28f69() { + uvec2 arg_0 = uvec2(0u); + uint arg_1 = 1u; + uint arg_2 = 1u; + uvec2 res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +void fragment_main() { + extractBits_f28f69(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uvec2 tint_extract_bits(uvec2 v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_f28f69() { + uvec2 arg_0 = uvec2(0u); + uint arg_1 = 1u; + uint arg_2 = 1u; + uvec2 res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +void compute_main() { + extractBits_f28f69(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/extractBits/f28f69.wgsl.expected.hlsl b/test/tint/builtins/gen/var/extractBits/f28f69.wgsl.expected.hlsl new file mode 100644 index 0000000000..d5e4931bdc --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/f28f69.wgsl.expected.hlsl @@ -0,0 +1,41 @@ +uint2 tint_extract_bits(uint2 v, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint shl = (32u - e); + const uint shr = (shl + s); + return ((v << uint2((shl).xx)) >> uint2((shr).xx)); +} + +void extractBits_f28f69() { + uint2 arg_0 = (0u).xx; + uint arg_1 = 1u; + uint arg_2 = 1u; + uint2 res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + extractBits_f28f69(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + extractBits_f28f69(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + extractBits_f28f69(); + return; +} diff --git a/test/tint/builtins/gen/var/extractBits/f28f69.wgsl.expected.msl b/test/tint/builtins/gen/var/extractBits/f28f69.wgsl.expected.msl new file mode 100644 index 0000000000..bd0078e42e --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/f28f69.wgsl.expected.msl @@ -0,0 +1,42 @@ +#include + +using namespace metal; +uint2 tint_extract_bits(uint2 v, uint offset, uint count) { + uint const s = min(offset, 32u); + uint const e = min(32u, (s + count)); + return extract_bits(v, s, (e - s)); +} + +void extractBits_f28f69() { + uint2 arg_0 = uint2(0u); + uint arg_1 = 1u; + uint arg_2 = 1u; + uint2 res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + extractBits_f28f69(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + extractBits_f28f69(); + return; +} + +kernel void compute_main() { + extractBits_f28f69(); + return; +} + diff --git a/test/tint/builtins/gen/var/extractBits/f28f69.wgsl.expected.spvasm b/test/tint/builtins/gen/var/extractBits/f28f69.wgsl.expected.spvasm new file mode 100644 index 0000000000..fb2a5f67a5 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/f28f69.wgsl.expected.spvasm @@ -0,0 +1,101 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 55 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_extract_bits "tint_extract_bits" + OpName %v "v" + OpName %offset "offset" + OpName %count "count" + OpName %extractBits_f28f69 "extractBits_f28f69" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %9 = OpTypeFunction %v2uint %v2uint %uint %uint + %uint_32 = OpConstant %uint 32 + %void = OpTypeVoid + %24 = OpTypeFunction %void + %28 = OpConstantNull %v2uint +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %34 = OpConstantNull %uint + %41 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_extract_bits = OpFunction %v2uint None %9 + %v = OpFunctionParameter %v2uint + %offset = OpFunctionParameter %uint + %count = OpFunctionParameter %uint + %16 = OpLabel + %17 = OpExtInst %uint %18 UMin %offset %uint_32 + %21 = OpIAdd %uint %17 %count + %20 = OpExtInst %uint %18 UMin %uint_32 %21 + %23 = OpISub %uint %20 %17 + %22 = OpBitFieldUExtract %v2uint %v %17 %23 + OpReturnValue %22 + OpFunctionEnd +%extractBits_f28f69 = OpFunction %void None %24 + %27 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2uint Function %28 + %arg_1 = OpVariable %_ptr_Function_uint Function %34 + %arg_2 = OpVariable %_ptr_Function_uint Function %34 + %res = OpVariable %_ptr_Function_v2uint Function %28 + OpStore %arg_0 %28 + OpStore %arg_1 %uint_1 + OpStore %arg_2 %uint_1 + %37 = OpLoad %v2uint %arg_0 + %38 = OpLoad %uint %arg_1 + %39 = OpLoad %uint %arg_2 + %36 = OpFunctionCall %v2uint %tint_extract_bits %37 %38 %39 + OpStore %res %36 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %41 + %43 = OpLabel + %44 = OpFunctionCall %void %extractBits_f28f69 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %24 + %46 = OpLabel + %47 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %47 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %24 + %50 = OpLabel + %51 = OpFunctionCall %void %extractBits_f28f69 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %24 + %53 = OpLabel + %54 = OpFunctionCall %void %extractBits_f28f69 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/extractBits/f28f69.wgsl.expected.wgsl b/test/tint/builtins/gen/var/extractBits/f28f69.wgsl.expected.wgsl new file mode 100644 index 0000000000..f70d9c7bb9 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/f28f69.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn extractBits_f28f69() { + var arg_0 = vec2(); + var arg_1 = 1u; + var arg_2 = 1u; + var res : vec2 = extractBits(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + extractBits_f28f69(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + extractBits_f28f69(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + extractBits_f28f69(); +} diff --git a/test/tint/builtins/gen/var/extractBits/fb850f.wgsl b/test/tint/builtins/gen/var/extractBits/fb850f.wgsl new file mode 100644 index 0000000000..f31e60ecf1 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/fb850f.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn extractBits(vec<4, i32>, u32, u32) -> vec<4, i32> +fn extractBits_fb850f() { + var arg_0 = vec4(); + var arg_1 = 1u; + var arg_2 = 1u; + var res: vec4 = extractBits(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + extractBits_fb850f(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + extractBits_fb850f(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + extractBits_fb850f(); +} diff --git a/test/tint/builtins/gen/var/extractBits/fb850f.wgsl.expected.glsl b/test/tint/builtins/gen/var/extractBits/fb850f.wgsl.expected.glsl new file mode 100644 index 0000000000..db67c074a1 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/fb850f.wgsl.expected.glsl @@ -0,0 +1,76 @@ +#version 310 es + +ivec4 tint_extract_bits(ivec4 v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_fb850f() { + ivec4 arg_0 = ivec4(0); + uint arg_1 = 1u; + uint arg_2 = 1u; + ivec4 res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + extractBits_fb850f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +ivec4 tint_extract_bits(ivec4 v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_fb850f() { + ivec4 arg_0 = ivec4(0); + uint arg_1 = 1u; + uint arg_2 = 1u; + ivec4 res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +void fragment_main() { + extractBits_fb850f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +ivec4 tint_extract_bits(ivec4 v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_fb850f() { + ivec4 arg_0 = ivec4(0); + uint arg_1 = 1u; + uint arg_2 = 1u; + ivec4 res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +void compute_main() { + extractBits_fb850f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/extractBits/fb850f.wgsl.expected.hlsl b/test/tint/builtins/gen/var/extractBits/fb850f.wgsl.expected.hlsl new file mode 100644 index 0000000000..e6a538d2bd --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/fb850f.wgsl.expected.hlsl @@ -0,0 +1,41 @@ +int4 tint_extract_bits(int4 v, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint shl = (32u - e); + const uint shr = (shl + s); + return ((v << uint4((shl).xxxx)) >> uint4((shr).xxxx)); +} + +void extractBits_fb850f() { + int4 arg_0 = (0).xxxx; + uint arg_1 = 1u; + uint arg_2 = 1u; + int4 res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + extractBits_fb850f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + extractBits_fb850f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + extractBits_fb850f(); + return; +} diff --git a/test/tint/builtins/gen/var/extractBits/fb850f.wgsl.expected.msl b/test/tint/builtins/gen/var/extractBits/fb850f.wgsl.expected.msl new file mode 100644 index 0000000000..ff1e0a1b28 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/fb850f.wgsl.expected.msl @@ -0,0 +1,42 @@ +#include + +using namespace metal; +int4 tint_extract_bits(int4 v, uint offset, uint count) { + uint const s = min(offset, 32u); + uint const e = min(32u, (s + count)); + return extract_bits(v, s, (e - s)); +} + +void extractBits_fb850f() { + int4 arg_0 = int4(0); + uint arg_1 = 1u; + uint arg_2 = 1u; + int4 res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + extractBits_fb850f(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + extractBits_fb850f(); + return; +} + +kernel void compute_main() { + extractBits_fb850f(); + return; +} + diff --git a/test/tint/builtins/gen/var/extractBits/fb850f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/extractBits/fb850f.wgsl.expected.spvasm new file mode 100644 index 0000000000..33149d6f86 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/fb850f.wgsl.expected.spvasm @@ -0,0 +1,102 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 56 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_extract_bits "tint_extract_bits" + OpName %v "v" + OpName %offset "offset" + OpName %count "count" + OpName %extractBits_fb850f "extractBits_fb850f" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %uint = OpTypeInt 32 0 + %9 = OpTypeFunction %v4int %v4int %uint %uint + %uint_32 = OpConstant %uint 32 + %void = OpTypeVoid + %25 = OpTypeFunction %void + %29 = OpConstantNull %v4int +%_ptr_Function_v4int = OpTypePointer Function %v4int + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %35 = OpConstantNull %uint + %42 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_extract_bits = OpFunction %v4int None %9 + %v = OpFunctionParameter %v4int + %offset = OpFunctionParameter %uint + %count = OpFunctionParameter %uint + %17 = OpLabel + %18 = OpExtInst %uint %19 UMin %offset %uint_32 + %22 = OpIAdd %uint %18 %count + %21 = OpExtInst %uint %19 UMin %uint_32 %22 + %24 = OpISub %uint %21 %18 + %23 = OpBitFieldSExtract %v4int %v %18 %24 + OpReturnValue %23 + OpFunctionEnd +%extractBits_fb850f = OpFunction %void None %25 + %28 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4int Function %29 + %arg_1 = OpVariable %_ptr_Function_uint Function %35 + %arg_2 = OpVariable %_ptr_Function_uint Function %35 + %res = OpVariable %_ptr_Function_v4int Function %29 + OpStore %arg_0 %29 + OpStore %arg_1 %uint_1 + OpStore %arg_2 %uint_1 + %38 = OpLoad %v4int %arg_0 + %39 = OpLoad %uint %arg_1 + %40 = OpLoad %uint %arg_2 + %37 = OpFunctionCall %v4int %tint_extract_bits %38 %39 %40 + OpStore %res %37 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %42 + %44 = OpLabel + %45 = OpFunctionCall %void %extractBits_fb850f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %25 + %47 = OpLabel + %48 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %48 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %25 + %51 = OpLabel + %52 = OpFunctionCall %void %extractBits_fb850f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %25 + %54 = OpLabel + %55 = OpFunctionCall %void %extractBits_fb850f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/extractBits/fb850f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/extractBits/fb850f.wgsl.expected.wgsl new file mode 100644 index 0000000000..1b0afd5fac --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/fb850f.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn extractBits_fb850f() { + var arg_0 = vec4(); + var arg_1 = 1u; + var arg_2 = 1u; + var res : vec4 = extractBits(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + extractBits_fb850f(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + extractBits_fb850f(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + extractBits_fb850f(); +} diff --git a/test/tint/builtins/gen/var/faceForward/5afbd5.wgsl b/test/tint/builtins/gen/var/faceForward/5afbd5.wgsl new file mode 100644 index 0000000000..25d1a73b32 --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/5afbd5.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn faceForward(vec<3, f32>, vec<3, f32>, vec<3, f32>) -> vec<3, f32> +fn faceForward_5afbd5() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var arg_2 = vec3(); + var res: vec3 = faceForward(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + faceForward_5afbd5(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + faceForward_5afbd5(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + faceForward_5afbd5(); +} diff --git a/test/tint/builtins/gen/var/faceForward/5afbd5.wgsl.expected.glsl b/test/tint/builtins/gen/var/faceForward/5afbd5.wgsl.expected.glsl new file mode 100644 index 0000000000..d14d0d69e7 --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/5afbd5.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void faceForward_5afbd5() { + vec3 arg_0 = vec3(0.0f); + vec3 arg_1 = vec3(0.0f); + vec3 arg_2 = vec3(0.0f); + vec3 res = faceforward(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + faceForward_5afbd5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void faceForward_5afbd5() { + vec3 arg_0 = vec3(0.0f); + vec3 arg_1 = vec3(0.0f); + vec3 arg_2 = vec3(0.0f); + vec3 res = faceforward(arg_0, arg_1, arg_2); +} + +void fragment_main() { + faceForward_5afbd5(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void faceForward_5afbd5() { + vec3 arg_0 = vec3(0.0f); + vec3 arg_1 = vec3(0.0f); + vec3 arg_2 = vec3(0.0f); + vec3 res = faceforward(arg_0, arg_1, arg_2); +} + +void compute_main() { + faceForward_5afbd5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/faceForward/5afbd5.wgsl.expected.hlsl b/test/tint/builtins/gen/var/faceForward/5afbd5.wgsl.expected.hlsl new file mode 100644 index 0000000000..6983f1b580 --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/5afbd5.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +void faceForward_5afbd5() { + float3 arg_0 = (0.0f).xxx; + float3 arg_1 = (0.0f).xxx; + float3 arg_2 = (0.0f).xxx; + float3 res = faceforward(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + faceForward_5afbd5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + faceForward_5afbd5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + faceForward_5afbd5(); + return; +} diff --git a/test/tint/builtins/gen/var/faceForward/5afbd5.wgsl.expected.msl b/test/tint/builtins/gen/var/faceForward/5afbd5.wgsl.expected.msl new file mode 100644 index 0000000000..74f5cd113a --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/5afbd5.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void faceForward_5afbd5() { + float3 arg_0 = float3(0.0f); + float3 arg_1 = float3(0.0f); + float3 arg_2 = float3(0.0f); + float3 res = faceforward(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + faceForward_5afbd5(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + faceForward_5afbd5(); + return; +} + +kernel void compute_main() { + faceForward_5afbd5(); + return; +} + diff --git a/test/tint/builtins/gen/var/faceForward/5afbd5.wgsl.expected.spvasm b/test/tint/builtins/gen/var/faceForward/5afbd5.wgsl.expected.spvasm new file mode 100644 index 0000000000..278ef67958 --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/5afbd5.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %faceForward_5afbd5 "faceForward_5afbd5" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %14 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%faceForward_5afbd5 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %14 + %arg_1 = OpVariable %_ptr_Function_v3float Function %14 + %arg_2 = OpVariable %_ptr_Function_v3float Function %14 + %res = OpVariable %_ptr_Function_v3float Function %14 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + OpStore %arg_2 %14 + %21 = OpLoad %v3float %arg_0 + %22 = OpLoad %v3float %arg_1 + %23 = OpLoad %v3float %arg_2 + %19 = OpExtInst %v3float %20 FaceForward %21 %22 %23 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %faceForward_5afbd5 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %faceForward_5afbd5 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %faceForward_5afbd5 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/faceForward/5afbd5.wgsl.expected.wgsl b/test/tint/builtins/gen/var/faceForward/5afbd5.wgsl.expected.wgsl new file mode 100644 index 0000000000..56bed2312f --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/5afbd5.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn faceForward_5afbd5() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var arg_2 = vec3(); + var res : vec3 = faceForward(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + faceForward_5afbd5(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + faceForward_5afbd5(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + faceForward_5afbd5(); +} diff --git a/test/tint/builtins/gen/var/faceForward/b316e5.wgsl b/test/tint/builtins/gen/var/faceForward/b316e5.wgsl new file mode 100644 index 0000000000..4d4e57cad8 --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/b316e5.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn faceForward(vec<4, f32>, vec<4, f32>, vec<4, f32>) -> vec<4, f32> +fn faceForward_b316e5() { + var arg_0 = vec4(); + var arg_1 = vec4(); + var arg_2 = vec4(); + var res: vec4 = faceForward(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + faceForward_b316e5(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + faceForward_b316e5(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + faceForward_b316e5(); +} diff --git a/test/tint/builtins/gen/var/faceForward/b316e5.wgsl.expected.glsl b/test/tint/builtins/gen/var/faceForward/b316e5.wgsl.expected.glsl new file mode 100644 index 0000000000..99adf65d96 --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/b316e5.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void faceForward_b316e5() { + vec4 arg_0 = vec4(0.0f); + vec4 arg_1 = vec4(0.0f); + vec4 arg_2 = vec4(0.0f); + vec4 res = faceforward(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + faceForward_b316e5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void faceForward_b316e5() { + vec4 arg_0 = vec4(0.0f); + vec4 arg_1 = vec4(0.0f); + vec4 arg_2 = vec4(0.0f); + vec4 res = faceforward(arg_0, arg_1, arg_2); +} + +void fragment_main() { + faceForward_b316e5(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void faceForward_b316e5() { + vec4 arg_0 = vec4(0.0f); + vec4 arg_1 = vec4(0.0f); + vec4 arg_2 = vec4(0.0f); + vec4 res = faceforward(arg_0, arg_1, arg_2); +} + +void compute_main() { + faceForward_b316e5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/faceForward/b316e5.wgsl.expected.hlsl b/test/tint/builtins/gen/var/faceForward/b316e5.wgsl.expected.hlsl new file mode 100644 index 0000000000..b11b1da97a --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/b316e5.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +void faceForward_b316e5() { + float4 arg_0 = (0.0f).xxxx; + float4 arg_1 = (0.0f).xxxx; + float4 arg_2 = (0.0f).xxxx; + float4 res = faceforward(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + faceForward_b316e5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + faceForward_b316e5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + faceForward_b316e5(); + return; +} diff --git a/test/tint/builtins/gen/var/faceForward/b316e5.wgsl.expected.msl b/test/tint/builtins/gen/var/faceForward/b316e5.wgsl.expected.msl new file mode 100644 index 0000000000..72ccfcb06d --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/b316e5.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void faceForward_b316e5() { + float4 arg_0 = float4(0.0f); + float4 arg_1 = float4(0.0f); + float4 arg_2 = float4(0.0f); + float4 res = faceforward(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + faceForward_b316e5(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + faceForward_b316e5(); + return; +} + +kernel void compute_main() { + faceForward_b316e5(); + return; +} + diff --git a/test/tint/builtins/gen/var/faceForward/b316e5.wgsl.expected.spvasm b/test/tint/builtins/gen/var/faceForward/b316e5.wgsl.expected.spvasm new file mode 100644 index 0000000000..f88252bef7 --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/b316e5.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %faceForward_b316e5 "faceForward_b316e5" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%faceForward_b316e5 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %arg_1 = OpVariable %_ptr_Function_v4float Function %5 + %arg_2 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %5 + OpStore %arg_1 %5 + OpStore %arg_2 %5 + %19 = OpLoad %v4float %arg_0 + %20 = OpLoad %v4float %arg_1 + %21 = OpLoad %v4float %arg_2 + %17 = OpExtInst %v4float %18 FaceForward %19 %20 %21 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %faceForward_b316e5 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %faceForward_b316e5 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %faceForward_b316e5 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/faceForward/b316e5.wgsl.expected.wgsl b/test/tint/builtins/gen/var/faceForward/b316e5.wgsl.expected.wgsl new file mode 100644 index 0000000000..50154f3806 --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/b316e5.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn faceForward_b316e5() { + var arg_0 = vec4(); + var arg_1 = vec4(); + var arg_2 = vec4(); + var res : vec4 = faceForward(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + faceForward_b316e5(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + faceForward_b316e5(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + faceForward_b316e5(); +} diff --git a/test/tint/builtins/gen/var/faceForward/e6908b.wgsl b/test/tint/builtins/gen/var/faceForward/e6908b.wgsl new file mode 100644 index 0000000000..5cb18c4baf --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/e6908b.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn faceForward(vec<2, f32>, vec<2, f32>, vec<2, f32>) -> vec<2, f32> +fn faceForward_e6908b() { + var arg_0 = vec2(); + var arg_1 = vec2(); + var arg_2 = vec2(); + var res: vec2 = faceForward(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + faceForward_e6908b(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + faceForward_e6908b(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + faceForward_e6908b(); +} diff --git a/test/tint/builtins/gen/var/faceForward/e6908b.wgsl.expected.glsl b/test/tint/builtins/gen/var/faceForward/e6908b.wgsl.expected.glsl new file mode 100644 index 0000000000..d2f0fd3db9 --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/e6908b.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void faceForward_e6908b() { + vec2 arg_0 = vec2(0.0f); + vec2 arg_1 = vec2(0.0f); + vec2 arg_2 = vec2(0.0f); + vec2 res = faceforward(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + faceForward_e6908b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void faceForward_e6908b() { + vec2 arg_0 = vec2(0.0f); + vec2 arg_1 = vec2(0.0f); + vec2 arg_2 = vec2(0.0f); + vec2 res = faceforward(arg_0, arg_1, arg_2); +} + +void fragment_main() { + faceForward_e6908b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void faceForward_e6908b() { + vec2 arg_0 = vec2(0.0f); + vec2 arg_1 = vec2(0.0f); + vec2 arg_2 = vec2(0.0f); + vec2 res = faceforward(arg_0, arg_1, arg_2); +} + +void compute_main() { + faceForward_e6908b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/faceForward/e6908b.wgsl.expected.hlsl b/test/tint/builtins/gen/var/faceForward/e6908b.wgsl.expected.hlsl new file mode 100644 index 0000000000..9f71b86e26 --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/e6908b.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +void faceForward_e6908b() { + float2 arg_0 = (0.0f).xx; + float2 arg_1 = (0.0f).xx; + float2 arg_2 = (0.0f).xx; + float2 res = faceforward(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + faceForward_e6908b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + faceForward_e6908b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + faceForward_e6908b(); + return; +} diff --git a/test/tint/builtins/gen/var/faceForward/e6908b.wgsl.expected.msl b/test/tint/builtins/gen/var/faceForward/e6908b.wgsl.expected.msl new file mode 100644 index 0000000000..ca6e3a76e5 --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/e6908b.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void faceForward_e6908b() { + float2 arg_0 = float2(0.0f); + float2 arg_1 = float2(0.0f); + float2 arg_2 = float2(0.0f); + float2 res = faceforward(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + faceForward_e6908b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + faceForward_e6908b(); + return; +} + +kernel void compute_main() { + faceForward_e6908b(); + return; +} + diff --git a/test/tint/builtins/gen/var/faceForward/e6908b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/faceForward/e6908b.wgsl.expected.spvasm new file mode 100644 index 0000000000..461a75ab79 --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/e6908b.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %faceForward_e6908b "faceForward_e6908b" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %14 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%faceForward_e6908b = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %14 + %arg_1 = OpVariable %_ptr_Function_v2float Function %14 + %arg_2 = OpVariable %_ptr_Function_v2float Function %14 + %res = OpVariable %_ptr_Function_v2float Function %14 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + OpStore %arg_2 %14 + %21 = OpLoad %v2float %arg_0 + %22 = OpLoad %v2float %arg_1 + %23 = OpLoad %v2float %arg_2 + %19 = OpExtInst %v2float %20 FaceForward %21 %22 %23 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %faceForward_e6908b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %faceForward_e6908b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %faceForward_e6908b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/faceForward/e6908b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/faceForward/e6908b.wgsl.expected.wgsl new file mode 100644 index 0000000000..7e8df96e3b --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/e6908b.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn faceForward_e6908b() { + var arg_0 = vec2(); + var arg_1 = vec2(); + var arg_2 = vec2(); + var res : vec2 = faceForward(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + faceForward_e6908b(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + faceForward_e6908b(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + faceForward_e6908b(); +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/000ff3.wgsl b/test/tint/builtins/gen/var/firstLeadingBit/000ff3.wgsl new file mode 100644 index 0000000000..6ce9b05824 --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/000ff3.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn firstLeadingBit(vec<4, u32>) -> vec<4, u32> +fn firstLeadingBit_000ff3() { + var arg_0 = vec4(); + var res: vec4 = firstLeadingBit(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + firstLeadingBit_000ff3(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + firstLeadingBit_000ff3(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + firstLeadingBit_000ff3(); +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/000ff3.wgsl.expected.glsl b/test/tint/builtins/gen/var/firstLeadingBit/000ff3.wgsl.expected.glsl new file mode 100644 index 0000000000..acfe1bc672 --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/000ff3.wgsl.expected.glsl @@ -0,0 +1,97 @@ +#version 310 es + +uvec4 tint_first_leading_bit(uvec4 v) { + uvec4 x = v; + uvec4 b16 = mix(uvec4(0u), uvec4(16u), bvec4((x & uvec4(4294901760u)))); + x = (x >> b16); + uvec4 b8 = mix(uvec4(0u), uvec4(8u), bvec4((x & uvec4(65280u)))); + x = (x >> b8); + uvec4 b4 = mix(uvec4(0u), uvec4(4u), bvec4((x & uvec4(240u)))); + x = (x >> b4); + uvec4 b2 = mix(uvec4(0u), uvec4(2u), bvec4((x & uvec4(12u)))); + x = (x >> b2); + uvec4 b1 = mix(uvec4(0u), uvec4(1u), bvec4((x & uvec4(2u)))); + uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u))); + return uvec4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_000ff3() { + uvec4 arg_0 = uvec4(0u); + uvec4 res = tint_first_leading_bit(arg_0); +} + +vec4 vertex_main() { + firstLeadingBit_000ff3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uvec4 tint_first_leading_bit(uvec4 v) { + uvec4 x = v; + uvec4 b16 = mix(uvec4(0u), uvec4(16u), bvec4((x & uvec4(4294901760u)))); + x = (x >> b16); + uvec4 b8 = mix(uvec4(0u), uvec4(8u), bvec4((x & uvec4(65280u)))); + x = (x >> b8); + uvec4 b4 = mix(uvec4(0u), uvec4(4u), bvec4((x & uvec4(240u)))); + x = (x >> b4); + uvec4 b2 = mix(uvec4(0u), uvec4(2u), bvec4((x & uvec4(12u)))); + x = (x >> b2); + uvec4 b1 = mix(uvec4(0u), uvec4(1u), bvec4((x & uvec4(2u)))); + uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u))); + return uvec4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_000ff3() { + uvec4 arg_0 = uvec4(0u); + uvec4 res = tint_first_leading_bit(arg_0); +} + +void fragment_main() { + firstLeadingBit_000ff3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uvec4 tint_first_leading_bit(uvec4 v) { + uvec4 x = v; + uvec4 b16 = mix(uvec4(0u), uvec4(16u), bvec4((x & uvec4(4294901760u)))); + x = (x >> b16); + uvec4 b8 = mix(uvec4(0u), uvec4(8u), bvec4((x & uvec4(65280u)))); + x = (x >> b8); + uvec4 b4 = mix(uvec4(0u), uvec4(4u), bvec4((x & uvec4(240u)))); + x = (x >> b4); + uvec4 b2 = mix(uvec4(0u), uvec4(2u), bvec4((x & uvec4(12u)))); + x = (x >> b2); + uvec4 b1 = mix(uvec4(0u), uvec4(1u), bvec4((x & uvec4(2u)))); + uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u))); + return uvec4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_000ff3() { + uvec4 arg_0 = uvec4(0u); + uvec4 res = tint_first_leading_bit(arg_0); +} + +void compute_main() { + firstLeadingBit_000ff3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/000ff3.wgsl.expected.hlsl b/test/tint/builtins/gen/var/firstLeadingBit/000ff3.wgsl.expected.hlsl new file mode 100644 index 0000000000..aa95d7190b --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/000ff3.wgsl.expected.hlsl @@ -0,0 +1,46 @@ +uint4 tint_first_leading_bit(uint4 v) { + uint4 x = v; + const uint4 b16 = (bool4((x & (4294901760u).xxxx)) ? (16u).xxxx : (0u).xxxx); + x = (x >> b16); + const uint4 b8 = (bool4((x & (65280u).xxxx)) ? (8u).xxxx : (0u).xxxx); + x = (x >> b8); + const uint4 b4 = (bool4((x & (240u).xxxx)) ? (4u).xxxx : (0u).xxxx); + x = (x >> b4); + const uint4 b2 = (bool4((x & (12u).xxxx)) ? (2u).xxxx : (0u).xxxx); + x = (x >> b2); + const uint4 b1 = (bool4((x & (2u).xxxx)) ? (1u).xxxx : (0u).xxxx); + const uint4 is_zero = ((x == (0u).xxxx) ? (4294967295u).xxxx : (0u).xxxx); + return uint4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_000ff3() { + uint4 arg_0 = (0u).xxxx; + uint4 res = tint_first_leading_bit(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstLeadingBit_000ff3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstLeadingBit_000ff3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstLeadingBit_000ff3(); + return; +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/000ff3.wgsl.expected.msl b/test/tint/builtins/gen/var/firstLeadingBit/000ff3.wgsl.expected.msl new file mode 100644 index 0000000000..f5e731b05c --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/000ff3.wgsl.expected.msl @@ -0,0 +1,49 @@ +#include + +using namespace metal; +uint4 tint_first_leading_bit(uint4 v) { + uint4 x = v; + uint4 const b16 = select(uint4(0u), uint4(16u), bool4((x & uint4(4294901760u)))); + x = (x >> b16); + uint4 const b8 = select(uint4(0u), uint4(8u), bool4((x & uint4(65280u)))); + x = (x >> b8); + uint4 const b4 = select(uint4(0u), uint4(4u), bool4((x & uint4(240u)))); + x = (x >> b4); + uint4 const b2 = select(uint4(0u), uint4(2u), bool4((x & uint4(12u)))); + x = (x >> b2); + uint4 const b1 = select(uint4(0u), uint4(1u), bool4((x & uint4(2u)))); + uint4 const is_zero = select(uint4(0u), uint4(4294967295u), (x == uint4(0u))); + return uint4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_000ff3() { + uint4 arg_0 = uint4(0u); + uint4 res = tint_first_leading_bit(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + firstLeadingBit_000ff3(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + firstLeadingBit_000ff3(); + return; +} + +kernel void compute_main() { + firstLeadingBit_000ff3(); + return; +} + diff --git a/test/tint/builtins/gen/var/firstLeadingBit/000ff3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/firstLeadingBit/000ff3.wgsl.expected.spvasm new file mode 100644 index 0000000000..dc0c5a032b --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/000ff3.wgsl.expected.spvasm @@ -0,0 +1,144 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 99 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_first_leading_bit "tint_first_leading_bit" + OpName %v "v" + OpName %x "x" + OpName %firstLeadingBit_000ff3 "firstLeadingBit_000ff3" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + %9 = OpTypeFunction %v4uint %v4uint +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %17 = OpConstantNull %v4uint + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 +%uint_4294901760 = OpConstant %uint 4294901760 + %24 = OpConstantComposite %v4uint %uint_4294901760 %uint_4294901760 %uint_4294901760 %uint_4294901760 + %uint_16 = OpConstant %uint 16 + %27 = OpConstantComposite %v4uint %uint_16 %uint_16 %uint_16 %uint_16 + %uint_65280 = OpConstant %uint 65280 + %34 = OpConstantComposite %v4uint %uint_65280 %uint_65280 %uint_65280 %uint_65280 + %uint_8 = OpConstant %uint 8 + %37 = OpConstantComposite %v4uint %uint_8 %uint_8 %uint_8 %uint_8 + %uint_240 = OpConstant %uint 240 + %44 = OpConstantComposite %v4uint %uint_240 %uint_240 %uint_240 %uint_240 + %uint_4 = OpConstant %uint 4 + %47 = OpConstantComposite %v4uint %uint_4 %uint_4 %uint_4 %uint_4 + %uint_12 = OpConstant %uint 12 + %54 = OpConstantComposite %v4uint %uint_12 %uint_12 %uint_12 %uint_12 + %uint_2 = OpConstant %uint 2 + %57 = OpConstantComposite %v4uint %uint_2 %uint_2 %uint_2 %uint_2 + %uint_1 = OpConstant %uint 1 + %65 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1 +%uint_4294967295 = OpConstant %uint 4294967295 + %70 = OpConstantComposite %v4uint %uint_4294967295 %uint_4294967295 %uint_4294967295 %uint_4294967295 + %void = OpTypeVoid + %77 = OpTypeFunction %void + %85 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_first_leading_bit = OpFunction %v4uint None %9 + %v = OpFunctionParameter %v4uint + %14 = OpLabel + %x = OpVariable %_ptr_Function_v4uint Function %17 + OpStore %x %v + %22 = OpLoad %v4uint %x + %25 = OpBitwiseAnd %v4uint %22 %24 + %19 = OpINotEqual %v4bool %25 %17 + %18 = OpSelect %v4uint %19 %27 %17 + %28 = OpLoad %v4uint %x + %29 = OpShiftRightLogical %v4uint %28 %18 + OpStore %x %29 + %32 = OpLoad %v4uint %x + %35 = OpBitwiseAnd %v4uint %32 %34 + %31 = OpINotEqual %v4bool %35 %17 + %30 = OpSelect %v4uint %31 %37 %17 + %38 = OpLoad %v4uint %x + %39 = OpShiftRightLogical %v4uint %38 %30 + OpStore %x %39 + %42 = OpLoad %v4uint %x + %45 = OpBitwiseAnd %v4uint %42 %44 + %41 = OpINotEqual %v4bool %45 %17 + %40 = OpSelect %v4uint %41 %47 %17 + %48 = OpLoad %v4uint %x + %49 = OpShiftRightLogical %v4uint %48 %40 + OpStore %x %49 + %52 = OpLoad %v4uint %x + %55 = OpBitwiseAnd %v4uint %52 %54 + %51 = OpINotEqual %v4bool %55 %17 + %50 = OpSelect %v4uint %51 %57 %17 + %58 = OpLoad %v4uint %x + %59 = OpShiftRightLogical %v4uint %58 %50 + OpStore %x %59 + %62 = OpLoad %v4uint %x + %63 = OpBitwiseAnd %v4uint %62 %57 + %61 = OpINotEqual %v4bool %63 %17 + %60 = OpSelect %v4uint %61 %65 %17 + %67 = OpLoad %v4uint %x + %68 = OpIEqual %v4bool %67 %17 + %66 = OpSelect %v4uint %68 %70 %17 + %72 = OpBitwiseOr %v4uint %18 %30 + %73 = OpBitwiseOr %v4uint %72 %40 + %74 = OpBitwiseOr %v4uint %73 %50 + %75 = OpBitwiseOr %v4uint %74 %60 + %76 = OpBitwiseOr %v4uint %75 %66 + OpReturnValue %76 + OpFunctionEnd +%firstLeadingBit_000ff3 = OpFunction %void None %77 + %80 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4uint Function %17 + %res = OpVariable %_ptr_Function_v4uint Function %17 + OpStore %arg_0 %17 + %83 = OpLoad %v4uint %arg_0 + %82 = OpFunctionCall %v4uint %tint_first_leading_bit %83 + OpStore %res %82 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %85 + %87 = OpLabel + %88 = OpFunctionCall %void %firstLeadingBit_000ff3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %77 + %90 = OpLabel + %91 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %91 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %77 + %94 = OpLabel + %95 = OpFunctionCall %void %firstLeadingBit_000ff3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %77 + %97 = OpLabel + %98 = OpFunctionCall %void %firstLeadingBit_000ff3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/firstLeadingBit/000ff3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/firstLeadingBit/000ff3.wgsl.expected.wgsl new file mode 100644 index 0000000000..d0c3dfca9a --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/000ff3.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn firstLeadingBit_000ff3() { + var arg_0 = vec4(); + var res : vec4 = firstLeadingBit(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + firstLeadingBit_000ff3(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + firstLeadingBit_000ff3(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + firstLeadingBit_000ff3(); +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/35053e.wgsl b/test/tint/builtins/gen/var/firstLeadingBit/35053e.wgsl new file mode 100644 index 0000000000..9ff1c99fc2 --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/35053e.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn firstLeadingBit(vec<3, i32>) -> vec<3, i32> +fn firstLeadingBit_35053e() { + var arg_0 = vec3(); + var res: vec3 = firstLeadingBit(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + firstLeadingBit_35053e(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + firstLeadingBit_35053e(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + firstLeadingBit_35053e(); +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/35053e.wgsl.expected.glsl b/test/tint/builtins/gen/var/firstLeadingBit/35053e.wgsl.expected.glsl new file mode 100644 index 0000000000..180ee53749 --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/35053e.wgsl.expected.glsl @@ -0,0 +1,97 @@ +#version 310 es + +ivec3 tint_first_leading_bit(ivec3 v) { + uvec3 x = mix(uvec3(v), uvec3(~(v)), lessThan(v, ivec3(0))); + uvec3 b16 = mix(uvec3(0u), uvec3(16u), bvec3((x & uvec3(4294901760u)))); + x = (x >> b16); + uvec3 b8 = mix(uvec3(0u), uvec3(8u), bvec3((x & uvec3(65280u)))); + x = (x >> b8); + uvec3 b4 = mix(uvec3(0u), uvec3(4u), bvec3((x & uvec3(240u)))); + x = (x >> b4); + uvec3 b2 = mix(uvec3(0u), uvec3(2u), bvec3((x & uvec3(12u)))); + x = (x >> b2); + uvec3 b1 = mix(uvec3(0u), uvec3(1u), bvec3((x & uvec3(2u)))); + uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u))); + return ivec3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_35053e() { + ivec3 arg_0 = ivec3(0); + ivec3 res = tint_first_leading_bit(arg_0); +} + +vec4 vertex_main() { + firstLeadingBit_35053e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +ivec3 tint_first_leading_bit(ivec3 v) { + uvec3 x = mix(uvec3(v), uvec3(~(v)), lessThan(v, ivec3(0))); + uvec3 b16 = mix(uvec3(0u), uvec3(16u), bvec3((x & uvec3(4294901760u)))); + x = (x >> b16); + uvec3 b8 = mix(uvec3(0u), uvec3(8u), bvec3((x & uvec3(65280u)))); + x = (x >> b8); + uvec3 b4 = mix(uvec3(0u), uvec3(4u), bvec3((x & uvec3(240u)))); + x = (x >> b4); + uvec3 b2 = mix(uvec3(0u), uvec3(2u), bvec3((x & uvec3(12u)))); + x = (x >> b2); + uvec3 b1 = mix(uvec3(0u), uvec3(1u), bvec3((x & uvec3(2u)))); + uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u))); + return ivec3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_35053e() { + ivec3 arg_0 = ivec3(0); + ivec3 res = tint_first_leading_bit(arg_0); +} + +void fragment_main() { + firstLeadingBit_35053e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +ivec3 tint_first_leading_bit(ivec3 v) { + uvec3 x = mix(uvec3(v), uvec3(~(v)), lessThan(v, ivec3(0))); + uvec3 b16 = mix(uvec3(0u), uvec3(16u), bvec3((x & uvec3(4294901760u)))); + x = (x >> b16); + uvec3 b8 = mix(uvec3(0u), uvec3(8u), bvec3((x & uvec3(65280u)))); + x = (x >> b8); + uvec3 b4 = mix(uvec3(0u), uvec3(4u), bvec3((x & uvec3(240u)))); + x = (x >> b4); + uvec3 b2 = mix(uvec3(0u), uvec3(2u), bvec3((x & uvec3(12u)))); + x = (x >> b2); + uvec3 b1 = mix(uvec3(0u), uvec3(1u), bvec3((x & uvec3(2u)))); + uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u))); + return ivec3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_35053e() { + ivec3 arg_0 = ivec3(0); + ivec3 res = tint_first_leading_bit(arg_0); +} + +void compute_main() { + firstLeadingBit_35053e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/35053e.wgsl.expected.hlsl b/test/tint/builtins/gen/var/firstLeadingBit/35053e.wgsl.expected.hlsl new file mode 100644 index 0000000000..f514b46a87 --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/35053e.wgsl.expected.hlsl @@ -0,0 +1,46 @@ +int3 tint_first_leading_bit(int3 v) { + uint3 x = ((v < (0).xxx) ? uint3(~(v)) : uint3(v)); + const uint3 b16 = (bool3((x & (4294901760u).xxx)) ? (16u).xxx : (0u).xxx); + x = (x >> b16); + const uint3 b8 = (bool3((x & (65280u).xxx)) ? (8u).xxx : (0u).xxx); + x = (x >> b8); + const uint3 b4 = (bool3((x & (240u).xxx)) ? (4u).xxx : (0u).xxx); + x = (x >> b4); + const uint3 b2 = (bool3((x & (12u).xxx)) ? (2u).xxx : (0u).xxx); + x = (x >> b2); + const uint3 b1 = (bool3((x & (2u).xxx)) ? (1u).xxx : (0u).xxx); + const uint3 is_zero = ((x == (0u).xxx) ? (4294967295u).xxx : (0u).xxx); + return int3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_35053e() { + int3 arg_0 = (0).xxx; + int3 res = tint_first_leading_bit(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstLeadingBit_35053e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstLeadingBit_35053e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstLeadingBit_35053e(); + return; +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/35053e.wgsl.expected.msl b/test/tint/builtins/gen/var/firstLeadingBit/35053e.wgsl.expected.msl new file mode 100644 index 0000000000..73d3d90ba9 --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/35053e.wgsl.expected.msl @@ -0,0 +1,49 @@ +#include + +using namespace metal; +int3 tint_first_leading_bit(int3 v) { + uint3 x = select(uint3(v), uint3(~(v)), (v < int3(0))); + uint3 const b16 = select(uint3(0u), uint3(16u), bool3((x & uint3(4294901760u)))); + x = (x >> b16); + uint3 const b8 = select(uint3(0u), uint3(8u), bool3((x & uint3(65280u)))); + x = (x >> b8); + uint3 const b4 = select(uint3(0u), uint3(4u), bool3((x & uint3(240u)))); + x = (x >> b4); + uint3 const b2 = select(uint3(0u), uint3(2u), bool3((x & uint3(12u)))); + x = (x >> b2); + uint3 const b1 = select(uint3(0u), uint3(1u), bool3((x & uint3(2u)))); + uint3 const is_zero = select(uint3(0u), uint3(4294967295u), (x == uint3(0u))); + return int3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_35053e() { + int3 arg_0 = int3(0); + int3 res = tint_first_leading_bit(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + firstLeadingBit_35053e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + firstLeadingBit_35053e(); + return; +} + +kernel void compute_main() { + firstLeadingBit_35053e(); + return; +} + diff --git a/test/tint/builtins/gen/var/firstLeadingBit/35053e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/firstLeadingBit/35053e.wgsl.expected.spvasm new file mode 100644 index 0000000000..f076535f5e --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/35053e.wgsl.expected.spvasm @@ -0,0 +1,154 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 108 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_first_leading_bit "tint_first_leading_bit" + OpName %v "v" + OpName %x "x" + OpName %firstLeadingBit_35053e "firstLeadingBit_35053e" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %9 = OpTypeFunction %v3int %v3int + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %18 = OpConstantNull %v3int + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %27 = OpConstantNull %v3uint +%uint_4294901760 = OpConstant %uint 4294901760 + %32 = OpConstantComposite %v3uint %uint_4294901760 %uint_4294901760 %uint_4294901760 + %uint_16 = OpConstant %uint 16 + %35 = OpConstantComposite %v3uint %uint_16 %uint_16 %uint_16 + %uint_65280 = OpConstant %uint 65280 + %42 = OpConstantComposite %v3uint %uint_65280 %uint_65280 %uint_65280 + %uint_8 = OpConstant %uint 8 + %45 = OpConstantComposite %v3uint %uint_8 %uint_8 %uint_8 + %uint_240 = OpConstant %uint 240 + %52 = OpConstantComposite %v3uint %uint_240 %uint_240 %uint_240 + %uint_4 = OpConstant %uint 4 + %55 = OpConstantComposite %v3uint %uint_4 %uint_4 %uint_4 + %uint_12 = OpConstant %uint 12 + %62 = OpConstantComposite %v3uint %uint_12 %uint_12 %uint_12 + %uint_2 = OpConstant %uint 2 + %65 = OpConstantComposite %v3uint %uint_2 %uint_2 %uint_2 + %uint_1 = OpConstant %uint 1 + %73 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 +%uint_4294967295 = OpConstant %uint 4294967295 + %78 = OpConstantComposite %v3uint %uint_4294967295 %uint_4294967295 %uint_4294967295 + %void = OpTypeVoid + %85 = OpTypeFunction %void +%_ptr_Function_v3int = OpTypePointer Function %v3int + %94 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_first_leading_bit = OpFunction %v3int None %9 + %v = OpFunctionParameter %v3int + %14 = OpLabel + %x = OpVariable %_ptr_Function_v3uint Function %27 + %19 = OpSLessThan %v3bool %v %18 + %23 = OpNot %v3int %v + %22 = OpBitcast %v3uint %23 + %24 = OpBitcast %v3uint %v + %15 = OpSelect %v3uint %19 %22 %24 + OpStore %x %15 + %30 = OpLoad %v3uint %x + %33 = OpBitwiseAnd %v3uint %30 %32 + %29 = OpINotEqual %v3bool %33 %27 + %28 = OpSelect %v3uint %29 %35 %27 + %36 = OpLoad %v3uint %x + %37 = OpShiftRightLogical %v3uint %36 %28 + OpStore %x %37 + %40 = OpLoad %v3uint %x + %43 = OpBitwiseAnd %v3uint %40 %42 + %39 = OpINotEqual %v3bool %43 %27 + %38 = OpSelect %v3uint %39 %45 %27 + %46 = OpLoad %v3uint %x + %47 = OpShiftRightLogical %v3uint %46 %38 + OpStore %x %47 + %50 = OpLoad %v3uint %x + %53 = OpBitwiseAnd %v3uint %50 %52 + %49 = OpINotEqual %v3bool %53 %27 + %48 = OpSelect %v3uint %49 %55 %27 + %56 = OpLoad %v3uint %x + %57 = OpShiftRightLogical %v3uint %56 %48 + OpStore %x %57 + %60 = OpLoad %v3uint %x + %63 = OpBitwiseAnd %v3uint %60 %62 + %59 = OpINotEqual %v3bool %63 %27 + %58 = OpSelect %v3uint %59 %65 %27 + %66 = OpLoad %v3uint %x + %67 = OpShiftRightLogical %v3uint %66 %58 + OpStore %x %67 + %70 = OpLoad %v3uint %x + %71 = OpBitwiseAnd %v3uint %70 %65 + %69 = OpINotEqual %v3bool %71 %27 + %68 = OpSelect %v3uint %69 %73 %27 + %75 = OpLoad %v3uint %x + %76 = OpIEqual %v3bool %75 %27 + %74 = OpSelect %v3uint %76 %78 %27 + %80 = OpBitwiseOr %v3uint %28 %38 + %81 = OpBitwiseOr %v3uint %80 %48 + %82 = OpBitwiseOr %v3uint %81 %58 + %83 = OpBitwiseOr %v3uint %82 %68 + %84 = OpBitwiseOr %v3uint %83 %74 + %79 = OpBitcast %v3int %84 + OpReturnValue %79 + OpFunctionEnd +%firstLeadingBit_35053e = OpFunction %void None %85 + %88 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3int Function %18 + %res = OpVariable %_ptr_Function_v3int Function %18 + OpStore %arg_0 %18 + %92 = OpLoad %v3int %arg_0 + %91 = OpFunctionCall %v3int %tint_first_leading_bit %92 + OpStore %res %91 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %94 + %96 = OpLabel + %97 = OpFunctionCall %void %firstLeadingBit_35053e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %85 + %99 = OpLabel + %100 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %100 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %85 + %103 = OpLabel + %104 = OpFunctionCall %void %firstLeadingBit_35053e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %85 + %106 = OpLabel + %107 = OpFunctionCall %void %firstLeadingBit_35053e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/firstLeadingBit/35053e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/firstLeadingBit/35053e.wgsl.expected.wgsl new file mode 100644 index 0000000000..c191cc001b --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/35053e.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn firstLeadingBit_35053e() { + var arg_0 = vec3(); + var res : vec3 = firstLeadingBit(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + firstLeadingBit_35053e(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + firstLeadingBit_35053e(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + firstLeadingBit_35053e(); +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/3fd7d0.wgsl b/test/tint/builtins/gen/var/firstLeadingBit/3fd7d0.wgsl new file mode 100644 index 0000000000..15595a1a19 --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/3fd7d0.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn firstLeadingBit(vec<3, u32>) -> vec<3, u32> +fn firstLeadingBit_3fd7d0() { + var arg_0 = vec3(); + var res: vec3 = firstLeadingBit(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + firstLeadingBit_3fd7d0(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + firstLeadingBit_3fd7d0(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + firstLeadingBit_3fd7d0(); +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/3fd7d0.wgsl.expected.glsl b/test/tint/builtins/gen/var/firstLeadingBit/3fd7d0.wgsl.expected.glsl new file mode 100644 index 0000000000..0a9b223a14 --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/3fd7d0.wgsl.expected.glsl @@ -0,0 +1,97 @@ +#version 310 es + +uvec3 tint_first_leading_bit(uvec3 v) { + uvec3 x = v; + uvec3 b16 = mix(uvec3(0u), uvec3(16u), bvec3((x & uvec3(4294901760u)))); + x = (x >> b16); + uvec3 b8 = mix(uvec3(0u), uvec3(8u), bvec3((x & uvec3(65280u)))); + x = (x >> b8); + uvec3 b4 = mix(uvec3(0u), uvec3(4u), bvec3((x & uvec3(240u)))); + x = (x >> b4); + uvec3 b2 = mix(uvec3(0u), uvec3(2u), bvec3((x & uvec3(12u)))); + x = (x >> b2); + uvec3 b1 = mix(uvec3(0u), uvec3(1u), bvec3((x & uvec3(2u)))); + uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u))); + return uvec3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_3fd7d0() { + uvec3 arg_0 = uvec3(0u); + uvec3 res = tint_first_leading_bit(arg_0); +} + +vec4 vertex_main() { + firstLeadingBit_3fd7d0(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uvec3 tint_first_leading_bit(uvec3 v) { + uvec3 x = v; + uvec3 b16 = mix(uvec3(0u), uvec3(16u), bvec3((x & uvec3(4294901760u)))); + x = (x >> b16); + uvec3 b8 = mix(uvec3(0u), uvec3(8u), bvec3((x & uvec3(65280u)))); + x = (x >> b8); + uvec3 b4 = mix(uvec3(0u), uvec3(4u), bvec3((x & uvec3(240u)))); + x = (x >> b4); + uvec3 b2 = mix(uvec3(0u), uvec3(2u), bvec3((x & uvec3(12u)))); + x = (x >> b2); + uvec3 b1 = mix(uvec3(0u), uvec3(1u), bvec3((x & uvec3(2u)))); + uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u))); + return uvec3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_3fd7d0() { + uvec3 arg_0 = uvec3(0u); + uvec3 res = tint_first_leading_bit(arg_0); +} + +void fragment_main() { + firstLeadingBit_3fd7d0(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uvec3 tint_first_leading_bit(uvec3 v) { + uvec3 x = v; + uvec3 b16 = mix(uvec3(0u), uvec3(16u), bvec3((x & uvec3(4294901760u)))); + x = (x >> b16); + uvec3 b8 = mix(uvec3(0u), uvec3(8u), bvec3((x & uvec3(65280u)))); + x = (x >> b8); + uvec3 b4 = mix(uvec3(0u), uvec3(4u), bvec3((x & uvec3(240u)))); + x = (x >> b4); + uvec3 b2 = mix(uvec3(0u), uvec3(2u), bvec3((x & uvec3(12u)))); + x = (x >> b2); + uvec3 b1 = mix(uvec3(0u), uvec3(1u), bvec3((x & uvec3(2u)))); + uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u))); + return uvec3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_3fd7d0() { + uvec3 arg_0 = uvec3(0u); + uvec3 res = tint_first_leading_bit(arg_0); +} + +void compute_main() { + firstLeadingBit_3fd7d0(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/3fd7d0.wgsl.expected.hlsl b/test/tint/builtins/gen/var/firstLeadingBit/3fd7d0.wgsl.expected.hlsl new file mode 100644 index 0000000000..626469192f --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/3fd7d0.wgsl.expected.hlsl @@ -0,0 +1,46 @@ +uint3 tint_first_leading_bit(uint3 v) { + uint3 x = v; + const uint3 b16 = (bool3((x & (4294901760u).xxx)) ? (16u).xxx : (0u).xxx); + x = (x >> b16); + const uint3 b8 = (bool3((x & (65280u).xxx)) ? (8u).xxx : (0u).xxx); + x = (x >> b8); + const uint3 b4 = (bool3((x & (240u).xxx)) ? (4u).xxx : (0u).xxx); + x = (x >> b4); + const uint3 b2 = (bool3((x & (12u).xxx)) ? (2u).xxx : (0u).xxx); + x = (x >> b2); + const uint3 b1 = (bool3((x & (2u).xxx)) ? (1u).xxx : (0u).xxx); + const uint3 is_zero = ((x == (0u).xxx) ? (4294967295u).xxx : (0u).xxx); + return uint3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_3fd7d0() { + uint3 arg_0 = (0u).xxx; + uint3 res = tint_first_leading_bit(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstLeadingBit_3fd7d0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstLeadingBit_3fd7d0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstLeadingBit_3fd7d0(); + return; +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/3fd7d0.wgsl.expected.msl b/test/tint/builtins/gen/var/firstLeadingBit/3fd7d0.wgsl.expected.msl new file mode 100644 index 0000000000..2d31007ebd --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/3fd7d0.wgsl.expected.msl @@ -0,0 +1,49 @@ +#include + +using namespace metal; +uint3 tint_first_leading_bit(uint3 v) { + uint3 x = v; + uint3 const b16 = select(uint3(0u), uint3(16u), bool3((x & uint3(4294901760u)))); + x = (x >> b16); + uint3 const b8 = select(uint3(0u), uint3(8u), bool3((x & uint3(65280u)))); + x = (x >> b8); + uint3 const b4 = select(uint3(0u), uint3(4u), bool3((x & uint3(240u)))); + x = (x >> b4); + uint3 const b2 = select(uint3(0u), uint3(2u), bool3((x & uint3(12u)))); + x = (x >> b2); + uint3 const b1 = select(uint3(0u), uint3(1u), bool3((x & uint3(2u)))); + uint3 const is_zero = select(uint3(0u), uint3(4294967295u), (x == uint3(0u))); + return uint3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_3fd7d0() { + uint3 arg_0 = uint3(0u); + uint3 res = tint_first_leading_bit(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + firstLeadingBit_3fd7d0(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + firstLeadingBit_3fd7d0(); + return; +} + +kernel void compute_main() { + firstLeadingBit_3fd7d0(); + return; +} + diff --git a/test/tint/builtins/gen/var/firstLeadingBit/3fd7d0.wgsl.expected.spvasm b/test/tint/builtins/gen/var/firstLeadingBit/3fd7d0.wgsl.expected.spvasm new file mode 100644 index 0000000000..ac50c76896 --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/3fd7d0.wgsl.expected.spvasm @@ -0,0 +1,144 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 99 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_first_leading_bit "tint_first_leading_bit" + OpName %v "v" + OpName %x "x" + OpName %firstLeadingBit_3fd7d0 "firstLeadingBit_3fd7d0" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %9 = OpTypeFunction %v3uint %v3uint +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %17 = OpConstantNull %v3uint + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 +%uint_4294901760 = OpConstant %uint 4294901760 + %24 = OpConstantComposite %v3uint %uint_4294901760 %uint_4294901760 %uint_4294901760 + %uint_16 = OpConstant %uint 16 + %27 = OpConstantComposite %v3uint %uint_16 %uint_16 %uint_16 + %uint_65280 = OpConstant %uint 65280 + %34 = OpConstantComposite %v3uint %uint_65280 %uint_65280 %uint_65280 + %uint_8 = OpConstant %uint 8 + %37 = OpConstantComposite %v3uint %uint_8 %uint_8 %uint_8 + %uint_240 = OpConstant %uint 240 + %44 = OpConstantComposite %v3uint %uint_240 %uint_240 %uint_240 + %uint_4 = OpConstant %uint 4 + %47 = OpConstantComposite %v3uint %uint_4 %uint_4 %uint_4 + %uint_12 = OpConstant %uint 12 + %54 = OpConstantComposite %v3uint %uint_12 %uint_12 %uint_12 + %uint_2 = OpConstant %uint 2 + %57 = OpConstantComposite %v3uint %uint_2 %uint_2 %uint_2 + %uint_1 = OpConstant %uint 1 + %65 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 +%uint_4294967295 = OpConstant %uint 4294967295 + %70 = OpConstantComposite %v3uint %uint_4294967295 %uint_4294967295 %uint_4294967295 + %void = OpTypeVoid + %77 = OpTypeFunction %void + %85 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_first_leading_bit = OpFunction %v3uint None %9 + %v = OpFunctionParameter %v3uint + %14 = OpLabel + %x = OpVariable %_ptr_Function_v3uint Function %17 + OpStore %x %v + %22 = OpLoad %v3uint %x + %25 = OpBitwiseAnd %v3uint %22 %24 + %19 = OpINotEqual %v3bool %25 %17 + %18 = OpSelect %v3uint %19 %27 %17 + %28 = OpLoad %v3uint %x + %29 = OpShiftRightLogical %v3uint %28 %18 + OpStore %x %29 + %32 = OpLoad %v3uint %x + %35 = OpBitwiseAnd %v3uint %32 %34 + %31 = OpINotEqual %v3bool %35 %17 + %30 = OpSelect %v3uint %31 %37 %17 + %38 = OpLoad %v3uint %x + %39 = OpShiftRightLogical %v3uint %38 %30 + OpStore %x %39 + %42 = OpLoad %v3uint %x + %45 = OpBitwiseAnd %v3uint %42 %44 + %41 = OpINotEqual %v3bool %45 %17 + %40 = OpSelect %v3uint %41 %47 %17 + %48 = OpLoad %v3uint %x + %49 = OpShiftRightLogical %v3uint %48 %40 + OpStore %x %49 + %52 = OpLoad %v3uint %x + %55 = OpBitwiseAnd %v3uint %52 %54 + %51 = OpINotEqual %v3bool %55 %17 + %50 = OpSelect %v3uint %51 %57 %17 + %58 = OpLoad %v3uint %x + %59 = OpShiftRightLogical %v3uint %58 %50 + OpStore %x %59 + %62 = OpLoad %v3uint %x + %63 = OpBitwiseAnd %v3uint %62 %57 + %61 = OpINotEqual %v3bool %63 %17 + %60 = OpSelect %v3uint %61 %65 %17 + %67 = OpLoad %v3uint %x + %68 = OpIEqual %v3bool %67 %17 + %66 = OpSelect %v3uint %68 %70 %17 + %72 = OpBitwiseOr %v3uint %18 %30 + %73 = OpBitwiseOr %v3uint %72 %40 + %74 = OpBitwiseOr %v3uint %73 %50 + %75 = OpBitwiseOr %v3uint %74 %60 + %76 = OpBitwiseOr %v3uint %75 %66 + OpReturnValue %76 + OpFunctionEnd +%firstLeadingBit_3fd7d0 = OpFunction %void None %77 + %80 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3uint Function %17 + %res = OpVariable %_ptr_Function_v3uint Function %17 + OpStore %arg_0 %17 + %83 = OpLoad %v3uint %arg_0 + %82 = OpFunctionCall %v3uint %tint_first_leading_bit %83 + OpStore %res %82 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %85 + %87 = OpLabel + %88 = OpFunctionCall %void %firstLeadingBit_3fd7d0 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %77 + %90 = OpLabel + %91 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %91 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %77 + %94 = OpLabel + %95 = OpFunctionCall %void %firstLeadingBit_3fd7d0 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %77 + %97 = OpLabel + %98 = OpFunctionCall %void %firstLeadingBit_3fd7d0 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/firstLeadingBit/3fd7d0.wgsl.expected.wgsl b/test/tint/builtins/gen/var/firstLeadingBit/3fd7d0.wgsl.expected.wgsl new file mode 100644 index 0000000000..3f079f91ce --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/3fd7d0.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn firstLeadingBit_3fd7d0() { + var arg_0 = vec3(); + var res : vec3 = firstLeadingBit(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + firstLeadingBit_3fd7d0(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + firstLeadingBit_3fd7d0(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + firstLeadingBit_3fd7d0(); +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/57a1a3.wgsl b/test/tint/builtins/gen/var/firstLeadingBit/57a1a3.wgsl new file mode 100644 index 0000000000..c6e63f57d9 --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/57a1a3.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn firstLeadingBit(i32) -> i32 +fn firstLeadingBit_57a1a3() { + var arg_0 = 1; + var res: i32 = firstLeadingBit(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + firstLeadingBit_57a1a3(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + firstLeadingBit_57a1a3(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + firstLeadingBit_57a1a3(); +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/57a1a3.wgsl.expected.glsl b/test/tint/builtins/gen/var/firstLeadingBit/57a1a3.wgsl.expected.glsl new file mode 100644 index 0000000000..5a738fc670 --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/57a1a3.wgsl.expected.glsl @@ -0,0 +1,97 @@ +#version 310 es + +int tint_first_leading_bit(int v) { + uint x = ((v < 0) ? uint(~(v)) : uint(v)); + uint b16 = (bool((x & 4294901760u)) ? 16u : 0u); + x = (x >> b16); + uint b8 = (bool((x & 65280u)) ? 8u : 0u); + x = (x >> b8); + uint b4 = (bool((x & 240u)) ? 4u : 0u); + x = (x >> b4); + uint b2 = (bool((x & 12u)) ? 2u : 0u); + x = (x >> b2); + uint b1 = (bool((x & 2u)) ? 1u : 0u); + uint is_zero = ((x == 0u) ? 4294967295u : 0u); + return int((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_57a1a3() { + int arg_0 = 1; + int res = tint_first_leading_bit(arg_0); +} + +vec4 vertex_main() { + firstLeadingBit_57a1a3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +int tint_first_leading_bit(int v) { + uint x = ((v < 0) ? uint(~(v)) : uint(v)); + uint b16 = (bool((x & 4294901760u)) ? 16u : 0u); + x = (x >> b16); + uint b8 = (bool((x & 65280u)) ? 8u : 0u); + x = (x >> b8); + uint b4 = (bool((x & 240u)) ? 4u : 0u); + x = (x >> b4); + uint b2 = (bool((x & 12u)) ? 2u : 0u); + x = (x >> b2); + uint b1 = (bool((x & 2u)) ? 1u : 0u); + uint is_zero = ((x == 0u) ? 4294967295u : 0u); + return int((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_57a1a3() { + int arg_0 = 1; + int res = tint_first_leading_bit(arg_0); +} + +void fragment_main() { + firstLeadingBit_57a1a3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +int tint_first_leading_bit(int v) { + uint x = ((v < 0) ? uint(~(v)) : uint(v)); + uint b16 = (bool((x & 4294901760u)) ? 16u : 0u); + x = (x >> b16); + uint b8 = (bool((x & 65280u)) ? 8u : 0u); + x = (x >> b8); + uint b4 = (bool((x & 240u)) ? 4u : 0u); + x = (x >> b4); + uint b2 = (bool((x & 12u)) ? 2u : 0u); + x = (x >> b2); + uint b1 = (bool((x & 2u)) ? 1u : 0u); + uint is_zero = ((x == 0u) ? 4294967295u : 0u); + return int((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_57a1a3() { + int arg_0 = 1; + int res = tint_first_leading_bit(arg_0); +} + +void compute_main() { + firstLeadingBit_57a1a3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/57a1a3.wgsl.expected.hlsl b/test/tint/builtins/gen/var/firstLeadingBit/57a1a3.wgsl.expected.hlsl new file mode 100644 index 0000000000..34f27f0b54 --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/57a1a3.wgsl.expected.hlsl @@ -0,0 +1,46 @@ +int tint_first_leading_bit(int v) { + uint x = ((v < 0) ? uint(~(v)) : uint(v)); + const uint b16 = (bool((x & 4294901760u)) ? 16u : 0u); + x = (x >> b16); + const uint b8 = (bool((x & 65280u)) ? 8u : 0u); + x = (x >> b8); + const uint b4 = (bool((x & 240u)) ? 4u : 0u); + x = (x >> b4); + const uint b2 = (bool((x & 12u)) ? 2u : 0u); + x = (x >> b2); + const uint b1 = (bool((x & 2u)) ? 1u : 0u); + const uint is_zero = ((x == 0u) ? 4294967295u : 0u); + return int((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_57a1a3() { + int arg_0 = 1; + int res = tint_first_leading_bit(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstLeadingBit_57a1a3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstLeadingBit_57a1a3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstLeadingBit_57a1a3(); + return; +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/57a1a3.wgsl.expected.msl b/test/tint/builtins/gen/var/firstLeadingBit/57a1a3.wgsl.expected.msl new file mode 100644 index 0000000000..cb6e84db64 --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/57a1a3.wgsl.expected.msl @@ -0,0 +1,49 @@ +#include + +using namespace metal; +int tint_first_leading_bit(int v) { + uint x = select(uint(v), uint(~(v)), (v < 0)); + uint const b16 = select(0u, 16u, bool((x & 4294901760u))); + x = (x >> b16); + uint const b8 = select(0u, 8u, bool((x & 65280u))); + x = (x >> b8); + uint const b4 = select(0u, 4u, bool((x & 240u))); + x = (x >> b4); + uint const b2 = select(0u, 2u, bool((x & 12u))); + x = (x >> b2); + uint const b1 = select(0u, 1u, bool((x & 2u))); + uint const is_zero = select(0u, 4294967295u, (x == 0u)); + return int((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_57a1a3() { + int arg_0 = 1; + int res = tint_first_leading_bit(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + firstLeadingBit_57a1a3(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + firstLeadingBit_57a1a3(); + return; +} + +kernel void compute_main() { + firstLeadingBit_57a1a3(); + return; +} + diff --git a/test/tint/builtins/gen/var/firstLeadingBit/57a1a3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/firstLeadingBit/57a1a3.wgsl.expected.spvasm new file mode 100644 index 0000000000..8f38eac2b4 --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/57a1a3.wgsl.expected.spvasm @@ -0,0 +1,142 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 96 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_first_leading_bit "tint_first_leading_bit" + OpName %v "v" + OpName %x "x" + OpName %firstLeadingBit_57a1a3 "firstLeadingBit_57a1a3" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %9 = OpTypeFunction %int %int + %uint = OpTypeInt 32 0 + %16 = OpConstantNull %int + %bool = OpTypeBool +%_ptr_Function_uint = OpTypePointer Function %uint + %24 = OpConstantNull %uint +%uint_4294901760 = OpConstant %uint 4294901760 + %uint_16 = OpConstant %uint 16 + %uint_65280 = OpConstant %uint 65280 + %uint_8 = OpConstant %uint 8 + %uint_240 = OpConstant %uint 240 + %uint_4 = OpConstant %uint 4 + %uint_12 = OpConstant %uint 12 + %uint_2 = OpConstant %uint 2 + %uint_1 = OpConstant %uint 1 +%uint_4294967295 = OpConstant %uint 4294967295 + %void = OpTypeVoid + %72 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %82 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_first_leading_bit = OpFunction %int None %9 + %v = OpFunctionParameter %int + %13 = OpLabel + %x = OpVariable %_ptr_Function_uint Function %24 + %17 = OpSLessThan %bool %v %16 + %20 = OpNot %int %v + %19 = OpBitcast %uint %20 + %21 = OpBitcast %uint %v + %14 = OpSelect %uint %17 %19 %21 + OpStore %x %14 + %27 = OpLoad %uint %x + %29 = OpBitwiseAnd %uint %27 %uint_4294901760 + %26 = OpINotEqual %bool %29 %24 + %25 = OpSelect %uint %26 %uint_16 %24 + %31 = OpLoad %uint %x + %32 = OpShiftRightLogical %uint %31 %25 + OpStore %x %32 + %35 = OpLoad %uint %x + %37 = OpBitwiseAnd %uint %35 %uint_65280 + %34 = OpINotEqual %bool %37 %24 + %33 = OpSelect %uint %34 %uint_8 %24 + %39 = OpLoad %uint %x + %40 = OpShiftRightLogical %uint %39 %33 + OpStore %x %40 + %43 = OpLoad %uint %x + %45 = OpBitwiseAnd %uint %43 %uint_240 + %42 = OpINotEqual %bool %45 %24 + %41 = OpSelect %uint %42 %uint_4 %24 + %47 = OpLoad %uint %x + %48 = OpShiftRightLogical %uint %47 %41 + OpStore %x %48 + %51 = OpLoad %uint %x + %53 = OpBitwiseAnd %uint %51 %uint_12 + %50 = OpINotEqual %bool %53 %24 + %49 = OpSelect %uint %50 %uint_2 %24 + %55 = OpLoad %uint %x + %56 = OpShiftRightLogical %uint %55 %49 + OpStore %x %56 + %59 = OpLoad %uint %x + %60 = OpBitwiseAnd %uint %59 %uint_2 + %58 = OpINotEqual %bool %60 %24 + %57 = OpSelect %uint %58 %uint_1 %24 + %63 = OpLoad %uint %x + %64 = OpIEqual %bool %63 %24 + %62 = OpSelect %uint %64 %uint_4294967295 %24 + %67 = OpBitwiseOr %uint %25 %33 + %68 = OpBitwiseOr %uint %67 %41 + %69 = OpBitwiseOr %uint %68 %49 + %70 = OpBitwiseOr %uint %69 %57 + %71 = OpBitwiseOr %uint %70 %62 + %66 = OpBitcast %int %71 + OpReturnValue %66 + OpFunctionEnd +%firstLeadingBit_57a1a3 = OpFunction %void None %72 + %75 = OpLabel + %arg_0 = OpVariable %_ptr_Function_int Function %16 + %res = OpVariable %_ptr_Function_int Function %16 + OpStore %arg_0 %int_1 + %80 = OpLoad %int %arg_0 + %79 = OpFunctionCall %int %tint_first_leading_bit %80 + OpStore %res %79 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %82 + %84 = OpLabel + %85 = OpFunctionCall %void %firstLeadingBit_57a1a3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %72 + %87 = OpLabel + %88 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %88 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %72 + %91 = OpLabel + %92 = OpFunctionCall %void %firstLeadingBit_57a1a3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %72 + %94 = OpLabel + %95 = OpFunctionCall %void %firstLeadingBit_57a1a3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/firstLeadingBit/57a1a3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/firstLeadingBit/57a1a3.wgsl.expected.wgsl new file mode 100644 index 0000000000..00fe1f2ea9 --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/57a1a3.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn firstLeadingBit_57a1a3() { + var arg_0 = 1; + var res : i32 = firstLeadingBit(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + firstLeadingBit_57a1a3(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + firstLeadingBit_57a1a3(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + firstLeadingBit_57a1a3(); +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/6fe804.wgsl b/test/tint/builtins/gen/var/firstLeadingBit/6fe804.wgsl new file mode 100644 index 0000000000..483f61882e --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/6fe804.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn firstLeadingBit(vec<2, u32>) -> vec<2, u32> +fn firstLeadingBit_6fe804() { + var arg_0 = vec2(); + var res: vec2 = firstLeadingBit(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + firstLeadingBit_6fe804(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + firstLeadingBit_6fe804(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + firstLeadingBit_6fe804(); +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/6fe804.wgsl.expected.glsl b/test/tint/builtins/gen/var/firstLeadingBit/6fe804.wgsl.expected.glsl new file mode 100644 index 0000000000..e01f3f211b --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/6fe804.wgsl.expected.glsl @@ -0,0 +1,97 @@ +#version 310 es + +uvec2 tint_first_leading_bit(uvec2 v) { + uvec2 x = v; + uvec2 b16 = mix(uvec2(0u), uvec2(16u), bvec2((x & uvec2(4294901760u)))); + x = (x >> b16); + uvec2 b8 = mix(uvec2(0u), uvec2(8u), bvec2((x & uvec2(65280u)))); + x = (x >> b8); + uvec2 b4 = mix(uvec2(0u), uvec2(4u), bvec2((x & uvec2(240u)))); + x = (x >> b4); + uvec2 b2 = mix(uvec2(0u), uvec2(2u), bvec2((x & uvec2(12u)))); + x = (x >> b2); + uvec2 b1 = mix(uvec2(0u), uvec2(1u), bvec2((x & uvec2(2u)))); + uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u))); + return uvec2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_6fe804() { + uvec2 arg_0 = uvec2(0u); + uvec2 res = tint_first_leading_bit(arg_0); +} + +vec4 vertex_main() { + firstLeadingBit_6fe804(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uvec2 tint_first_leading_bit(uvec2 v) { + uvec2 x = v; + uvec2 b16 = mix(uvec2(0u), uvec2(16u), bvec2((x & uvec2(4294901760u)))); + x = (x >> b16); + uvec2 b8 = mix(uvec2(0u), uvec2(8u), bvec2((x & uvec2(65280u)))); + x = (x >> b8); + uvec2 b4 = mix(uvec2(0u), uvec2(4u), bvec2((x & uvec2(240u)))); + x = (x >> b4); + uvec2 b2 = mix(uvec2(0u), uvec2(2u), bvec2((x & uvec2(12u)))); + x = (x >> b2); + uvec2 b1 = mix(uvec2(0u), uvec2(1u), bvec2((x & uvec2(2u)))); + uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u))); + return uvec2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_6fe804() { + uvec2 arg_0 = uvec2(0u); + uvec2 res = tint_first_leading_bit(arg_0); +} + +void fragment_main() { + firstLeadingBit_6fe804(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uvec2 tint_first_leading_bit(uvec2 v) { + uvec2 x = v; + uvec2 b16 = mix(uvec2(0u), uvec2(16u), bvec2((x & uvec2(4294901760u)))); + x = (x >> b16); + uvec2 b8 = mix(uvec2(0u), uvec2(8u), bvec2((x & uvec2(65280u)))); + x = (x >> b8); + uvec2 b4 = mix(uvec2(0u), uvec2(4u), bvec2((x & uvec2(240u)))); + x = (x >> b4); + uvec2 b2 = mix(uvec2(0u), uvec2(2u), bvec2((x & uvec2(12u)))); + x = (x >> b2); + uvec2 b1 = mix(uvec2(0u), uvec2(1u), bvec2((x & uvec2(2u)))); + uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u))); + return uvec2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_6fe804() { + uvec2 arg_0 = uvec2(0u); + uvec2 res = tint_first_leading_bit(arg_0); +} + +void compute_main() { + firstLeadingBit_6fe804(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/6fe804.wgsl.expected.hlsl b/test/tint/builtins/gen/var/firstLeadingBit/6fe804.wgsl.expected.hlsl new file mode 100644 index 0000000000..fa7b9cbeae --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/6fe804.wgsl.expected.hlsl @@ -0,0 +1,46 @@ +uint2 tint_first_leading_bit(uint2 v) { + uint2 x = v; + const uint2 b16 = (bool2((x & (4294901760u).xx)) ? (16u).xx : (0u).xx); + x = (x >> b16); + const uint2 b8 = (bool2((x & (65280u).xx)) ? (8u).xx : (0u).xx); + x = (x >> b8); + const uint2 b4 = (bool2((x & (240u).xx)) ? (4u).xx : (0u).xx); + x = (x >> b4); + const uint2 b2 = (bool2((x & (12u).xx)) ? (2u).xx : (0u).xx); + x = (x >> b2); + const uint2 b1 = (bool2((x & (2u).xx)) ? (1u).xx : (0u).xx); + const uint2 is_zero = ((x == (0u).xx) ? (4294967295u).xx : (0u).xx); + return uint2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_6fe804() { + uint2 arg_0 = (0u).xx; + uint2 res = tint_first_leading_bit(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstLeadingBit_6fe804(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstLeadingBit_6fe804(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstLeadingBit_6fe804(); + return; +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/6fe804.wgsl.expected.msl b/test/tint/builtins/gen/var/firstLeadingBit/6fe804.wgsl.expected.msl new file mode 100644 index 0000000000..0dce90927a --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/6fe804.wgsl.expected.msl @@ -0,0 +1,49 @@ +#include + +using namespace metal; +uint2 tint_first_leading_bit(uint2 v) { + uint2 x = v; + uint2 const b16 = select(uint2(0u), uint2(16u), bool2((x & uint2(4294901760u)))); + x = (x >> b16); + uint2 const b8 = select(uint2(0u), uint2(8u), bool2((x & uint2(65280u)))); + x = (x >> b8); + uint2 const b4 = select(uint2(0u), uint2(4u), bool2((x & uint2(240u)))); + x = (x >> b4); + uint2 const b2 = select(uint2(0u), uint2(2u), bool2((x & uint2(12u)))); + x = (x >> b2); + uint2 const b1 = select(uint2(0u), uint2(1u), bool2((x & uint2(2u)))); + uint2 const is_zero = select(uint2(0u), uint2(4294967295u), (x == uint2(0u))); + return uint2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_6fe804() { + uint2 arg_0 = uint2(0u); + uint2 res = tint_first_leading_bit(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + firstLeadingBit_6fe804(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + firstLeadingBit_6fe804(); + return; +} + +kernel void compute_main() { + firstLeadingBit_6fe804(); + return; +} + diff --git a/test/tint/builtins/gen/var/firstLeadingBit/6fe804.wgsl.expected.spvasm b/test/tint/builtins/gen/var/firstLeadingBit/6fe804.wgsl.expected.spvasm new file mode 100644 index 0000000000..77c6c00d29 --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/6fe804.wgsl.expected.spvasm @@ -0,0 +1,144 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 99 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_first_leading_bit "tint_first_leading_bit" + OpName %v "v" + OpName %x "x" + OpName %firstLeadingBit_6fe804 "firstLeadingBit_6fe804" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %9 = OpTypeFunction %v2uint %v2uint +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %17 = OpConstantNull %v2uint + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 +%uint_4294901760 = OpConstant %uint 4294901760 + %24 = OpConstantComposite %v2uint %uint_4294901760 %uint_4294901760 + %uint_16 = OpConstant %uint 16 + %27 = OpConstantComposite %v2uint %uint_16 %uint_16 + %uint_65280 = OpConstant %uint 65280 + %34 = OpConstantComposite %v2uint %uint_65280 %uint_65280 + %uint_8 = OpConstant %uint 8 + %37 = OpConstantComposite %v2uint %uint_8 %uint_8 + %uint_240 = OpConstant %uint 240 + %44 = OpConstantComposite %v2uint %uint_240 %uint_240 + %uint_4 = OpConstant %uint 4 + %47 = OpConstantComposite %v2uint %uint_4 %uint_4 + %uint_12 = OpConstant %uint 12 + %54 = OpConstantComposite %v2uint %uint_12 %uint_12 + %uint_2 = OpConstant %uint 2 + %57 = OpConstantComposite %v2uint %uint_2 %uint_2 + %uint_1 = OpConstant %uint 1 + %65 = OpConstantComposite %v2uint %uint_1 %uint_1 +%uint_4294967295 = OpConstant %uint 4294967295 + %70 = OpConstantComposite %v2uint %uint_4294967295 %uint_4294967295 + %void = OpTypeVoid + %77 = OpTypeFunction %void + %85 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_first_leading_bit = OpFunction %v2uint None %9 + %v = OpFunctionParameter %v2uint + %14 = OpLabel + %x = OpVariable %_ptr_Function_v2uint Function %17 + OpStore %x %v + %22 = OpLoad %v2uint %x + %25 = OpBitwiseAnd %v2uint %22 %24 + %19 = OpINotEqual %v2bool %25 %17 + %18 = OpSelect %v2uint %19 %27 %17 + %28 = OpLoad %v2uint %x + %29 = OpShiftRightLogical %v2uint %28 %18 + OpStore %x %29 + %32 = OpLoad %v2uint %x + %35 = OpBitwiseAnd %v2uint %32 %34 + %31 = OpINotEqual %v2bool %35 %17 + %30 = OpSelect %v2uint %31 %37 %17 + %38 = OpLoad %v2uint %x + %39 = OpShiftRightLogical %v2uint %38 %30 + OpStore %x %39 + %42 = OpLoad %v2uint %x + %45 = OpBitwiseAnd %v2uint %42 %44 + %41 = OpINotEqual %v2bool %45 %17 + %40 = OpSelect %v2uint %41 %47 %17 + %48 = OpLoad %v2uint %x + %49 = OpShiftRightLogical %v2uint %48 %40 + OpStore %x %49 + %52 = OpLoad %v2uint %x + %55 = OpBitwiseAnd %v2uint %52 %54 + %51 = OpINotEqual %v2bool %55 %17 + %50 = OpSelect %v2uint %51 %57 %17 + %58 = OpLoad %v2uint %x + %59 = OpShiftRightLogical %v2uint %58 %50 + OpStore %x %59 + %62 = OpLoad %v2uint %x + %63 = OpBitwiseAnd %v2uint %62 %57 + %61 = OpINotEqual %v2bool %63 %17 + %60 = OpSelect %v2uint %61 %65 %17 + %67 = OpLoad %v2uint %x + %68 = OpIEqual %v2bool %67 %17 + %66 = OpSelect %v2uint %68 %70 %17 + %72 = OpBitwiseOr %v2uint %18 %30 + %73 = OpBitwiseOr %v2uint %72 %40 + %74 = OpBitwiseOr %v2uint %73 %50 + %75 = OpBitwiseOr %v2uint %74 %60 + %76 = OpBitwiseOr %v2uint %75 %66 + OpReturnValue %76 + OpFunctionEnd +%firstLeadingBit_6fe804 = OpFunction %void None %77 + %80 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2uint Function %17 + %res = OpVariable %_ptr_Function_v2uint Function %17 + OpStore %arg_0 %17 + %83 = OpLoad %v2uint %arg_0 + %82 = OpFunctionCall %v2uint %tint_first_leading_bit %83 + OpStore %res %82 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %85 + %87 = OpLabel + %88 = OpFunctionCall %void %firstLeadingBit_6fe804 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %77 + %90 = OpLabel + %91 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %91 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %77 + %94 = OpLabel + %95 = OpFunctionCall %void %firstLeadingBit_6fe804 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %77 + %97 = OpLabel + %98 = OpFunctionCall %void %firstLeadingBit_6fe804 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/firstLeadingBit/6fe804.wgsl.expected.wgsl b/test/tint/builtins/gen/var/firstLeadingBit/6fe804.wgsl.expected.wgsl new file mode 100644 index 0000000000..1d6c27b028 --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/6fe804.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn firstLeadingBit_6fe804() { + var arg_0 = vec2(); + var res : vec2 = firstLeadingBit(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + firstLeadingBit_6fe804(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + firstLeadingBit_6fe804(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + firstLeadingBit_6fe804(); +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/a622c2.wgsl b/test/tint/builtins/gen/var/firstLeadingBit/a622c2.wgsl new file mode 100644 index 0000000000..e482e723cc --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/a622c2.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn firstLeadingBit(vec<2, i32>) -> vec<2, i32> +fn firstLeadingBit_a622c2() { + var arg_0 = vec2(); + var res: vec2 = firstLeadingBit(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + firstLeadingBit_a622c2(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + firstLeadingBit_a622c2(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + firstLeadingBit_a622c2(); +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/a622c2.wgsl.expected.glsl b/test/tint/builtins/gen/var/firstLeadingBit/a622c2.wgsl.expected.glsl new file mode 100644 index 0000000000..b12c7d5047 --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/a622c2.wgsl.expected.glsl @@ -0,0 +1,97 @@ +#version 310 es + +ivec2 tint_first_leading_bit(ivec2 v) { + uvec2 x = mix(uvec2(v), uvec2(~(v)), lessThan(v, ivec2(0))); + uvec2 b16 = mix(uvec2(0u), uvec2(16u), bvec2((x & uvec2(4294901760u)))); + x = (x >> b16); + uvec2 b8 = mix(uvec2(0u), uvec2(8u), bvec2((x & uvec2(65280u)))); + x = (x >> b8); + uvec2 b4 = mix(uvec2(0u), uvec2(4u), bvec2((x & uvec2(240u)))); + x = (x >> b4); + uvec2 b2 = mix(uvec2(0u), uvec2(2u), bvec2((x & uvec2(12u)))); + x = (x >> b2); + uvec2 b1 = mix(uvec2(0u), uvec2(1u), bvec2((x & uvec2(2u)))); + uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u))); + return ivec2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_a622c2() { + ivec2 arg_0 = ivec2(0); + ivec2 res = tint_first_leading_bit(arg_0); +} + +vec4 vertex_main() { + firstLeadingBit_a622c2(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +ivec2 tint_first_leading_bit(ivec2 v) { + uvec2 x = mix(uvec2(v), uvec2(~(v)), lessThan(v, ivec2(0))); + uvec2 b16 = mix(uvec2(0u), uvec2(16u), bvec2((x & uvec2(4294901760u)))); + x = (x >> b16); + uvec2 b8 = mix(uvec2(0u), uvec2(8u), bvec2((x & uvec2(65280u)))); + x = (x >> b8); + uvec2 b4 = mix(uvec2(0u), uvec2(4u), bvec2((x & uvec2(240u)))); + x = (x >> b4); + uvec2 b2 = mix(uvec2(0u), uvec2(2u), bvec2((x & uvec2(12u)))); + x = (x >> b2); + uvec2 b1 = mix(uvec2(0u), uvec2(1u), bvec2((x & uvec2(2u)))); + uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u))); + return ivec2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_a622c2() { + ivec2 arg_0 = ivec2(0); + ivec2 res = tint_first_leading_bit(arg_0); +} + +void fragment_main() { + firstLeadingBit_a622c2(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +ivec2 tint_first_leading_bit(ivec2 v) { + uvec2 x = mix(uvec2(v), uvec2(~(v)), lessThan(v, ivec2(0))); + uvec2 b16 = mix(uvec2(0u), uvec2(16u), bvec2((x & uvec2(4294901760u)))); + x = (x >> b16); + uvec2 b8 = mix(uvec2(0u), uvec2(8u), bvec2((x & uvec2(65280u)))); + x = (x >> b8); + uvec2 b4 = mix(uvec2(0u), uvec2(4u), bvec2((x & uvec2(240u)))); + x = (x >> b4); + uvec2 b2 = mix(uvec2(0u), uvec2(2u), bvec2((x & uvec2(12u)))); + x = (x >> b2); + uvec2 b1 = mix(uvec2(0u), uvec2(1u), bvec2((x & uvec2(2u)))); + uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u))); + return ivec2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_a622c2() { + ivec2 arg_0 = ivec2(0); + ivec2 res = tint_first_leading_bit(arg_0); +} + +void compute_main() { + firstLeadingBit_a622c2(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/a622c2.wgsl.expected.hlsl b/test/tint/builtins/gen/var/firstLeadingBit/a622c2.wgsl.expected.hlsl new file mode 100644 index 0000000000..d1da967a54 --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/a622c2.wgsl.expected.hlsl @@ -0,0 +1,46 @@ +int2 tint_first_leading_bit(int2 v) { + uint2 x = ((v < (0).xx) ? uint2(~(v)) : uint2(v)); + const uint2 b16 = (bool2((x & (4294901760u).xx)) ? (16u).xx : (0u).xx); + x = (x >> b16); + const uint2 b8 = (bool2((x & (65280u).xx)) ? (8u).xx : (0u).xx); + x = (x >> b8); + const uint2 b4 = (bool2((x & (240u).xx)) ? (4u).xx : (0u).xx); + x = (x >> b4); + const uint2 b2 = (bool2((x & (12u).xx)) ? (2u).xx : (0u).xx); + x = (x >> b2); + const uint2 b1 = (bool2((x & (2u).xx)) ? (1u).xx : (0u).xx); + const uint2 is_zero = ((x == (0u).xx) ? (4294967295u).xx : (0u).xx); + return int2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_a622c2() { + int2 arg_0 = (0).xx; + int2 res = tint_first_leading_bit(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstLeadingBit_a622c2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstLeadingBit_a622c2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstLeadingBit_a622c2(); + return; +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/a622c2.wgsl.expected.msl b/test/tint/builtins/gen/var/firstLeadingBit/a622c2.wgsl.expected.msl new file mode 100644 index 0000000000..8e55a5cad5 --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/a622c2.wgsl.expected.msl @@ -0,0 +1,49 @@ +#include + +using namespace metal; +int2 tint_first_leading_bit(int2 v) { + uint2 x = select(uint2(v), uint2(~(v)), (v < int2(0))); + uint2 const b16 = select(uint2(0u), uint2(16u), bool2((x & uint2(4294901760u)))); + x = (x >> b16); + uint2 const b8 = select(uint2(0u), uint2(8u), bool2((x & uint2(65280u)))); + x = (x >> b8); + uint2 const b4 = select(uint2(0u), uint2(4u), bool2((x & uint2(240u)))); + x = (x >> b4); + uint2 const b2 = select(uint2(0u), uint2(2u), bool2((x & uint2(12u)))); + x = (x >> b2); + uint2 const b1 = select(uint2(0u), uint2(1u), bool2((x & uint2(2u)))); + uint2 const is_zero = select(uint2(0u), uint2(4294967295u), (x == uint2(0u))); + return int2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_a622c2() { + int2 arg_0 = int2(0); + int2 res = tint_first_leading_bit(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + firstLeadingBit_a622c2(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + firstLeadingBit_a622c2(); + return; +} + +kernel void compute_main() { + firstLeadingBit_a622c2(); + return; +} + diff --git a/test/tint/builtins/gen/var/firstLeadingBit/a622c2.wgsl.expected.spvasm b/test/tint/builtins/gen/var/firstLeadingBit/a622c2.wgsl.expected.spvasm new file mode 100644 index 0000000000..ab66d0b2db --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/a622c2.wgsl.expected.spvasm @@ -0,0 +1,154 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 108 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_first_leading_bit "tint_first_leading_bit" + OpName %v "v" + OpName %x "x" + OpName %firstLeadingBit_a622c2 "firstLeadingBit_a622c2" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %9 = OpTypeFunction %v2int %v2int + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %18 = OpConstantNull %v2int + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %27 = OpConstantNull %v2uint +%uint_4294901760 = OpConstant %uint 4294901760 + %32 = OpConstantComposite %v2uint %uint_4294901760 %uint_4294901760 + %uint_16 = OpConstant %uint 16 + %35 = OpConstantComposite %v2uint %uint_16 %uint_16 + %uint_65280 = OpConstant %uint 65280 + %42 = OpConstantComposite %v2uint %uint_65280 %uint_65280 + %uint_8 = OpConstant %uint 8 + %45 = OpConstantComposite %v2uint %uint_8 %uint_8 + %uint_240 = OpConstant %uint 240 + %52 = OpConstantComposite %v2uint %uint_240 %uint_240 + %uint_4 = OpConstant %uint 4 + %55 = OpConstantComposite %v2uint %uint_4 %uint_4 + %uint_12 = OpConstant %uint 12 + %62 = OpConstantComposite %v2uint %uint_12 %uint_12 + %uint_2 = OpConstant %uint 2 + %65 = OpConstantComposite %v2uint %uint_2 %uint_2 + %uint_1 = OpConstant %uint 1 + %73 = OpConstantComposite %v2uint %uint_1 %uint_1 +%uint_4294967295 = OpConstant %uint 4294967295 + %78 = OpConstantComposite %v2uint %uint_4294967295 %uint_4294967295 + %void = OpTypeVoid + %85 = OpTypeFunction %void +%_ptr_Function_v2int = OpTypePointer Function %v2int + %94 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_first_leading_bit = OpFunction %v2int None %9 + %v = OpFunctionParameter %v2int + %14 = OpLabel + %x = OpVariable %_ptr_Function_v2uint Function %27 + %19 = OpSLessThan %v2bool %v %18 + %23 = OpNot %v2int %v + %22 = OpBitcast %v2uint %23 + %24 = OpBitcast %v2uint %v + %15 = OpSelect %v2uint %19 %22 %24 + OpStore %x %15 + %30 = OpLoad %v2uint %x + %33 = OpBitwiseAnd %v2uint %30 %32 + %29 = OpINotEqual %v2bool %33 %27 + %28 = OpSelect %v2uint %29 %35 %27 + %36 = OpLoad %v2uint %x + %37 = OpShiftRightLogical %v2uint %36 %28 + OpStore %x %37 + %40 = OpLoad %v2uint %x + %43 = OpBitwiseAnd %v2uint %40 %42 + %39 = OpINotEqual %v2bool %43 %27 + %38 = OpSelect %v2uint %39 %45 %27 + %46 = OpLoad %v2uint %x + %47 = OpShiftRightLogical %v2uint %46 %38 + OpStore %x %47 + %50 = OpLoad %v2uint %x + %53 = OpBitwiseAnd %v2uint %50 %52 + %49 = OpINotEqual %v2bool %53 %27 + %48 = OpSelect %v2uint %49 %55 %27 + %56 = OpLoad %v2uint %x + %57 = OpShiftRightLogical %v2uint %56 %48 + OpStore %x %57 + %60 = OpLoad %v2uint %x + %63 = OpBitwiseAnd %v2uint %60 %62 + %59 = OpINotEqual %v2bool %63 %27 + %58 = OpSelect %v2uint %59 %65 %27 + %66 = OpLoad %v2uint %x + %67 = OpShiftRightLogical %v2uint %66 %58 + OpStore %x %67 + %70 = OpLoad %v2uint %x + %71 = OpBitwiseAnd %v2uint %70 %65 + %69 = OpINotEqual %v2bool %71 %27 + %68 = OpSelect %v2uint %69 %73 %27 + %75 = OpLoad %v2uint %x + %76 = OpIEqual %v2bool %75 %27 + %74 = OpSelect %v2uint %76 %78 %27 + %80 = OpBitwiseOr %v2uint %28 %38 + %81 = OpBitwiseOr %v2uint %80 %48 + %82 = OpBitwiseOr %v2uint %81 %58 + %83 = OpBitwiseOr %v2uint %82 %68 + %84 = OpBitwiseOr %v2uint %83 %74 + %79 = OpBitcast %v2int %84 + OpReturnValue %79 + OpFunctionEnd +%firstLeadingBit_a622c2 = OpFunction %void None %85 + %88 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2int Function %18 + %res = OpVariable %_ptr_Function_v2int Function %18 + OpStore %arg_0 %18 + %92 = OpLoad %v2int %arg_0 + %91 = OpFunctionCall %v2int %tint_first_leading_bit %92 + OpStore %res %91 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %94 + %96 = OpLabel + %97 = OpFunctionCall %void %firstLeadingBit_a622c2 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %85 + %99 = OpLabel + %100 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %100 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %85 + %103 = OpLabel + %104 = OpFunctionCall %void %firstLeadingBit_a622c2 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %85 + %106 = OpLabel + %107 = OpFunctionCall %void %firstLeadingBit_a622c2 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/firstLeadingBit/a622c2.wgsl.expected.wgsl b/test/tint/builtins/gen/var/firstLeadingBit/a622c2.wgsl.expected.wgsl new file mode 100644 index 0000000000..73c77977a9 --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/a622c2.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn firstLeadingBit_a622c2() { + var arg_0 = vec2(); + var res : vec2 = firstLeadingBit(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + firstLeadingBit_a622c2(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + firstLeadingBit_a622c2(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + firstLeadingBit_a622c2(); +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/c1f940.wgsl b/test/tint/builtins/gen/var/firstLeadingBit/c1f940.wgsl new file mode 100644 index 0000000000..be7d46ced2 --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/c1f940.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn firstLeadingBit(vec<4, i32>) -> vec<4, i32> +fn firstLeadingBit_c1f940() { + var arg_0 = vec4(); + var res: vec4 = firstLeadingBit(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + firstLeadingBit_c1f940(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + firstLeadingBit_c1f940(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + firstLeadingBit_c1f940(); +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/c1f940.wgsl.expected.glsl b/test/tint/builtins/gen/var/firstLeadingBit/c1f940.wgsl.expected.glsl new file mode 100644 index 0000000000..442f3b20c9 --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/c1f940.wgsl.expected.glsl @@ -0,0 +1,97 @@ +#version 310 es + +ivec4 tint_first_leading_bit(ivec4 v) { + uvec4 x = mix(uvec4(v), uvec4(~(v)), lessThan(v, ivec4(0))); + uvec4 b16 = mix(uvec4(0u), uvec4(16u), bvec4((x & uvec4(4294901760u)))); + x = (x >> b16); + uvec4 b8 = mix(uvec4(0u), uvec4(8u), bvec4((x & uvec4(65280u)))); + x = (x >> b8); + uvec4 b4 = mix(uvec4(0u), uvec4(4u), bvec4((x & uvec4(240u)))); + x = (x >> b4); + uvec4 b2 = mix(uvec4(0u), uvec4(2u), bvec4((x & uvec4(12u)))); + x = (x >> b2); + uvec4 b1 = mix(uvec4(0u), uvec4(1u), bvec4((x & uvec4(2u)))); + uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u))); + return ivec4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_c1f940() { + ivec4 arg_0 = ivec4(0); + ivec4 res = tint_first_leading_bit(arg_0); +} + +vec4 vertex_main() { + firstLeadingBit_c1f940(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +ivec4 tint_first_leading_bit(ivec4 v) { + uvec4 x = mix(uvec4(v), uvec4(~(v)), lessThan(v, ivec4(0))); + uvec4 b16 = mix(uvec4(0u), uvec4(16u), bvec4((x & uvec4(4294901760u)))); + x = (x >> b16); + uvec4 b8 = mix(uvec4(0u), uvec4(8u), bvec4((x & uvec4(65280u)))); + x = (x >> b8); + uvec4 b4 = mix(uvec4(0u), uvec4(4u), bvec4((x & uvec4(240u)))); + x = (x >> b4); + uvec4 b2 = mix(uvec4(0u), uvec4(2u), bvec4((x & uvec4(12u)))); + x = (x >> b2); + uvec4 b1 = mix(uvec4(0u), uvec4(1u), bvec4((x & uvec4(2u)))); + uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u))); + return ivec4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_c1f940() { + ivec4 arg_0 = ivec4(0); + ivec4 res = tint_first_leading_bit(arg_0); +} + +void fragment_main() { + firstLeadingBit_c1f940(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +ivec4 tint_first_leading_bit(ivec4 v) { + uvec4 x = mix(uvec4(v), uvec4(~(v)), lessThan(v, ivec4(0))); + uvec4 b16 = mix(uvec4(0u), uvec4(16u), bvec4((x & uvec4(4294901760u)))); + x = (x >> b16); + uvec4 b8 = mix(uvec4(0u), uvec4(8u), bvec4((x & uvec4(65280u)))); + x = (x >> b8); + uvec4 b4 = mix(uvec4(0u), uvec4(4u), bvec4((x & uvec4(240u)))); + x = (x >> b4); + uvec4 b2 = mix(uvec4(0u), uvec4(2u), bvec4((x & uvec4(12u)))); + x = (x >> b2); + uvec4 b1 = mix(uvec4(0u), uvec4(1u), bvec4((x & uvec4(2u)))); + uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u))); + return ivec4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_c1f940() { + ivec4 arg_0 = ivec4(0); + ivec4 res = tint_first_leading_bit(arg_0); +} + +void compute_main() { + firstLeadingBit_c1f940(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/c1f940.wgsl.expected.hlsl b/test/tint/builtins/gen/var/firstLeadingBit/c1f940.wgsl.expected.hlsl new file mode 100644 index 0000000000..2103853bf4 --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/c1f940.wgsl.expected.hlsl @@ -0,0 +1,46 @@ +int4 tint_first_leading_bit(int4 v) { + uint4 x = ((v < (0).xxxx) ? uint4(~(v)) : uint4(v)); + const uint4 b16 = (bool4((x & (4294901760u).xxxx)) ? (16u).xxxx : (0u).xxxx); + x = (x >> b16); + const uint4 b8 = (bool4((x & (65280u).xxxx)) ? (8u).xxxx : (0u).xxxx); + x = (x >> b8); + const uint4 b4 = (bool4((x & (240u).xxxx)) ? (4u).xxxx : (0u).xxxx); + x = (x >> b4); + const uint4 b2 = (bool4((x & (12u).xxxx)) ? (2u).xxxx : (0u).xxxx); + x = (x >> b2); + const uint4 b1 = (bool4((x & (2u).xxxx)) ? (1u).xxxx : (0u).xxxx); + const uint4 is_zero = ((x == (0u).xxxx) ? (4294967295u).xxxx : (0u).xxxx); + return int4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_c1f940() { + int4 arg_0 = (0).xxxx; + int4 res = tint_first_leading_bit(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstLeadingBit_c1f940(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstLeadingBit_c1f940(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstLeadingBit_c1f940(); + return; +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/c1f940.wgsl.expected.msl b/test/tint/builtins/gen/var/firstLeadingBit/c1f940.wgsl.expected.msl new file mode 100644 index 0000000000..950e9b655f --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/c1f940.wgsl.expected.msl @@ -0,0 +1,49 @@ +#include + +using namespace metal; +int4 tint_first_leading_bit(int4 v) { + uint4 x = select(uint4(v), uint4(~(v)), (v < int4(0))); + uint4 const b16 = select(uint4(0u), uint4(16u), bool4((x & uint4(4294901760u)))); + x = (x >> b16); + uint4 const b8 = select(uint4(0u), uint4(8u), bool4((x & uint4(65280u)))); + x = (x >> b8); + uint4 const b4 = select(uint4(0u), uint4(4u), bool4((x & uint4(240u)))); + x = (x >> b4); + uint4 const b2 = select(uint4(0u), uint4(2u), bool4((x & uint4(12u)))); + x = (x >> b2); + uint4 const b1 = select(uint4(0u), uint4(1u), bool4((x & uint4(2u)))); + uint4 const is_zero = select(uint4(0u), uint4(4294967295u), (x == uint4(0u))); + return int4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_c1f940() { + int4 arg_0 = int4(0); + int4 res = tint_first_leading_bit(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + firstLeadingBit_c1f940(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + firstLeadingBit_c1f940(); + return; +} + +kernel void compute_main() { + firstLeadingBit_c1f940(); + return; +} + diff --git a/test/tint/builtins/gen/var/firstLeadingBit/c1f940.wgsl.expected.spvasm b/test/tint/builtins/gen/var/firstLeadingBit/c1f940.wgsl.expected.spvasm new file mode 100644 index 0000000000..7c6ee54707 --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/c1f940.wgsl.expected.spvasm @@ -0,0 +1,154 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 108 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_first_leading_bit "tint_first_leading_bit" + OpName %v "v" + OpName %x "x" + OpName %firstLeadingBit_c1f940 "firstLeadingBit_c1f940" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %9 = OpTypeFunction %v4int %v4int + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + %18 = OpConstantNull %v4int + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %27 = OpConstantNull %v4uint +%uint_4294901760 = OpConstant %uint 4294901760 + %32 = OpConstantComposite %v4uint %uint_4294901760 %uint_4294901760 %uint_4294901760 %uint_4294901760 + %uint_16 = OpConstant %uint 16 + %35 = OpConstantComposite %v4uint %uint_16 %uint_16 %uint_16 %uint_16 + %uint_65280 = OpConstant %uint 65280 + %42 = OpConstantComposite %v4uint %uint_65280 %uint_65280 %uint_65280 %uint_65280 + %uint_8 = OpConstant %uint 8 + %45 = OpConstantComposite %v4uint %uint_8 %uint_8 %uint_8 %uint_8 + %uint_240 = OpConstant %uint 240 + %52 = OpConstantComposite %v4uint %uint_240 %uint_240 %uint_240 %uint_240 + %uint_4 = OpConstant %uint 4 + %55 = OpConstantComposite %v4uint %uint_4 %uint_4 %uint_4 %uint_4 + %uint_12 = OpConstant %uint 12 + %62 = OpConstantComposite %v4uint %uint_12 %uint_12 %uint_12 %uint_12 + %uint_2 = OpConstant %uint 2 + %65 = OpConstantComposite %v4uint %uint_2 %uint_2 %uint_2 %uint_2 + %uint_1 = OpConstant %uint 1 + %73 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1 +%uint_4294967295 = OpConstant %uint 4294967295 + %78 = OpConstantComposite %v4uint %uint_4294967295 %uint_4294967295 %uint_4294967295 %uint_4294967295 + %void = OpTypeVoid + %85 = OpTypeFunction %void +%_ptr_Function_v4int = OpTypePointer Function %v4int + %94 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_first_leading_bit = OpFunction %v4int None %9 + %v = OpFunctionParameter %v4int + %14 = OpLabel + %x = OpVariable %_ptr_Function_v4uint Function %27 + %19 = OpSLessThan %v4bool %v %18 + %23 = OpNot %v4int %v + %22 = OpBitcast %v4uint %23 + %24 = OpBitcast %v4uint %v + %15 = OpSelect %v4uint %19 %22 %24 + OpStore %x %15 + %30 = OpLoad %v4uint %x + %33 = OpBitwiseAnd %v4uint %30 %32 + %29 = OpINotEqual %v4bool %33 %27 + %28 = OpSelect %v4uint %29 %35 %27 + %36 = OpLoad %v4uint %x + %37 = OpShiftRightLogical %v4uint %36 %28 + OpStore %x %37 + %40 = OpLoad %v4uint %x + %43 = OpBitwiseAnd %v4uint %40 %42 + %39 = OpINotEqual %v4bool %43 %27 + %38 = OpSelect %v4uint %39 %45 %27 + %46 = OpLoad %v4uint %x + %47 = OpShiftRightLogical %v4uint %46 %38 + OpStore %x %47 + %50 = OpLoad %v4uint %x + %53 = OpBitwiseAnd %v4uint %50 %52 + %49 = OpINotEqual %v4bool %53 %27 + %48 = OpSelect %v4uint %49 %55 %27 + %56 = OpLoad %v4uint %x + %57 = OpShiftRightLogical %v4uint %56 %48 + OpStore %x %57 + %60 = OpLoad %v4uint %x + %63 = OpBitwiseAnd %v4uint %60 %62 + %59 = OpINotEqual %v4bool %63 %27 + %58 = OpSelect %v4uint %59 %65 %27 + %66 = OpLoad %v4uint %x + %67 = OpShiftRightLogical %v4uint %66 %58 + OpStore %x %67 + %70 = OpLoad %v4uint %x + %71 = OpBitwiseAnd %v4uint %70 %65 + %69 = OpINotEqual %v4bool %71 %27 + %68 = OpSelect %v4uint %69 %73 %27 + %75 = OpLoad %v4uint %x + %76 = OpIEqual %v4bool %75 %27 + %74 = OpSelect %v4uint %76 %78 %27 + %80 = OpBitwiseOr %v4uint %28 %38 + %81 = OpBitwiseOr %v4uint %80 %48 + %82 = OpBitwiseOr %v4uint %81 %58 + %83 = OpBitwiseOr %v4uint %82 %68 + %84 = OpBitwiseOr %v4uint %83 %74 + %79 = OpBitcast %v4int %84 + OpReturnValue %79 + OpFunctionEnd +%firstLeadingBit_c1f940 = OpFunction %void None %85 + %88 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4int Function %18 + %res = OpVariable %_ptr_Function_v4int Function %18 + OpStore %arg_0 %18 + %92 = OpLoad %v4int %arg_0 + %91 = OpFunctionCall %v4int %tint_first_leading_bit %92 + OpStore %res %91 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %94 + %96 = OpLabel + %97 = OpFunctionCall %void %firstLeadingBit_c1f940 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %85 + %99 = OpLabel + %100 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %100 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %85 + %103 = OpLabel + %104 = OpFunctionCall %void %firstLeadingBit_c1f940 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %85 + %106 = OpLabel + %107 = OpFunctionCall %void %firstLeadingBit_c1f940 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/firstLeadingBit/c1f940.wgsl.expected.wgsl b/test/tint/builtins/gen/var/firstLeadingBit/c1f940.wgsl.expected.wgsl new file mode 100644 index 0000000000..dd852d4e85 --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/c1f940.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn firstLeadingBit_c1f940() { + var arg_0 = vec4(); + var res : vec4 = firstLeadingBit(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + firstLeadingBit_c1f940(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + firstLeadingBit_c1f940(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + firstLeadingBit_c1f940(); +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/f0779d.wgsl b/test/tint/builtins/gen/var/firstLeadingBit/f0779d.wgsl new file mode 100644 index 0000000000..4ccf98300c --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/f0779d.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn firstLeadingBit(u32) -> u32 +fn firstLeadingBit_f0779d() { + var arg_0 = 1u; + var res: u32 = firstLeadingBit(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + firstLeadingBit_f0779d(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + firstLeadingBit_f0779d(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + firstLeadingBit_f0779d(); +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/f0779d.wgsl.expected.glsl b/test/tint/builtins/gen/var/firstLeadingBit/f0779d.wgsl.expected.glsl new file mode 100644 index 0000000000..fe38e683ca --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/f0779d.wgsl.expected.glsl @@ -0,0 +1,97 @@ +#version 310 es + +uint tint_first_leading_bit(uint v) { + uint x = v; + uint b16 = (bool((x & 4294901760u)) ? 16u : 0u); + x = (x >> b16); + uint b8 = (bool((x & 65280u)) ? 8u : 0u); + x = (x >> b8); + uint b4 = (bool((x & 240u)) ? 4u : 0u); + x = (x >> b4); + uint b2 = (bool((x & 12u)) ? 2u : 0u); + x = (x >> b2); + uint b1 = (bool((x & 2u)) ? 1u : 0u); + uint is_zero = ((x == 0u) ? 4294967295u : 0u); + return uint((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_f0779d() { + uint arg_0 = 1u; + uint res = tint_first_leading_bit(arg_0); +} + +vec4 vertex_main() { + firstLeadingBit_f0779d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uint tint_first_leading_bit(uint v) { + uint x = v; + uint b16 = (bool((x & 4294901760u)) ? 16u : 0u); + x = (x >> b16); + uint b8 = (bool((x & 65280u)) ? 8u : 0u); + x = (x >> b8); + uint b4 = (bool((x & 240u)) ? 4u : 0u); + x = (x >> b4); + uint b2 = (bool((x & 12u)) ? 2u : 0u); + x = (x >> b2); + uint b1 = (bool((x & 2u)) ? 1u : 0u); + uint is_zero = ((x == 0u) ? 4294967295u : 0u); + return uint((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_f0779d() { + uint arg_0 = 1u; + uint res = tint_first_leading_bit(arg_0); +} + +void fragment_main() { + firstLeadingBit_f0779d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uint tint_first_leading_bit(uint v) { + uint x = v; + uint b16 = (bool((x & 4294901760u)) ? 16u : 0u); + x = (x >> b16); + uint b8 = (bool((x & 65280u)) ? 8u : 0u); + x = (x >> b8); + uint b4 = (bool((x & 240u)) ? 4u : 0u); + x = (x >> b4); + uint b2 = (bool((x & 12u)) ? 2u : 0u); + x = (x >> b2); + uint b1 = (bool((x & 2u)) ? 1u : 0u); + uint is_zero = ((x == 0u) ? 4294967295u : 0u); + return uint((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_f0779d() { + uint arg_0 = 1u; + uint res = tint_first_leading_bit(arg_0); +} + +void compute_main() { + firstLeadingBit_f0779d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/f0779d.wgsl.expected.hlsl b/test/tint/builtins/gen/var/firstLeadingBit/f0779d.wgsl.expected.hlsl new file mode 100644 index 0000000000..26c2ab932f --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/f0779d.wgsl.expected.hlsl @@ -0,0 +1,46 @@ +uint tint_first_leading_bit(uint v) { + uint x = v; + const uint b16 = (bool((x & 4294901760u)) ? 16u : 0u); + x = (x >> b16); + const uint b8 = (bool((x & 65280u)) ? 8u : 0u); + x = (x >> b8); + const uint b4 = (bool((x & 240u)) ? 4u : 0u); + x = (x >> b4); + const uint b2 = (bool((x & 12u)) ? 2u : 0u); + x = (x >> b2); + const uint b1 = (bool((x & 2u)) ? 1u : 0u); + const uint is_zero = ((x == 0u) ? 4294967295u : 0u); + return uint((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_f0779d() { + uint arg_0 = 1u; + uint res = tint_first_leading_bit(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstLeadingBit_f0779d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstLeadingBit_f0779d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstLeadingBit_f0779d(); + return; +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/f0779d.wgsl.expected.msl b/test/tint/builtins/gen/var/firstLeadingBit/f0779d.wgsl.expected.msl new file mode 100644 index 0000000000..daac75af97 --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/f0779d.wgsl.expected.msl @@ -0,0 +1,49 @@ +#include + +using namespace metal; +uint tint_first_leading_bit(uint v) { + uint x = v; + uint const b16 = select(0u, 16u, bool((x & 4294901760u))); + x = (x >> b16); + uint const b8 = select(0u, 8u, bool((x & 65280u))); + x = (x >> b8); + uint const b4 = select(0u, 4u, bool((x & 240u))); + x = (x >> b4); + uint const b2 = select(0u, 2u, bool((x & 12u))); + x = (x >> b2); + uint const b1 = select(0u, 1u, bool((x & 2u))); + uint const is_zero = select(0u, 4294967295u, (x == 0u)); + return uint((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_f0779d() { + uint arg_0 = 1u; + uint res = tint_first_leading_bit(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + firstLeadingBit_f0779d(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + firstLeadingBit_f0779d(); + return; +} + +kernel void compute_main() { + firstLeadingBit_f0779d(); + return; +} + diff --git a/test/tint/builtins/gen/var/firstLeadingBit/f0779d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/firstLeadingBit/f0779d.wgsl.expected.spvasm new file mode 100644 index 0000000000..9236998e6f --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/f0779d.wgsl.expected.spvasm @@ -0,0 +1,132 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 87 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_first_leading_bit "tint_first_leading_bit" + OpName %v "v" + OpName %x "x" + OpName %firstLeadingBit_f0779d "firstLeadingBit_f0779d" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %9 = OpTypeFunction %uint %uint +%_ptr_Function_uint = OpTypePointer Function %uint + %16 = OpConstantNull %uint + %bool = OpTypeBool +%uint_4294901760 = OpConstant %uint 4294901760 + %uint_16 = OpConstant %uint 16 + %uint_65280 = OpConstant %uint 65280 + %uint_8 = OpConstant %uint 8 + %uint_240 = OpConstant %uint 240 + %uint_4 = OpConstant %uint 4 + %uint_12 = OpConstant %uint 12 + %uint_2 = OpConstant %uint 2 + %uint_1 = OpConstant %uint 1 +%uint_4294967295 = OpConstant %uint 4294967295 + %void = OpTypeVoid + %65 = OpTypeFunction %void + %73 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_first_leading_bit = OpFunction %uint None %9 + %v = OpFunctionParameter %uint + %13 = OpLabel + %x = OpVariable %_ptr_Function_uint Function %16 + OpStore %x %v + %20 = OpLoad %uint %x + %22 = OpBitwiseAnd %uint %20 %uint_4294901760 + %18 = OpINotEqual %bool %22 %16 + %17 = OpSelect %uint %18 %uint_16 %16 + %24 = OpLoad %uint %x + %25 = OpShiftRightLogical %uint %24 %17 + OpStore %x %25 + %28 = OpLoad %uint %x + %30 = OpBitwiseAnd %uint %28 %uint_65280 + %27 = OpINotEqual %bool %30 %16 + %26 = OpSelect %uint %27 %uint_8 %16 + %32 = OpLoad %uint %x + %33 = OpShiftRightLogical %uint %32 %26 + OpStore %x %33 + %36 = OpLoad %uint %x + %38 = OpBitwiseAnd %uint %36 %uint_240 + %35 = OpINotEqual %bool %38 %16 + %34 = OpSelect %uint %35 %uint_4 %16 + %40 = OpLoad %uint %x + %41 = OpShiftRightLogical %uint %40 %34 + OpStore %x %41 + %44 = OpLoad %uint %x + %46 = OpBitwiseAnd %uint %44 %uint_12 + %43 = OpINotEqual %bool %46 %16 + %42 = OpSelect %uint %43 %uint_2 %16 + %48 = OpLoad %uint %x + %49 = OpShiftRightLogical %uint %48 %42 + OpStore %x %49 + %52 = OpLoad %uint %x + %53 = OpBitwiseAnd %uint %52 %uint_2 + %51 = OpINotEqual %bool %53 %16 + %50 = OpSelect %uint %51 %uint_1 %16 + %56 = OpLoad %uint %x + %57 = OpIEqual %bool %56 %16 + %55 = OpSelect %uint %57 %uint_4294967295 %16 + %60 = OpBitwiseOr %uint %17 %26 + %61 = OpBitwiseOr %uint %60 %34 + %62 = OpBitwiseOr %uint %61 %42 + %63 = OpBitwiseOr %uint %62 %50 + %64 = OpBitwiseOr %uint %63 %55 + OpReturnValue %64 + OpFunctionEnd +%firstLeadingBit_f0779d = OpFunction %void None %65 + %68 = OpLabel + %arg_0 = OpVariable %_ptr_Function_uint Function %16 + %res = OpVariable %_ptr_Function_uint Function %16 + OpStore %arg_0 %uint_1 + %71 = OpLoad %uint %arg_0 + %70 = OpFunctionCall %uint %tint_first_leading_bit %71 + OpStore %res %70 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %73 + %75 = OpLabel + %76 = OpFunctionCall %void %firstLeadingBit_f0779d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %65 + %78 = OpLabel + %79 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %79 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %65 + %82 = OpLabel + %83 = OpFunctionCall %void %firstLeadingBit_f0779d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %65 + %85 = OpLabel + %86 = OpFunctionCall %void %firstLeadingBit_f0779d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/firstLeadingBit/f0779d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/firstLeadingBit/f0779d.wgsl.expected.wgsl new file mode 100644 index 0000000000..072135a36b --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/f0779d.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn firstLeadingBit_f0779d() { + var arg_0 = 1u; + var res : u32 = firstLeadingBit(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + firstLeadingBit_f0779d(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + firstLeadingBit_f0779d(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + firstLeadingBit_f0779d(); +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/110f2c.wgsl b/test/tint/builtins/gen/var/firstTrailingBit/110f2c.wgsl new file mode 100644 index 0000000000..a3cdb6f985 --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/110f2c.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn firstTrailingBit(vec<4, u32>) -> vec<4, u32> +fn firstTrailingBit_110f2c() { + var arg_0 = vec4(); + var res: vec4 = firstTrailingBit(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + firstTrailingBit_110f2c(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + firstTrailingBit_110f2c(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + firstTrailingBit_110f2c(); +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/110f2c.wgsl.expected.glsl b/test/tint/builtins/gen/var/firstTrailingBit/110f2c.wgsl.expected.glsl new file mode 100644 index 0000000000..dc7ca074cb --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/110f2c.wgsl.expected.glsl @@ -0,0 +1,97 @@ +#version 310 es + +uvec4 tint_first_trailing_bit(uvec4 v) { + uvec4 x = uvec4(v); + uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u)))); + x = (x >> b16); + uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u)))); + x = (x >> b8); + uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u)))); + x = (x >> b4); + uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u)))); + x = (x >> b2); + uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u)))); + uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u))); + return uvec4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_110f2c() { + uvec4 arg_0 = uvec4(0u); + uvec4 res = tint_first_trailing_bit(arg_0); +} + +vec4 vertex_main() { + firstTrailingBit_110f2c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uvec4 tint_first_trailing_bit(uvec4 v) { + uvec4 x = uvec4(v); + uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u)))); + x = (x >> b16); + uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u)))); + x = (x >> b8); + uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u)))); + x = (x >> b4); + uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u)))); + x = (x >> b2); + uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u)))); + uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u))); + return uvec4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_110f2c() { + uvec4 arg_0 = uvec4(0u); + uvec4 res = tint_first_trailing_bit(arg_0); +} + +void fragment_main() { + firstTrailingBit_110f2c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uvec4 tint_first_trailing_bit(uvec4 v) { + uvec4 x = uvec4(v); + uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u)))); + x = (x >> b16); + uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u)))); + x = (x >> b8); + uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u)))); + x = (x >> b4); + uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u)))); + x = (x >> b2); + uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u)))); + uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u))); + return uvec4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_110f2c() { + uvec4 arg_0 = uvec4(0u); + uvec4 res = tint_first_trailing_bit(arg_0); +} + +void compute_main() { + firstTrailingBit_110f2c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/110f2c.wgsl.expected.hlsl b/test/tint/builtins/gen/var/firstTrailingBit/110f2c.wgsl.expected.hlsl new file mode 100644 index 0000000000..ed6e500c31 --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/110f2c.wgsl.expected.hlsl @@ -0,0 +1,46 @@ +uint4 tint_first_trailing_bit(uint4 v) { + uint4 x = uint4(v); + const uint4 b16 = (bool4((x & (65535u).xxxx)) ? (0u).xxxx : (16u).xxxx); + x = (x >> b16); + const uint4 b8 = (bool4((x & (255u).xxxx)) ? (0u).xxxx : (8u).xxxx); + x = (x >> b8); + const uint4 b4 = (bool4((x & (15u).xxxx)) ? (0u).xxxx : (4u).xxxx); + x = (x >> b4); + const uint4 b2 = (bool4((x & (3u).xxxx)) ? (0u).xxxx : (2u).xxxx); + x = (x >> b2); + const uint4 b1 = (bool4((x & (1u).xxxx)) ? (0u).xxxx : (1u).xxxx); + const uint4 is_zero = ((x == (0u).xxxx) ? (4294967295u).xxxx : (0u).xxxx); + return uint4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_110f2c() { + uint4 arg_0 = (0u).xxxx; + uint4 res = tint_first_trailing_bit(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstTrailingBit_110f2c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstTrailingBit_110f2c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstTrailingBit_110f2c(); + return; +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/110f2c.wgsl.expected.msl b/test/tint/builtins/gen/var/firstTrailingBit/110f2c.wgsl.expected.msl new file mode 100644 index 0000000000..e1dfe906f9 --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/110f2c.wgsl.expected.msl @@ -0,0 +1,49 @@ +#include + +using namespace metal; +uint4 tint_first_trailing_bit(uint4 v) { + uint4 x = uint4(v); + uint4 const b16 = select(uint4(16u), uint4(0u), bool4((x & uint4(65535u)))); + x = (x >> b16); + uint4 const b8 = select(uint4(8u), uint4(0u), bool4((x & uint4(255u)))); + x = (x >> b8); + uint4 const b4 = select(uint4(4u), uint4(0u), bool4((x & uint4(15u)))); + x = (x >> b4); + uint4 const b2 = select(uint4(2u), uint4(0u), bool4((x & uint4(3u)))); + x = (x >> b2); + uint4 const b1 = select(uint4(1u), uint4(0u), bool4((x & uint4(1u)))); + uint4 const is_zero = select(uint4(0u), uint4(4294967295u), (x == uint4(0u))); + return uint4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_110f2c() { + uint4 arg_0 = uint4(0u); + uint4 res = tint_first_trailing_bit(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + firstTrailingBit_110f2c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + firstTrailingBit_110f2c(); + return; +} + +kernel void compute_main() { + firstTrailingBit_110f2c(); + return; +} + diff --git a/test/tint/builtins/gen/var/firstTrailingBit/110f2c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/firstTrailingBit/110f2c.wgsl.expected.spvasm new file mode 100644 index 0000000000..e4d1cbba84 --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/110f2c.wgsl.expected.spvasm @@ -0,0 +1,144 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 100 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_first_trailing_bit "tint_first_trailing_bit" + OpName %v "v" + OpName %x "x" + OpName %firstTrailingBit_110f2c "firstTrailingBit_110f2c" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + %9 = OpTypeFunction %v4uint %v4uint +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %18 = OpConstantNull %v4uint + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %uint_65535 = OpConstant %uint 65535 + %25 = OpConstantComposite %v4uint %uint_65535 %uint_65535 %uint_65535 %uint_65535 + %uint_16 = OpConstant %uint 16 + %28 = OpConstantComposite %v4uint %uint_16 %uint_16 %uint_16 %uint_16 + %uint_255 = OpConstant %uint 255 + %35 = OpConstantComposite %v4uint %uint_255 %uint_255 %uint_255 %uint_255 + %uint_8 = OpConstant %uint 8 + %38 = OpConstantComposite %v4uint %uint_8 %uint_8 %uint_8 %uint_8 + %uint_15 = OpConstant %uint 15 + %45 = OpConstantComposite %v4uint %uint_15 %uint_15 %uint_15 %uint_15 + %uint_4 = OpConstant %uint 4 + %48 = OpConstantComposite %v4uint %uint_4 %uint_4 %uint_4 %uint_4 + %uint_3 = OpConstant %uint 3 + %55 = OpConstantComposite %v4uint %uint_3 %uint_3 %uint_3 %uint_3 + %uint_2 = OpConstant %uint 2 + %58 = OpConstantComposite %v4uint %uint_2 %uint_2 %uint_2 %uint_2 + %uint_1 = OpConstant %uint 1 + %65 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1 +%uint_4294967295 = OpConstant %uint 4294967295 + %71 = OpConstantComposite %v4uint %uint_4294967295 %uint_4294967295 %uint_4294967295 %uint_4294967295 + %void = OpTypeVoid + %78 = OpTypeFunction %void + %86 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_first_trailing_bit = OpFunction %v4uint None %9 + %v = OpFunctionParameter %v4uint + %14 = OpLabel + %x = OpVariable %_ptr_Function_v4uint Function %18 + OpStore %x %v + %23 = OpLoad %v4uint %x + %26 = OpBitwiseAnd %v4uint %23 %25 + %20 = OpINotEqual %v4bool %26 %18 + %19 = OpSelect %v4uint %20 %18 %28 + %29 = OpLoad %v4uint %x + %30 = OpShiftRightLogical %v4uint %29 %19 + OpStore %x %30 + %33 = OpLoad %v4uint %x + %36 = OpBitwiseAnd %v4uint %33 %35 + %32 = OpINotEqual %v4bool %36 %18 + %31 = OpSelect %v4uint %32 %18 %38 + %39 = OpLoad %v4uint %x + %40 = OpShiftRightLogical %v4uint %39 %31 + OpStore %x %40 + %43 = OpLoad %v4uint %x + %46 = OpBitwiseAnd %v4uint %43 %45 + %42 = OpINotEqual %v4bool %46 %18 + %41 = OpSelect %v4uint %42 %18 %48 + %49 = OpLoad %v4uint %x + %50 = OpShiftRightLogical %v4uint %49 %41 + OpStore %x %50 + %53 = OpLoad %v4uint %x + %56 = OpBitwiseAnd %v4uint %53 %55 + %52 = OpINotEqual %v4bool %56 %18 + %51 = OpSelect %v4uint %52 %18 %58 + %59 = OpLoad %v4uint %x + %60 = OpShiftRightLogical %v4uint %59 %51 + OpStore %x %60 + %63 = OpLoad %v4uint %x + %66 = OpBitwiseAnd %v4uint %63 %65 + %62 = OpINotEqual %v4bool %66 %18 + %61 = OpSelect %v4uint %62 %18 %65 + %68 = OpLoad %v4uint %x + %69 = OpIEqual %v4bool %68 %18 + %67 = OpSelect %v4uint %69 %71 %18 + %73 = OpBitwiseOr %v4uint %19 %31 + %74 = OpBitwiseOr %v4uint %73 %41 + %75 = OpBitwiseOr %v4uint %74 %51 + %76 = OpBitwiseOr %v4uint %75 %61 + %77 = OpBitwiseOr %v4uint %76 %67 + OpReturnValue %77 + OpFunctionEnd +%firstTrailingBit_110f2c = OpFunction %void None %78 + %81 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4uint Function %18 + %res = OpVariable %_ptr_Function_v4uint Function %18 + OpStore %arg_0 %18 + %84 = OpLoad %v4uint %arg_0 + %83 = OpFunctionCall %v4uint %tint_first_trailing_bit %84 + OpStore %res %83 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %86 + %88 = OpLabel + %89 = OpFunctionCall %void %firstTrailingBit_110f2c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %78 + %91 = OpLabel + %92 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %92 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %78 + %95 = OpLabel + %96 = OpFunctionCall %void %firstTrailingBit_110f2c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %78 + %98 = OpLabel + %99 = OpFunctionCall %void %firstTrailingBit_110f2c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/firstTrailingBit/110f2c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/firstTrailingBit/110f2c.wgsl.expected.wgsl new file mode 100644 index 0000000000..6edd9d2863 --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/110f2c.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn firstTrailingBit_110f2c() { + var arg_0 = vec4(); + var res : vec4 = firstTrailingBit(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + firstTrailingBit_110f2c(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + firstTrailingBit_110f2c(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + firstTrailingBit_110f2c(); +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/3a2acc.wgsl b/test/tint/builtins/gen/var/firstTrailingBit/3a2acc.wgsl new file mode 100644 index 0000000000..ed95803b55 --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/3a2acc.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn firstTrailingBit(i32) -> i32 +fn firstTrailingBit_3a2acc() { + var arg_0 = 1; + var res: i32 = firstTrailingBit(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + firstTrailingBit_3a2acc(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + firstTrailingBit_3a2acc(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + firstTrailingBit_3a2acc(); +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/3a2acc.wgsl.expected.glsl b/test/tint/builtins/gen/var/firstTrailingBit/3a2acc.wgsl.expected.glsl new file mode 100644 index 0000000000..7bc6250b8d --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/3a2acc.wgsl.expected.glsl @@ -0,0 +1,97 @@ +#version 310 es + +int tint_first_trailing_bit(int v) { + uint x = uint(v); + uint b16 = (bool((x & 65535u)) ? 0u : 16u); + x = (x >> b16); + uint b8 = (bool((x & 255u)) ? 0u : 8u); + x = (x >> b8); + uint b4 = (bool((x & 15u)) ? 0u : 4u); + x = (x >> b4); + uint b2 = (bool((x & 3u)) ? 0u : 2u); + x = (x >> b2); + uint b1 = (bool((x & 1u)) ? 0u : 1u); + uint is_zero = ((x == 0u) ? 4294967295u : 0u); + return int((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_3a2acc() { + int arg_0 = 1; + int res = tint_first_trailing_bit(arg_0); +} + +vec4 vertex_main() { + firstTrailingBit_3a2acc(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +int tint_first_trailing_bit(int v) { + uint x = uint(v); + uint b16 = (bool((x & 65535u)) ? 0u : 16u); + x = (x >> b16); + uint b8 = (bool((x & 255u)) ? 0u : 8u); + x = (x >> b8); + uint b4 = (bool((x & 15u)) ? 0u : 4u); + x = (x >> b4); + uint b2 = (bool((x & 3u)) ? 0u : 2u); + x = (x >> b2); + uint b1 = (bool((x & 1u)) ? 0u : 1u); + uint is_zero = ((x == 0u) ? 4294967295u : 0u); + return int((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_3a2acc() { + int arg_0 = 1; + int res = tint_first_trailing_bit(arg_0); +} + +void fragment_main() { + firstTrailingBit_3a2acc(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +int tint_first_trailing_bit(int v) { + uint x = uint(v); + uint b16 = (bool((x & 65535u)) ? 0u : 16u); + x = (x >> b16); + uint b8 = (bool((x & 255u)) ? 0u : 8u); + x = (x >> b8); + uint b4 = (bool((x & 15u)) ? 0u : 4u); + x = (x >> b4); + uint b2 = (bool((x & 3u)) ? 0u : 2u); + x = (x >> b2); + uint b1 = (bool((x & 1u)) ? 0u : 1u); + uint is_zero = ((x == 0u) ? 4294967295u : 0u); + return int((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_3a2acc() { + int arg_0 = 1; + int res = tint_first_trailing_bit(arg_0); +} + +void compute_main() { + firstTrailingBit_3a2acc(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/3a2acc.wgsl.expected.hlsl b/test/tint/builtins/gen/var/firstTrailingBit/3a2acc.wgsl.expected.hlsl new file mode 100644 index 0000000000..18cddbf55e --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/3a2acc.wgsl.expected.hlsl @@ -0,0 +1,46 @@ +int tint_first_trailing_bit(int v) { + uint x = uint(v); + const uint b16 = (bool((x & 65535u)) ? 0u : 16u); + x = (x >> b16); + const uint b8 = (bool((x & 255u)) ? 0u : 8u); + x = (x >> b8); + const uint b4 = (bool((x & 15u)) ? 0u : 4u); + x = (x >> b4); + const uint b2 = (bool((x & 3u)) ? 0u : 2u); + x = (x >> b2); + const uint b1 = (bool((x & 1u)) ? 0u : 1u); + const uint is_zero = ((x == 0u) ? 4294967295u : 0u); + return int((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_3a2acc() { + int arg_0 = 1; + int res = tint_first_trailing_bit(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstTrailingBit_3a2acc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstTrailingBit_3a2acc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstTrailingBit_3a2acc(); + return; +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/3a2acc.wgsl.expected.msl b/test/tint/builtins/gen/var/firstTrailingBit/3a2acc.wgsl.expected.msl new file mode 100644 index 0000000000..580ba30336 --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/3a2acc.wgsl.expected.msl @@ -0,0 +1,49 @@ +#include + +using namespace metal; +int tint_first_trailing_bit(int v) { + uint x = uint(v); + uint const b16 = select(16u, 0u, bool((x & 65535u))); + x = (x >> b16); + uint const b8 = select(8u, 0u, bool((x & 255u))); + x = (x >> b8); + uint const b4 = select(4u, 0u, bool((x & 15u))); + x = (x >> b4); + uint const b2 = select(2u, 0u, bool((x & 3u))); + x = (x >> b2); + uint const b1 = select(1u, 0u, bool((x & 1u))); + uint const is_zero = select(0u, 4294967295u, (x == 0u)); + return int((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_3a2acc() { + int arg_0 = 1; + int res = tint_first_trailing_bit(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + firstTrailingBit_3a2acc(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + firstTrailingBit_3a2acc(); + return; +} + +kernel void compute_main() { + firstTrailingBit_3a2acc(); + return; +} + diff --git a/test/tint/builtins/gen/var/firstTrailingBit/3a2acc.wgsl.expected.spvasm b/test/tint/builtins/gen/var/firstTrailingBit/3a2acc.wgsl.expected.spvasm new file mode 100644 index 0000000000..ba548bc345 --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/3a2acc.wgsl.expected.spvasm @@ -0,0 +1,138 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 92 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_first_trailing_bit "tint_first_trailing_bit" + OpName %v "v" + OpName %x "x" + OpName %firstTrailingBit_3a2acc "firstTrailingBit_3a2acc" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %9 = OpTypeFunction %int %int + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %18 = OpConstantNull %uint + %bool = OpTypeBool + %uint_65535 = OpConstant %uint 65535 + %uint_16 = OpConstant %uint 16 + %uint_255 = OpConstant %uint 255 + %uint_8 = OpConstant %uint 8 + %uint_15 = OpConstant %uint 15 + %uint_4 = OpConstant %uint 4 + %uint_3 = OpConstant %uint 3 + %uint_2 = OpConstant %uint 2 + %uint_1 = OpConstant %uint 1 +%uint_4294967295 = OpConstant %uint 4294967295 + %void = OpTypeVoid + %67 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %74 = OpConstantNull %int + %78 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_first_trailing_bit = OpFunction %int None %9 + %v = OpFunctionParameter %int + %13 = OpLabel + %x = OpVariable %_ptr_Function_uint Function %18 + %14 = OpBitcast %uint %v + OpStore %x %14 + %22 = OpLoad %uint %x + %24 = OpBitwiseAnd %uint %22 %uint_65535 + %20 = OpINotEqual %bool %24 %18 + %19 = OpSelect %uint %20 %18 %uint_16 + %26 = OpLoad %uint %x + %27 = OpShiftRightLogical %uint %26 %19 + OpStore %x %27 + %30 = OpLoad %uint %x + %32 = OpBitwiseAnd %uint %30 %uint_255 + %29 = OpINotEqual %bool %32 %18 + %28 = OpSelect %uint %29 %18 %uint_8 + %34 = OpLoad %uint %x + %35 = OpShiftRightLogical %uint %34 %28 + OpStore %x %35 + %38 = OpLoad %uint %x + %40 = OpBitwiseAnd %uint %38 %uint_15 + %37 = OpINotEqual %bool %40 %18 + %36 = OpSelect %uint %37 %18 %uint_4 + %42 = OpLoad %uint %x + %43 = OpShiftRightLogical %uint %42 %36 + OpStore %x %43 + %46 = OpLoad %uint %x + %48 = OpBitwiseAnd %uint %46 %uint_3 + %45 = OpINotEqual %bool %48 %18 + %44 = OpSelect %uint %45 %18 %uint_2 + %50 = OpLoad %uint %x + %51 = OpShiftRightLogical %uint %50 %44 + OpStore %x %51 + %54 = OpLoad %uint %x + %56 = OpBitwiseAnd %uint %54 %uint_1 + %53 = OpINotEqual %bool %56 %18 + %52 = OpSelect %uint %53 %18 %uint_1 + %58 = OpLoad %uint %x + %59 = OpIEqual %bool %58 %18 + %57 = OpSelect %uint %59 %uint_4294967295 %18 + %62 = OpBitwiseOr %uint %19 %28 + %63 = OpBitwiseOr %uint %62 %36 + %64 = OpBitwiseOr %uint %63 %44 + %65 = OpBitwiseOr %uint %64 %52 + %66 = OpBitwiseOr %uint %65 %57 + %61 = OpBitcast %int %66 + OpReturnValue %61 + OpFunctionEnd +%firstTrailingBit_3a2acc = OpFunction %void None %67 + %70 = OpLabel + %arg_0 = OpVariable %_ptr_Function_int Function %74 + %res = OpVariable %_ptr_Function_int Function %74 + OpStore %arg_0 %int_1 + %76 = OpLoad %int %arg_0 + %75 = OpFunctionCall %int %tint_first_trailing_bit %76 + OpStore %res %75 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %78 + %80 = OpLabel + %81 = OpFunctionCall %void %firstTrailingBit_3a2acc + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %67 + %83 = OpLabel + %84 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %84 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %67 + %87 = OpLabel + %88 = OpFunctionCall %void %firstTrailingBit_3a2acc + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %67 + %90 = OpLabel + %91 = OpFunctionCall %void %firstTrailingBit_3a2acc + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/firstTrailingBit/3a2acc.wgsl.expected.wgsl b/test/tint/builtins/gen/var/firstTrailingBit/3a2acc.wgsl.expected.wgsl new file mode 100644 index 0000000000..414f2ffdca --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/3a2acc.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn firstTrailingBit_3a2acc() { + var arg_0 = 1; + var res : i32 = firstTrailingBit(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + firstTrailingBit_3a2acc(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + firstTrailingBit_3a2acc(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + firstTrailingBit_3a2acc(); +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/45eb10.wgsl b/test/tint/builtins/gen/var/firstTrailingBit/45eb10.wgsl new file mode 100644 index 0000000000..a76c9b5f39 --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/45eb10.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn firstTrailingBit(vec<2, u32>) -> vec<2, u32> +fn firstTrailingBit_45eb10() { + var arg_0 = vec2(); + var res: vec2 = firstTrailingBit(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + firstTrailingBit_45eb10(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + firstTrailingBit_45eb10(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + firstTrailingBit_45eb10(); +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/45eb10.wgsl.expected.glsl b/test/tint/builtins/gen/var/firstTrailingBit/45eb10.wgsl.expected.glsl new file mode 100644 index 0000000000..e31b527163 --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/45eb10.wgsl.expected.glsl @@ -0,0 +1,97 @@ +#version 310 es + +uvec2 tint_first_trailing_bit(uvec2 v) { + uvec2 x = uvec2(v); + uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u)))); + x = (x >> b16); + uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u)))); + x = (x >> b8); + uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u)))); + x = (x >> b4); + uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u)))); + x = (x >> b2); + uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u)))); + uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u))); + return uvec2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_45eb10() { + uvec2 arg_0 = uvec2(0u); + uvec2 res = tint_first_trailing_bit(arg_0); +} + +vec4 vertex_main() { + firstTrailingBit_45eb10(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uvec2 tint_first_trailing_bit(uvec2 v) { + uvec2 x = uvec2(v); + uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u)))); + x = (x >> b16); + uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u)))); + x = (x >> b8); + uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u)))); + x = (x >> b4); + uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u)))); + x = (x >> b2); + uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u)))); + uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u))); + return uvec2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_45eb10() { + uvec2 arg_0 = uvec2(0u); + uvec2 res = tint_first_trailing_bit(arg_0); +} + +void fragment_main() { + firstTrailingBit_45eb10(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uvec2 tint_first_trailing_bit(uvec2 v) { + uvec2 x = uvec2(v); + uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u)))); + x = (x >> b16); + uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u)))); + x = (x >> b8); + uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u)))); + x = (x >> b4); + uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u)))); + x = (x >> b2); + uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u)))); + uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u))); + return uvec2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_45eb10() { + uvec2 arg_0 = uvec2(0u); + uvec2 res = tint_first_trailing_bit(arg_0); +} + +void compute_main() { + firstTrailingBit_45eb10(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/45eb10.wgsl.expected.hlsl b/test/tint/builtins/gen/var/firstTrailingBit/45eb10.wgsl.expected.hlsl new file mode 100644 index 0000000000..e8fe8a1552 --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/45eb10.wgsl.expected.hlsl @@ -0,0 +1,46 @@ +uint2 tint_first_trailing_bit(uint2 v) { + uint2 x = uint2(v); + const uint2 b16 = (bool2((x & (65535u).xx)) ? (0u).xx : (16u).xx); + x = (x >> b16); + const uint2 b8 = (bool2((x & (255u).xx)) ? (0u).xx : (8u).xx); + x = (x >> b8); + const uint2 b4 = (bool2((x & (15u).xx)) ? (0u).xx : (4u).xx); + x = (x >> b4); + const uint2 b2 = (bool2((x & (3u).xx)) ? (0u).xx : (2u).xx); + x = (x >> b2); + const uint2 b1 = (bool2((x & (1u).xx)) ? (0u).xx : (1u).xx); + const uint2 is_zero = ((x == (0u).xx) ? (4294967295u).xx : (0u).xx); + return uint2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_45eb10() { + uint2 arg_0 = (0u).xx; + uint2 res = tint_first_trailing_bit(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstTrailingBit_45eb10(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstTrailingBit_45eb10(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstTrailingBit_45eb10(); + return; +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/45eb10.wgsl.expected.msl b/test/tint/builtins/gen/var/firstTrailingBit/45eb10.wgsl.expected.msl new file mode 100644 index 0000000000..89138e0de5 --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/45eb10.wgsl.expected.msl @@ -0,0 +1,49 @@ +#include + +using namespace metal; +uint2 tint_first_trailing_bit(uint2 v) { + uint2 x = uint2(v); + uint2 const b16 = select(uint2(16u), uint2(0u), bool2((x & uint2(65535u)))); + x = (x >> b16); + uint2 const b8 = select(uint2(8u), uint2(0u), bool2((x & uint2(255u)))); + x = (x >> b8); + uint2 const b4 = select(uint2(4u), uint2(0u), bool2((x & uint2(15u)))); + x = (x >> b4); + uint2 const b2 = select(uint2(2u), uint2(0u), bool2((x & uint2(3u)))); + x = (x >> b2); + uint2 const b1 = select(uint2(1u), uint2(0u), bool2((x & uint2(1u)))); + uint2 const is_zero = select(uint2(0u), uint2(4294967295u), (x == uint2(0u))); + return uint2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_45eb10() { + uint2 arg_0 = uint2(0u); + uint2 res = tint_first_trailing_bit(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + firstTrailingBit_45eb10(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + firstTrailingBit_45eb10(); + return; +} + +kernel void compute_main() { + firstTrailingBit_45eb10(); + return; +} + diff --git a/test/tint/builtins/gen/var/firstTrailingBit/45eb10.wgsl.expected.spvasm b/test/tint/builtins/gen/var/firstTrailingBit/45eb10.wgsl.expected.spvasm new file mode 100644 index 0000000000..0e6e0873ab --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/45eb10.wgsl.expected.spvasm @@ -0,0 +1,144 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 100 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_first_trailing_bit "tint_first_trailing_bit" + OpName %v "v" + OpName %x "x" + OpName %firstTrailingBit_45eb10 "firstTrailingBit_45eb10" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %9 = OpTypeFunction %v2uint %v2uint +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %18 = OpConstantNull %v2uint + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %uint_65535 = OpConstant %uint 65535 + %25 = OpConstantComposite %v2uint %uint_65535 %uint_65535 + %uint_16 = OpConstant %uint 16 + %28 = OpConstantComposite %v2uint %uint_16 %uint_16 + %uint_255 = OpConstant %uint 255 + %35 = OpConstantComposite %v2uint %uint_255 %uint_255 + %uint_8 = OpConstant %uint 8 + %38 = OpConstantComposite %v2uint %uint_8 %uint_8 + %uint_15 = OpConstant %uint 15 + %45 = OpConstantComposite %v2uint %uint_15 %uint_15 + %uint_4 = OpConstant %uint 4 + %48 = OpConstantComposite %v2uint %uint_4 %uint_4 + %uint_3 = OpConstant %uint 3 + %55 = OpConstantComposite %v2uint %uint_3 %uint_3 + %uint_2 = OpConstant %uint 2 + %58 = OpConstantComposite %v2uint %uint_2 %uint_2 + %uint_1 = OpConstant %uint 1 + %65 = OpConstantComposite %v2uint %uint_1 %uint_1 +%uint_4294967295 = OpConstant %uint 4294967295 + %71 = OpConstantComposite %v2uint %uint_4294967295 %uint_4294967295 + %void = OpTypeVoid + %78 = OpTypeFunction %void + %86 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_first_trailing_bit = OpFunction %v2uint None %9 + %v = OpFunctionParameter %v2uint + %14 = OpLabel + %x = OpVariable %_ptr_Function_v2uint Function %18 + OpStore %x %v + %23 = OpLoad %v2uint %x + %26 = OpBitwiseAnd %v2uint %23 %25 + %20 = OpINotEqual %v2bool %26 %18 + %19 = OpSelect %v2uint %20 %18 %28 + %29 = OpLoad %v2uint %x + %30 = OpShiftRightLogical %v2uint %29 %19 + OpStore %x %30 + %33 = OpLoad %v2uint %x + %36 = OpBitwiseAnd %v2uint %33 %35 + %32 = OpINotEqual %v2bool %36 %18 + %31 = OpSelect %v2uint %32 %18 %38 + %39 = OpLoad %v2uint %x + %40 = OpShiftRightLogical %v2uint %39 %31 + OpStore %x %40 + %43 = OpLoad %v2uint %x + %46 = OpBitwiseAnd %v2uint %43 %45 + %42 = OpINotEqual %v2bool %46 %18 + %41 = OpSelect %v2uint %42 %18 %48 + %49 = OpLoad %v2uint %x + %50 = OpShiftRightLogical %v2uint %49 %41 + OpStore %x %50 + %53 = OpLoad %v2uint %x + %56 = OpBitwiseAnd %v2uint %53 %55 + %52 = OpINotEqual %v2bool %56 %18 + %51 = OpSelect %v2uint %52 %18 %58 + %59 = OpLoad %v2uint %x + %60 = OpShiftRightLogical %v2uint %59 %51 + OpStore %x %60 + %63 = OpLoad %v2uint %x + %66 = OpBitwiseAnd %v2uint %63 %65 + %62 = OpINotEqual %v2bool %66 %18 + %61 = OpSelect %v2uint %62 %18 %65 + %68 = OpLoad %v2uint %x + %69 = OpIEqual %v2bool %68 %18 + %67 = OpSelect %v2uint %69 %71 %18 + %73 = OpBitwiseOr %v2uint %19 %31 + %74 = OpBitwiseOr %v2uint %73 %41 + %75 = OpBitwiseOr %v2uint %74 %51 + %76 = OpBitwiseOr %v2uint %75 %61 + %77 = OpBitwiseOr %v2uint %76 %67 + OpReturnValue %77 + OpFunctionEnd +%firstTrailingBit_45eb10 = OpFunction %void None %78 + %81 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2uint Function %18 + %res = OpVariable %_ptr_Function_v2uint Function %18 + OpStore %arg_0 %18 + %84 = OpLoad %v2uint %arg_0 + %83 = OpFunctionCall %v2uint %tint_first_trailing_bit %84 + OpStore %res %83 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %86 + %88 = OpLabel + %89 = OpFunctionCall %void %firstTrailingBit_45eb10 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %78 + %91 = OpLabel + %92 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %92 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %78 + %95 = OpLabel + %96 = OpFunctionCall %void %firstTrailingBit_45eb10 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %78 + %98 = OpLabel + %99 = OpFunctionCall %void %firstTrailingBit_45eb10 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/firstTrailingBit/45eb10.wgsl.expected.wgsl b/test/tint/builtins/gen/var/firstTrailingBit/45eb10.wgsl.expected.wgsl new file mode 100644 index 0000000000..f462942511 --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/45eb10.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn firstTrailingBit_45eb10() { + var arg_0 = vec2(); + var res : vec2 = firstTrailingBit(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + firstTrailingBit_45eb10(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + firstTrailingBit_45eb10(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + firstTrailingBit_45eb10(); +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/47d475.wgsl b/test/tint/builtins/gen/var/firstTrailingBit/47d475.wgsl new file mode 100644 index 0000000000..1bb0de9648 --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/47d475.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn firstTrailingBit(u32) -> u32 +fn firstTrailingBit_47d475() { + var arg_0 = 1u; + var res: u32 = firstTrailingBit(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + firstTrailingBit_47d475(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + firstTrailingBit_47d475(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + firstTrailingBit_47d475(); +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/47d475.wgsl.expected.glsl b/test/tint/builtins/gen/var/firstTrailingBit/47d475.wgsl.expected.glsl new file mode 100644 index 0000000000..69af5555fa --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/47d475.wgsl.expected.glsl @@ -0,0 +1,97 @@ +#version 310 es + +uint tint_first_trailing_bit(uint v) { + uint x = uint(v); + uint b16 = (bool((x & 65535u)) ? 0u : 16u); + x = (x >> b16); + uint b8 = (bool((x & 255u)) ? 0u : 8u); + x = (x >> b8); + uint b4 = (bool((x & 15u)) ? 0u : 4u); + x = (x >> b4); + uint b2 = (bool((x & 3u)) ? 0u : 2u); + x = (x >> b2); + uint b1 = (bool((x & 1u)) ? 0u : 1u); + uint is_zero = ((x == 0u) ? 4294967295u : 0u); + return uint((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_47d475() { + uint arg_0 = 1u; + uint res = tint_first_trailing_bit(arg_0); +} + +vec4 vertex_main() { + firstTrailingBit_47d475(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uint tint_first_trailing_bit(uint v) { + uint x = uint(v); + uint b16 = (bool((x & 65535u)) ? 0u : 16u); + x = (x >> b16); + uint b8 = (bool((x & 255u)) ? 0u : 8u); + x = (x >> b8); + uint b4 = (bool((x & 15u)) ? 0u : 4u); + x = (x >> b4); + uint b2 = (bool((x & 3u)) ? 0u : 2u); + x = (x >> b2); + uint b1 = (bool((x & 1u)) ? 0u : 1u); + uint is_zero = ((x == 0u) ? 4294967295u : 0u); + return uint((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_47d475() { + uint arg_0 = 1u; + uint res = tint_first_trailing_bit(arg_0); +} + +void fragment_main() { + firstTrailingBit_47d475(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uint tint_first_trailing_bit(uint v) { + uint x = uint(v); + uint b16 = (bool((x & 65535u)) ? 0u : 16u); + x = (x >> b16); + uint b8 = (bool((x & 255u)) ? 0u : 8u); + x = (x >> b8); + uint b4 = (bool((x & 15u)) ? 0u : 4u); + x = (x >> b4); + uint b2 = (bool((x & 3u)) ? 0u : 2u); + x = (x >> b2); + uint b1 = (bool((x & 1u)) ? 0u : 1u); + uint is_zero = ((x == 0u) ? 4294967295u : 0u); + return uint((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_47d475() { + uint arg_0 = 1u; + uint res = tint_first_trailing_bit(arg_0); +} + +void compute_main() { + firstTrailingBit_47d475(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/47d475.wgsl.expected.hlsl b/test/tint/builtins/gen/var/firstTrailingBit/47d475.wgsl.expected.hlsl new file mode 100644 index 0000000000..ba3f283902 --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/47d475.wgsl.expected.hlsl @@ -0,0 +1,46 @@ +uint tint_first_trailing_bit(uint v) { + uint x = uint(v); + const uint b16 = (bool((x & 65535u)) ? 0u : 16u); + x = (x >> b16); + const uint b8 = (bool((x & 255u)) ? 0u : 8u); + x = (x >> b8); + const uint b4 = (bool((x & 15u)) ? 0u : 4u); + x = (x >> b4); + const uint b2 = (bool((x & 3u)) ? 0u : 2u); + x = (x >> b2); + const uint b1 = (bool((x & 1u)) ? 0u : 1u); + const uint is_zero = ((x == 0u) ? 4294967295u : 0u); + return uint((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_47d475() { + uint arg_0 = 1u; + uint res = tint_first_trailing_bit(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstTrailingBit_47d475(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstTrailingBit_47d475(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstTrailingBit_47d475(); + return; +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/47d475.wgsl.expected.msl b/test/tint/builtins/gen/var/firstTrailingBit/47d475.wgsl.expected.msl new file mode 100644 index 0000000000..9053e17964 --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/47d475.wgsl.expected.msl @@ -0,0 +1,49 @@ +#include + +using namespace metal; +uint tint_first_trailing_bit(uint v) { + uint x = uint(v); + uint const b16 = select(16u, 0u, bool((x & 65535u))); + x = (x >> b16); + uint const b8 = select(8u, 0u, bool((x & 255u))); + x = (x >> b8); + uint const b4 = select(4u, 0u, bool((x & 15u))); + x = (x >> b4); + uint const b2 = select(2u, 0u, bool((x & 3u))); + x = (x >> b2); + uint const b1 = select(1u, 0u, bool((x & 1u))); + uint const is_zero = select(0u, 4294967295u, (x == 0u)); + return uint((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_47d475() { + uint arg_0 = 1u; + uint res = tint_first_trailing_bit(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + firstTrailingBit_47d475(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + firstTrailingBit_47d475(); + return; +} + +kernel void compute_main() { + firstTrailingBit_47d475(); + return; +} + diff --git a/test/tint/builtins/gen/var/firstTrailingBit/47d475.wgsl.expected.spvasm b/test/tint/builtins/gen/var/firstTrailingBit/47d475.wgsl.expected.spvasm new file mode 100644 index 0000000000..fba4aa4753 --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/47d475.wgsl.expected.spvasm @@ -0,0 +1,132 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 88 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_first_trailing_bit "tint_first_trailing_bit" + OpName %v "v" + OpName %x "x" + OpName %firstTrailingBit_47d475 "firstTrailingBit_47d475" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %9 = OpTypeFunction %uint %uint +%_ptr_Function_uint = OpTypePointer Function %uint + %17 = OpConstantNull %uint + %bool = OpTypeBool + %uint_65535 = OpConstant %uint 65535 + %uint_16 = OpConstant %uint 16 + %uint_255 = OpConstant %uint 255 + %uint_8 = OpConstant %uint 8 + %uint_15 = OpConstant %uint 15 + %uint_4 = OpConstant %uint 4 + %uint_3 = OpConstant %uint 3 + %uint_2 = OpConstant %uint 2 + %uint_1 = OpConstant %uint 1 +%uint_4294967295 = OpConstant %uint 4294967295 + %void = OpTypeVoid + %66 = OpTypeFunction %void + %74 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_first_trailing_bit = OpFunction %uint None %9 + %v = OpFunctionParameter %uint + %13 = OpLabel + %x = OpVariable %_ptr_Function_uint Function %17 + OpStore %x %v + %21 = OpLoad %uint %x + %23 = OpBitwiseAnd %uint %21 %uint_65535 + %19 = OpINotEqual %bool %23 %17 + %18 = OpSelect %uint %19 %17 %uint_16 + %25 = OpLoad %uint %x + %26 = OpShiftRightLogical %uint %25 %18 + OpStore %x %26 + %29 = OpLoad %uint %x + %31 = OpBitwiseAnd %uint %29 %uint_255 + %28 = OpINotEqual %bool %31 %17 + %27 = OpSelect %uint %28 %17 %uint_8 + %33 = OpLoad %uint %x + %34 = OpShiftRightLogical %uint %33 %27 + OpStore %x %34 + %37 = OpLoad %uint %x + %39 = OpBitwiseAnd %uint %37 %uint_15 + %36 = OpINotEqual %bool %39 %17 + %35 = OpSelect %uint %36 %17 %uint_4 + %41 = OpLoad %uint %x + %42 = OpShiftRightLogical %uint %41 %35 + OpStore %x %42 + %45 = OpLoad %uint %x + %47 = OpBitwiseAnd %uint %45 %uint_3 + %44 = OpINotEqual %bool %47 %17 + %43 = OpSelect %uint %44 %17 %uint_2 + %49 = OpLoad %uint %x + %50 = OpShiftRightLogical %uint %49 %43 + OpStore %x %50 + %53 = OpLoad %uint %x + %55 = OpBitwiseAnd %uint %53 %uint_1 + %52 = OpINotEqual %bool %55 %17 + %51 = OpSelect %uint %52 %17 %uint_1 + %57 = OpLoad %uint %x + %58 = OpIEqual %bool %57 %17 + %56 = OpSelect %uint %58 %uint_4294967295 %17 + %61 = OpBitwiseOr %uint %18 %27 + %62 = OpBitwiseOr %uint %61 %35 + %63 = OpBitwiseOr %uint %62 %43 + %64 = OpBitwiseOr %uint %63 %51 + %65 = OpBitwiseOr %uint %64 %56 + OpReturnValue %65 + OpFunctionEnd +%firstTrailingBit_47d475 = OpFunction %void None %66 + %69 = OpLabel + %arg_0 = OpVariable %_ptr_Function_uint Function %17 + %res = OpVariable %_ptr_Function_uint Function %17 + OpStore %arg_0 %uint_1 + %72 = OpLoad %uint %arg_0 + %71 = OpFunctionCall %uint %tint_first_trailing_bit %72 + OpStore %res %71 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %74 + %76 = OpLabel + %77 = OpFunctionCall %void %firstTrailingBit_47d475 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %66 + %79 = OpLabel + %80 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %80 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %66 + %83 = OpLabel + %84 = OpFunctionCall %void %firstTrailingBit_47d475 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %66 + %86 = OpLabel + %87 = OpFunctionCall %void %firstTrailingBit_47d475 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/firstTrailingBit/47d475.wgsl.expected.wgsl b/test/tint/builtins/gen/var/firstTrailingBit/47d475.wgsl.expected.wgsl new file mode 100644 index 0000000000..b93d11436f --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/47d475.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn firstTrailingBit_47d475() { + var arg_0 = 1u; + var res : u32 = firstTrailingBit(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + firstTrailingBit_47d475(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + firstTrailingBit_47d475(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + firstTrailingBit_47d475(); +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/50c072.wgsl b/test/tint/builtins/gen/var/firstTrailingBit/50c072.wgsl new file mode 100644 index 0000000000..41501dfcc2 --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/50c072.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn firstTrailingBit(vec<2, i32>) -> vec<2, i32> +fn firstTrailingBit_50c072() { + var arg_0 = vec2(); + var res: vec2 = firstTrailingBit(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + firstTrailingBit_50c072(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + firstTrailingBit_50c072(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + firstTrailingBit_50c072(); +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/50c072.wgsl.expected.glsl b/test/tint/builtins/gen/var/firstTrailingBit/50c072.wgsl.expected.glsl new file mode 100644 index 0000000000..a56cd3844c --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/50c072.wgsl.expected.glsl @@ -0,0 +1,97 @@ +#version 310 es + +ivec2 tint_first_trailing_bit(ivec2 v) { + uvec2 x = uvec2(v); + uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u)))); + x = (x >> b16); + uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u)))); + x = (x >> b8); + uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u)))); + x = (x >> b4); + uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u)))); + x = (x >> b2); + uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u)))); + uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u))); + return ivec2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_50c072() { + ivec2 arg_0 = ivec2(0); + ivec2 res = tint_first_trailing_bit(arg_0); +} + +vec4 vertex_main() { + firstTrailingBit_50c072(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +ivec2 tint_first_trailing_bit(ivec2 v) { + uvec2 x = uvec2(v); + uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u)))); + x = (x >> b16); + uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u)))); + x = (x >> b8); + uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u)))); + x = (x >> b4); + uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u)))); + x = (x >> b2); + uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u)))); + uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u))); + return ivec2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_50c072() { + ivec2 arg_0 = ivec2(0); + ivec2 res = tint_first_trailing_bit(arg_0); +} + +void fragment_main() { + firstTrailingBit_50c072(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +ivec2 tint_first_trailing_bit(ivec2 v) { + uvec2 x = uvec2(v); + uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u)))); + x = (x >> b16); + uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u)))); + x = (x >> b8); + uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u)))); + x = (x >> b4); + uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u)))); + x = (x >> b2); + uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u)))); + uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u))); + return ivec2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_50c072() { + ivec2 arg_0 = ivec2(0); + ivec2 res = tint_first_trailing_bit(arg_0); +} + +void compute_main() { + firstTrailingBit_50c072(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/50c072.wgsl.expected.hlsl b/test/tint/builtins/gen/var/firstTrailingBit/50c072.wgsl.expected.hlsl new file mode 100644 index 0000000000..e0358e93e2 --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/50c072.wgsl.expected.hlsl @@ -0,0 +1,46 @@ +int2 tint_first_trailing_bit(int2 v) { + uint2 x = uint2(v); + const uint2 b16 = (bool2((x & (65535u).xx)) ? (0u).xx : (16u).xx); + x = (x >> b16); + const uint2 b8 = (bool2((x & (255u).xx)) ? (0u).xx : (8u).xx); + x = (x >> b8); + const uint2 b4 = (bool2((x & (15u).xx)) ? (0u).xx : (4u).xx); + x = (x >> b4); + const uint2 b2 = (bool2((x & (3u).xx)) ? (0u).xx : (2u).xx); + x = (x >> b2); + const uint2 b1 = (bool2((x & (1u).xx)) ? (0u).xx : (1u).xx); + const uint2 is_zero = ((x == (0u).xx) ? (4294967295u).xx : (0u).xx); + return int2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_50c072() { + int2 arg_0 = (0).xx; + int2 res = tint_first_trailing_bit(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstTrailingBit_50c072(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstTrailingBit_50c072(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstTrailingBit_50c072(); + return; +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/50c072.wgsl.expected.msl b/test/tint/builtins/gen/var/firstTrailingBit/50c072.wgsl.expected.msl new file mode 100644 index 0000000000..ad8bc33c64 --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/50c072.wgsl.expected.msl @@ -0,0 +1,49 @@ +#include + +using namespace metal; +int2 tint_first_trailing_bit(int2 v) { + uint2 x = uint2(v); + uint2 const b16 = select(uint2(16u), uint2(0u), bool2((x & uint2(65535u)))); + x = (x >> b16); + uint2 const b8 = select(uint2(8u), uint2(0u), bool2((x & uint2(255u)))); + x = (x >> b8); + uint2 const b4 = select(uint2(4u), uint2(0u), bool2((x & uint2(15u)))); + x = (x >> b4); + uint2 const b2 = select(uint2(2u), uint2(0u), bool2((x & uint2(3u)))); + x = (x >> b2); + uint2 const b1 = select(uint2(1u), uint2(0u), bool2((x & uint2(1u)))); + uint2 const is_zero = select(uint2(0u), uint2(4294967295u), (x == uint2(0u))); + return int2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_50c072() { + int2 arg_0 = int2(0); + int2 res = tint_first_trailing_bit(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + firstTrailingBit_50c072(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + firstTrailingBit_50c072(); + return; +} + +kernel void compute_main() { + firstTrailingBit_50c072(); + return; +} + diff --git a/test/tint/builtins/gen/var/firstTrailingBit/50c072.wgsl.expected.spvasm b/test/tint/builtins/gen/var/firstTrailingBit/50c072.wgsl.expected.spvasm new file mode 100644 index 0000000000..b428e65e3b --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/50c072.wgsl.expected.spvasm @@ -0,0 +1,150 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 104 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_first_trailing_bit "tint_first_trailing_bit" + OpName %v "v" + OpName %x "x" + OpName %firstTrailingBit_50c072 "firstTrailingBit_50c072" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %9 = OpTypeFunction %v2int %v2int + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %20 = OpConstantNull %v2uint + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %uint_65535 = OpConstant %uint 65535 + %27 = OpConstantComposite %v2uint %uint_65535 %uint_65535 + %uint_16 = OpConstant %uint 16 + %30 = OpConstantComposite %v2uint %uint_16 %uint_16 + %uint_255 = OpConstant %uint 255 + %37 = OpConstantComposite %v2uint %uint_255 %uint_255 + %uint_8 = OpConstant %uint 8 + %40 = OpConstantComposite %v2uint %uint_8 %uint_8 + %uint_15 = OpConstant %uint 15 + %47 = OpConstantComposite %v2uint %uint_15 %uint_15 + %uint_4 = OpConstant %uint 4 + %50 = OpConstantComposite %v2uint %uint_4 %uint_4 + %uint_3 = OpConstant %uint 3 + %57 = OpConstantComposite %v2uint %uint_3 %uint_3 + %uint_2 = OpConstant %uint 2 + %60 = OpConstantComposite %v2uint %uint_2 %uint_2 + %uint_1 = OpConstant %uint 1 + %67 = OpConstantComposite %v2uint %uint_1 %uint_1 +%uint_4294967295 = OpConstant %uint 4294967295 + %73 = OpConstantComposite %v2uint %uint_4294967295 %uint_4294967295 + %void = OpTypeVoid + %80 = OpTypeFunction %void + %84 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %90 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_first_trailing_bit = OpFunction %v2int None %9 + %v = OpFunctionParameter %v2int + %14 = OpLabel + %x = OpVariable %_ptr_Function_v2uint Function %20 + %15 = OpBitcast %v2uint %v + OpStore %x %15 + %25 = OpLoad %v2uint %x + %28 = OpBitwiseAnd %v2uint %25 %27 + %22 = OpINotEqual %v2bool %28 %20 + %21 = OpSelect %v2uint %22 %20 %30 + %31 = OpLoad %v2uint %x + %32 = OpShiftRightLogical %v2uint %31 %21 + OpStore %x %32 + %35 = OpLoad %v2uint %x + %38 = OpBitwiseAnd %v2uint %35 %37 + %34 = OpINotEqual %v2bool %38 %20 + %33 = OpSelect %v2uint %34 %20 %40 + %41 = OpLoad %v2uint %x + %42 = OpShiftRightLogical %v2uint %41 %33 + OpStore %x %42 + %45 = OpLoad %v2uint %x + %48 = OpBitwiseAnd %v2uint %45 %47 + %44 = OpINotEqual %v2bool %48 %20 + %43 = OpSelect %v2uint %44 %20 %50 + %51 = OpLoad %v2uint %x + %52 = OpShiftRightLogical %v2uint %51 %43 + OpStore %x %52 + %55 = OpLoad %v2uint %x + %58 = OpBitwiseAnd %v2uint %55 %57 + %54 = OpINotEqual %v2bool %58 %20 + %53 = OpSelect %v2uint %54 %20 %60 + %61 = OpLoad %v2uint %x + %62 = OpShiftRightLogical %v2uint %61 %53 + OpStore %x %62 + %65 = OpLoad %v2uint %x + %68 = OpBitwiseAnd %v2uint %65 %67 + %64 = OpINotEqual %v2bool %68 %20 + %63 = OpSelect %v2uint %64 %20 %67 + %70 = OpLoad %v2uint %x + %71 = OpIEqual %v2bool %70 %20 + %69 = OpSelect %v2uint %71 %73 %20 + %75 = OpBitwiseOr %v2uint %21 %33 + %76 = OpBitwiseOr %v2uint %75 %43 + %77 = OpBitwiseOr %v2uint %76 %53 + %78 = OpBitwiseOr %v2uint %77 %63 + %79 = OpBitwiseOr %v2uint %78 %69 + %74 = OpBitcast %v2int %79 + OpReturnValue %74 + OpFunctionEnd +%firstTrailingBit_50c072 = OpFunction %void None %80 + %83 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2int Function %84 + %res = OpVariable %_ptr_Function_v2int Function %84 + OpStore %arg_0 %84 + %88 = OpLoad %v2int %arg_0 + %87 = OpFunctionCall %v2int %tint_first_trailing_bit %88 + OpStore %res %87 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %90 + %92 = OpLabel + %93 = OpFunctionCall %void %firstTrailingBit_50c072 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %80 + %95 = OpLabel + %96 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %96 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %80 + %99 = OpLabel + %100 = OpFunctionCall %void %firstTrailingBit_50c072 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %80 + %102 = OpLabel + %103 = OpFunctionCall %void %firstTrailingBit_50c072 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/firstTrailingBit/50c072.wgsl.expected.wgsl b/test/tint/builtins/gen/var/firstTrailingBit/50c072.wgsl.expected.wgsl new file mode 100644 index 0000000000..e3f4f6e66c --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/50c072.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn firstTrailingBit_50c072() { + var arg_0 = vec2(); + var res : vec2 = firstTrailingBit(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + firstTrailingBit_50c072(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + firstTrailingBit_50c072(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + firstTrailingBit_50c072(); +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/7496d6.wgsl b/test/tint/builtins/gen/var/firstTrailingBit/7496d6.wgsl new file mode 100644 index 0000000000..b38a4164f1 --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/7496d6.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn firstTrailingBit(vec<3, i32>) -> vec<3, i32> +fn firstTrailingBit_7496d6() { + var arg_0 = vec3(); + var res: vec3 = firstTrailingBit(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + firstTrailingBit_7496d6(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + firstTrailingBit_7496d6(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + firstTrailingBit_7496d6(); +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/7496d6.wgsl.expected.glsl b/test/tint/builtins/gen/var/firstTrailingBit/7496d6.wgsl.expected.glsl new file mode 100644 index 0000000000..b80c1b4b8d --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/7496d6.wgsl.expected.glsl @@ -0,0 +1,97 @@ +#version 310 es + +ivec3 tint_first_trailing_bit(ivec3 v) { + uvec3 x = uvec3(v); + uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u)))); + x = (x >> b16); + uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u)))); + x = (x >> b8); + uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u)))); + x = (x >> b4); + uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u)))); + x = (x >> b2); + uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u)))); + uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u))); + return ivec3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_7496d6() { + ivec3 arg_0 = ivec3(0); + ivec3 res = tint_first_trailing_bit(arg_0); +} + +vec4 vertex_main() { + firstTrailingBit_7496d6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +ivec3 tint_first_trailing_bit(ivec3 v) { + uvec3 x = uvec3(v); + uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u)))); + x = (x >> b16); + uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u)))); + x = (x >> b8); + uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u)))); + x = (x >> b4); + uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u)))); + x = (x >> b2); + uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u)))); + uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u))); + return ivec3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_7496d6() { + ivec3 arg_0 = ivec3(0); + ivec3 res = tint_first_trailing_bit(arg_0); +} + +void fragment_main() { + firstTrailingBit_7496d6(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +ivec3 tint_first_trailing_bit(ivec3 v) { + uvec3 x = uvec3(v); + uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u)))); + x = (x >> b16); + uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u)))); + x = (x >> b8); + uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u)))); + x = (x >> b4); + uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u)))); + x = (x >> b2); + uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u)))); + uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u))); + return ivec3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_7496d6() { + ivec3 arg_0 = ivec3(0); + ivec3 res = tint_first_trailing_bit(arg_0); +} + +void compute_main() { + firstTrailingBit_7496d6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/7496d6.wgsl.expected.hlsl b/test/tint/builtins/gen/var/firstTrailingBit/7496d6.wgsl.expected.hlsl new file mode 100644 index 0000000000..dcdf8e7ada --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/7496d6.wgsl.expected.hlsl @@ -0,0 +1,46 @@ +int3 tint_first_trailing_bit(int3 v) { + uint3 x = uint3(v); + const uint3 b16 = (bool3((x & (65535u).xxx)) ? (0u).xxx : (16u).xxx); + x = (x >> b16); + const uint3 b8 = (bool3((x & (255u).xxx)) ? (0u).xxx : (8u).xxx); + x = (x >> b8); + const uint3 b4 = (bool3((x & (15u).xxx)) ? (0u).xxx : (4u).xxx); + x = (x >> b4); + const uint3 b2 = (bool3((x & (3u).xxx)) ? (0u).xxx : (2u).xxx); + x = (x >> b2); + const uint3 b1 = (bool3((x & (1u).xxx)) ? (0u).xxx : (1u).xxx); + const uint3 is_zero = ((x == (0u).xxx) ? (4294967295u).xxx : (0u).xxx); + return int3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_7496d6() { + int3 arg_0 = (0).xxx; + int3 res = tint_first_trailing_bit(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstTrailingBit_7496d6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstTrailingBit_7496d6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstTrailingBit_7496d6(); + return; +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/7496d6.wgsl.expected.msl b/test/tint/builtins/gen/var/firstTrailingBit/7496d6.wgsl.expected.msl new file mode 100644 index 0000000000..babf2c8cc6 --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/7496d6.wgsl.expected.msl @@ -0,0 +1,49 @@ +#include + +using namespace metal; +int3 tint_first_trailing_bit(int3 v) { + uint3 x = uint3(v); + uint3 const b16 = select(uint3(16u), uint3(0u), bool3((x & uint3(65535u)))); + x = (x >> b16); + uint3 const b8 = select(uint3(8u), uint3(0u), bool3((x & uint3(255u)))); + x = (x >> b8); + uint3 const b4 = select(uint3(4u), uint3(0u), bool3((x & uint3(15u)))); + x = (x >> b4); + uint3 const b2 = select(uint3(2u), uint3(0u), bool3((x & uint3(3u)))); + x = (x >> b2); + uint3 const b1 = select(uint3(1u), uint3(0u), bool3((x & uint3(1u)))); + uint3 const is_zero = select(uint3(0u), uint3(4294967295u), (x == uint3(0u))); + return int3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_7496d6() { + int3 arg_0 = int3(0); + int3 res = tint_first_trailing_bit(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + firstTrailingBit_7496d6(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + firstTrailingBit_7496d6(); + return; +} + +kernel void compute_main() { + firstTrailingBit_7496d6(); + return; +} + diff --git a/test/tint/builtins/gen/var/firstTrailingBit/7496d6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/firstTrailingBit/7496d6.wgsl.expected.spvasm new file mode 100644 index 0000000000..843ea9326d --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/7496d6.wgsl.expected.spvasm @@ -0,0 +1,150 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 104 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_first_trailing_bit "tint_first_trailing_bit" + OpName %v "v" + OpName %x "x" + OpName %firstTrailingBit_7496d6 "firstTrailingBit_7496d6" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %9 = OpTypeFunction %v3int %v3int + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %20 = OpConstantNull %v3uint + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %uint_65535 = OpConstant %uint 65535 + %27 = OpConstantComposite %v3uint %uint_65535 %uint_65535 %uint_65535 + %uint_16 = OpConstant %uint 16 + %30 = OpConstantComposite %v3uint %uint_16 %uint_16 %uint_16 + %uint_255 = OpConstant %uint 255 + %37 = OpConstantComposite %v3uint %uint_255 %uint_255 %uint_255 + %uint_8 = OpConstant %uint 8 + %40 = OpConstantComposite %v3uint %uint_8 %uint_8 %uint_8 + %uint_15 = OpConstant %uint 15 + %47 = OpConstantComposite %v3uint %uint_15 %uint_15 %uint_15 + %uint_4 = OpConstant %uint 4 + %50 = OpConstantComposite %v3uint %uint_4 %uint_4 %uint_4 + %uint_3 = OpConstant %uint 3 + %57 = OpConstantComposite %v3uint %uint_3 %uint_3 %uint_3 + %uint_2 = OpConstant %uint 2 + %60 = OpConstantComposite %v3uint %uint_2 %uint_2 %uint_2 + %uint_1 = OpConstant %uint 1 + %67 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 +%uint_4294967295 = OpConstant %uint 4294967295 + %73 = OpConstantComposite %v3uint %uint_4294967295 %uint_4294967295 %uint_4294967295 + %void = OpTypeVoid + %80 = OpTypeFunction %void + %84 = OpConstantNull %v3int +%_ptr_Function_v3int = OpTypePointer Function %v3int + %90 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_first_trailing_bit = OpFunction %v3int None %9 + %v = OpFunctionParameter %v3int + %14 = OpLabel + %x = OpVariable %_ptr_Function_v3uint Function %20 + %15 = OpBitcast %v3uint %v + OpStore %x %15 + %25 = OpLoad %v3uint %x + %28 = OpBitwiseAnd %v3uint %25 %27 + %22 = OpINotEqual %v3bool %28 %20 + %21 = OpSelect %v3uint %22 %20 %30 + %31 = OpLoad %v3uint %x + %32 = OpShiftRightLogical %v3uint %31 %21 + OpStore %x %32 + %35 = OpLoad %v3uint %x + %38 = OpBitwiseAnd %v3uint %35 %37 + %34 = OpINotEqual %v3bool %38 %20 + %33 = OpSelect %v3uint %34 %20 %40 + %41 = OpLoad %v3uint %x + %42 = OpShiftRightLogical %v3uint %41 %33 + OpStore %x %42 + %45 = OpLoad %v3uint %x + %48 = OpBitwiseAnd %v3uint %45 %47 + %44 = OpINotEqual %v3bool %48 %20 + %43 = OpSelect %v3uint %44 %20 %50 + %51 = OpLoad %v3uint %x + %52 = OpShiftRightLogical %v3uint %51 %43 + OpStore %x %52 + %55 = OpLoad %v3uint %x + %58 = OpBitwiseAnd %v3uint %55 %57 + %54 = OpINotEqual %v3bool %58 %20 + %53 = OpSelect %v3uint %54 %20 %60 + %61 = OpLoad %v3uint %x + %62 = OpShiftRightLogical %v3uint %61 %53 + OpStore %x %62 + %65 = OpLoad %v3uint %x + %68 = OpBitwiseAnd %v3uint %65 %67 + %64 = OpINotEqual %v3bool %68 %20 + %63 = OpSelect %v3uint %64 %20 %67 + %70 = OpLoad %v3uint %x + %71 = OpIEqual %v3bool %70 %20 + %69 = OpSelect %v3uint %71 %73 %20 + %75 = OpBitwiseOr %v3uint %21 %33 + %76 = OpBitwiseOr %v3uint %75 %43 + %77 = OpBitwiseOr %v3uint %76 %53 + %78 = OpBitwiseOr %v3uint %77 %63 + %79 = OpBitwiseOr %v3uint %78 %69 + %74 = OpBitcast %v3int %79 + OpReturnValue %74 + OpFunctionEnd +%firstTrailingBit_7496d6 = OpFunction %void None %80 + %83 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3int Function %84 + %res = OpVariable %_ptr_Function_v3int Function %84 + OpStore %arg_0 %84 + %88 = OpLoad %v3int %arg_0 + %87 = OpFunctionCall %v3int %tint_first_trailing_bit %88 + OpStore %res %87 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %90 + %92 = OpLabel + %93 = OpFunctionCall %void %firstTrailingBit_7496d6 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %80 + %95 = OpLabel + %96 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %96 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %80 + %99 = OpLabel + %100 = OpFunctionCall %void %firstTrailingBit_7496d6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %80 + %102 = OpLabel + %103 = OpFunctionCall %void %firstTrailingBit_7496d6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/firstTrailingBit/7496d6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/firstTrailingBit/7496d6.wgsl.expected.wgsl new file mode 100644 index 0000000000..bf926d88b5 --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/7496d6.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn firstTrailingBit_7496d6() { + var arg_0 = vec3(); + var res : vec3 = firstTrailingBit(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + firstTrailingBit_7496d6(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + firstTrailingBit_7496d6(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + firstTrailingBit_7496d6(); +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/86551b.wgsl b/test/tint/builtins/gen/var/firstTrailingBit/86551b.wgsl new file mode 100644 index 0000000000..7d87a43f3b --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/86551b.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn firstTrailingBit(vec<4, i32>) -> vec<4, i32> +fn firstTrailingBit_86551b() { + var arg_0 = vec4(); + var res: vec4 = firstTrailingBit(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + firstTrailingBit_86551b(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + firstTrailingBit_86551b(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + firstTrailingBit_86551b(); +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/86551b.wgsl.expected.glsl b/test/tint/builtins/gen/var/firstTrailingBit/86551b.wgsl.expected.glsl new file mode 100644 index 0000000000..91d2633a80 --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/86551b.wgsl.expected.glsl @@ -0,0 +1,97 @@ +#version 310 es + +ivec4 tint_first_trailing_bit(ivec4 v) { + uvec4 x = uvec4(v); + uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u)))); + x = (x >> b16); + uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u)))); + x = (x >> b8); + uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u)))); + x = (x >> b4); + uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u)))); + x = (x >> b2); + uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u)))); + uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u))); + return ivec4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_86551b() { + ivec4 arg_0 = ivec4(0); + ivec4 res = tint_first_trailing_bit(arg_0); +} + +vec4 vertex_main() { + firstTrailingBit_86551b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +ivec4 tint_first_trailing_bit(ivec4 v) { + uvec4 x = uvec4(v); + uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u)))); + x = (x >> b16); + uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u)))); + x = (x >> b8); + uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u)))); + x = (x >> b4); + uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u)))); + x = (x >> b2); + uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u)))); + uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u))); + return ivec4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_86551b() { + ivec4 arg_0 = ivec4(0); + ivec4 res = tint_first_trailing_bit(arg_0); +} + +void fragment_main() { + firstTrailingBit_86551b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +ivec4 tint_first_trailing_bit(ivec4 v) { + uvec4 x = uvec4(v); + uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u)))); + x = (x >> b16); + uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u)))); + x = (x >> b8); + uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u)))); + x = (x >> b4); + uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u)))); + x = (x >> b2); + uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u)))); + uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u))); + return ivec4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_86551b() { + ivec4 arg_0 = ivec4(0); + ivec4 res = tint_first_trailing_bit(arg_0); +} + +void compute_main() { + firstTrailingBit_86551b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/86551b.wgsl.expected.hlsl b/test/tint/builtins/gen/var/firstTrailingBit/86551b.wgsl.expected.hlsl new file mode 100644 index 0000000000..ea2a5fb98d --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/86551b.wgsl.expected.hlsl @@ -0,0 +1,46 @@ +int4 tint_first_trailing_bit(int4 v) { + uint4 x = uint4(v); + const uint4 b16 = (bool4((x & (65535u).xxxx)) ? (0u).xxxx : (16u).xxxx); + x = (x >> b16); + const uint4 b8 = (bool4((x & (255u).xxxx)) ? (0u).xxxx : (8u).xxxx); + x = (x >> b8); + const uint4 b4 = (bool4((x & (15u).xxxx)) ? (0u).xxxx : (4u).xxxx); + x = (x >> b4); + const uint4 b2 = (bool4((x & (3u).xxxx)) ? (0u).xxxx : (2u).xxxx); + x = (x >> b2); + const uint4 b1 = (bool4((x & (1u).xxxx)) ? (0u).xxxx : (1u).xxxx); + const uint4 is_zero = ((x == (0u).xxxx) ? (4294967295u).xxxx : (0u).xxxx); + return int4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_86551b() { + int4 arg_0 = (0).xxxx; + int4 res = tint_first_trailing_bit(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstTrailingBit_86551b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstTrailingBit_86551b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstTrailingBit_86551b(); + return; +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/86551b.wgsl.expected.msl b/test/tint/builtins/gen/var/firstTrailingBit/86551b.wgsl.expected.msl new file mode 100644 index 0000000000..62718e0eae --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/86551b.wgsl.expected.msl @@ -0,0 +1,49 @@ +#include + +using namespace metal; +int4 tint_first_trailing_bit(int4 v) { + uint4 x = uint4(v); + uint4 const b16 = select(uint4(16u), uint4(0u), bool4((x & uint4(65535u)))); + x = (x >> b16); + uint4 const b8 = select(uint4(8u), uint4(0u), bool4((x & uint4(255u)))); + x = (x >> b8); + uint4 const b4 = select(uint4(4u), uint4(0u), bool4((x & uint4(15u)))); + x = (x >> b4); + uint4 const b2 = select(uint4(2u), uint4(0u), bool4((x & uint4(3u)))); + x = (x >> b2); + uint4 const b1 = select(uint4(1u), uint4(0u), bool4((x & uint4(1u)))); + uint4 const is_zero = select(uint4(0u), uint4(4294967295u), (x == uint4(0u))); + return int4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_86551b() { + int4 arg_0 = int4(0); + int4 res = tint_first_trailing_bit(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + firstTrailingBit_86551b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + firstTrailingBit_86551b(); + return; +} + +kernel void compute_main() { + firstTrailingBit_86551b(); + return; +} + diff --git a/test/tint/builtins/gen/var/firstTrailingBit/86551b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/firstTrailingBit/86551b.wgsl.expected.spvasm new file mode 100644 index 0000000000..b6e04f1817 --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/86551b.wgsl.expected.spvasm @@ -0,0 +1,150 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 104 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_first_trailing_bit "tint_first_trailing_bit" + OpName %v "v" + OpName %x "x" + OpName %firstTrailingBit_86551b "firstTrailingBit_86551b" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %9 = OpTypeFunction %v4int %v4int + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %20 = OpConstantNull %v4uint + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %uint_65535 = OpConstant %uint 65535 + %27 = OpConstantComposite %v4uint %uint_65535 %uint_65535 %uint_65535 %uint_65535 + %uint_16 = OpConstant %uint 16 + %30 = OpConstantComposite %v4uint %uint_16 %uint_16 %uint_16 %uint_16 + %uint_255 = OpConstant %uint 255 + %37 = OpConstantComposite %v4uint %uint_255 %uint_255 %uint_255 %uint_255 + %uint_8 = OpConstant %uint 8 + %40 = OpConstantComposite %v4uint %uint_8 %uint_8 %uint_8 %uint_8 + %uint_15 = OpConstant %uint 15 + %47 = OpConstantComposite %v4uint %uint_15 %uint_15 %uint_15 %uint_15 + %uint_4 = OpConstant %uint 4 + %50 = OpConstantComposite %v4uint %uint_4 %uint_4 %uint_4 %uint_4 + %uint_3 = OpConstant %uint 3 + %57 = OpConstantComposite %v4uint %uint_3 %uint_3 %uint_3 %uint_3 + %uint_2 = OpConstant %uint 2 + %60 = OpConstantComposite %v4uint %uint_2 %uint_2 %uint_2 %uint_2 + %uint_1 = OpConstant %uint 1 + %67 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1 +%uint_4294967295 = OpConstant %uint 4294967295 + %73 = OpConstantComposite %v4uint %uint_4294967295 %uint_4294967295 %uint_4294967295 %uint_4294967295 + %void = OpTypeVoid + %80 = OpTypeFunction %void + %84 = OpConstantNull %v4int +%_ptr_Function_v4int = OpTypePointer Function %v4int + %90 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_first_trailing_bit = OpFunction %v4int None %9 + %v = OpFunctionParameter %v4int + %14 = OpLabel + %x = OpVariable %_ptr_Function_v4uint Function %20 + %15 = OpBitcast %v4uint %v + OpStore %x %15 + %25 = OpLoad %v4uint %x + %28 = OpBitwiseAnd %v4uint %25 %27 + %22 = OpINotEqual %v4bool %28 %20 + %21 = OpSelect %v4uint %22 %20 %30 + %31 = OpLoad %v4uint %x + %32 = OpShiftRightLogical %v4uint %31 %21 + OpStore %x %32 + %35 = OpLoad %v4uint %x + %38 = OpBitwiseAnd %v4uint %35 %37 + %34 = OpINotEqual %v4bool %38 %20 + %33 = OpSelect %v4uint %34 %20 %40 + %41 = OpLoad %v4uint %x + %42 = OpShiftRightLogical %v4uint %41 %33 + OpStore %x %42 + %45 = OpLoad %v4uint %x + %48 = OpBitwiseAnd %v4uint %45 %47 + %44 = OpINotEqual %v4bool %48 %20 + %43 = OpSelect %v4uint %44 %20 %50 + %51 = OpLoad %v4uint %x + %52 = OpShiftRightLogical %v4uint %51 %43 + OpStore %x %52 + %55 = OpLoad %v4uint %x + %58 = OpBitwiseAnd %v4uint %55 %57 + %54 = OpINotEqual %v4bool %58 %20 + %53 = OpSelect %v4uint %54 %20 %60 + %61 = OpLoad %v4uint %x + %62 = OpShiftRightLogical %v4uint %61 %53 + OpStore %x %62 + %65 = OpLoad %v4uint %x + %68 = OpBitwiseAnd %v4uint %65 %67 + %64 = OpINotEqual %v4bool %68 %20 + %63 = OpSelect %v4uint %64 %20 %67 + %70 = OpLoad %v4uint %x + %71 = OpIEqual %v4bool %70 %20 + %69 = OpSelect %v4uint %71 %73 %20 + %75 = OpBitwiseOr %v4uint %21 %33 + %76 = OpBitwiseOr %v4uint %75 %43 + %77 = OpBitwiseOr %v4uint %76 %53 + %78 = OpBitwiseOr %v4uint %77 %63 + %79 = OpBitwiseOr %v4uint %78 %69 + %74 = OpBitcast %v4int %79 + OpReturnValue %74 + OpFunctionEnd +%firstTrailingBit_86551b = OpFunction %void None %80 + %83 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4int Function %84 + %res = OpVariable %_ptr_Function_v4int Function %84 + OpStore %arg_0 %84 + %88 = OpLoad %v4int %arg_0 + %87 = OpFunctionCall %v4int %tint_first_trailing_bit %88 + OpStore %res %87 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %90 + %92 = OpLabel + %93 = OpFunctionCall %void %firstTrailingBit_86551b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %80 + %95 = OpLabel + %96 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %96 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %80 + %99 = OpLabel + %100 = OpFunctionCall %void %firstTrailingBit_86551b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %80 + %102 = OpLabel + %103 = OpFunctionCall %void %firstTrailingBit_86551b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/firstTrailingBit/86551b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/firstTrailingBit/86551b.wgsl.expected.wgsl new file mode 100644 index 0000000000..f12d0220a0 --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/86551b.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn firstTrailingBit_86551b() { + var arg_0 = vec4(); + var res : vec4 = firstTrailingBit(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + firstTrailingBit_86551b(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + firstTrailingBit_86551b(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + firstTrailingBit_86551b(); +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/cb51ce.wgsl b/test/tint/builtins/gen/var/firstTrailingBit/cb51ce.wgsl new file mode 100644 index 0000000000..f32a9b8d61 --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/cb51ce.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn firstTrailingBit(vec<3, u32>) -> vec<3, u32> +fn firstTrailingBit_cb51ce() { + var arg_0 = vec3(); + var res: vec3 = firstTrailingBit(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + firstTrailingBit_cb51ce(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + firstTrailingBit_cb51ce(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + firstTrailingBit_cb51ce(); +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/cb51ce.wgsl.expected.glsl b/test/tint/builtins/gen/var/firstTrailingBit/cb51ce.wgsl.expected.glsl new file mode 100644 index 0000000000..f01c16c3cc --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/cb51ce.wgsl.expected.glsl @@ -0,0 +1,97 @@ +#version 310 es + +uvec3 tint_first_trailing_bit(uvec3 v) { + uvec3 x = uvec3(v); + uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u)))); + x = (x >> b16); + uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u)))); + x = (x >> b8); + uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u)))); + x = (x >> b4); + uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u)))); + x = (x >> b2); + uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u)))); + uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u))); + return uvec3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_cb51ce() { + uvec3 arg_0 = uvec3(0u); + uvec3 res = tint_first_trailing_bit(arg_0); +} + +vec4 vertex_main() { + firstTrailingBit_cb51ce(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uvec3 tint_first_trailing_bit(uvec3 v) { + uvec3 x = uvec3(v); + uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u)))); + x = (x >> b16); + uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u)))); + x = (x >> b8); + uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u)))); + x = (x >> b4); + uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u)))); + x = (x >> b2); + uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u)))); + uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u))); + return uvec3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_cb51ce() { + uvec3 arg_0 = uvec3(0u); + uvec3 res = tint_first_trailing_bit(arg_0); +} + +void fragment_main() { + firstTrailingBit_cb51ce(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uvec3 tint_first_trailing_bit(uvec3 v) { + uvec3 x = uvec3(v); + uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u)))); + x = (x >> b16); + uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u)))); + x = (x >> b8); + uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u)))); + x = (x >> b4); + uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u)))); + x = (x >> b2); + uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u)))); + uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u))); + return uvec3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_cb51ce() { + uvec3 arg_0 = uvec3(0u); + uvec3 res = tint_first_trailing_bit(arg_0); +} + +void compute_main() { + firstTrailingBit_cb51ce(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/cb51ce.wgsl.expected.hlsl b/test/tint/builtins/gen/var/firstTrailingBit/cb51ce.wgsl.expected.hlsl new file mode 100644 index 0000000000..747300c9fc --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/cb51ce.wgsl.expected.hlsl @@ -0,0 +1,46 @@ +uint3 tint_first_trailing_bit(uint3 v) { + uint3 x = uint3(v); + const uint3 b16 = (bool3((x & (65535u).xxx)) ? (0u).xxx : (16u).xxx); + x = (x >> b16); + const uint3 b8 = (bool3((x & (255u).xxx)) ? (0u).xxx : (8u).xxx); + x = (x >> b8); + const uint3 b4 = (bool3((x & (15u).xxx)) ? (0u).xxx : (4u).xxx); + x = (x >> b4); + const uint3 b2 = (bool3((x & (3u).xxx)) ? (0u).xxx : (2u).xxx); + x = (x >> b2); + const uint3 b1 = (bool3((x & (1u).xxx)) ? (0u).xxx : (1u).xxx); + const uint3 is_zero = ((x == (0u).xxx) ? (4294967295u).xxx : (0u).xxx); + return uint3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_cb51ce() { + uint3 arg_0 = (0u).xxx; + uint3 res = tint_first_trailing_bit(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstTrailingBit_cb51ce(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstTrailingBit_cb51ce(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstTrailingBit_cb51ce(); + return; +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/cb51ce.wgsl.expected.msl b/test/tint/builtins/gen/var/firstTrailingBit/cb51ce.wgsl.expected.msl new file mode 100644 index 0000000000..4cd8f3a2c4 --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/cb51ce.wgsl.expected.msl @@ -0,0 +1,49 @@ +#include + +using namespace metal; +uint3 tint_first_trailing_bit(uint3 v) { + uint3 x = uint3(v); + uint3 const b16 = select(uint3(16u), uint3(0u), bool3((x & uint3(65535u)))); + x = (x >> b16); + uint3 const b8 = select(uint3(8u), uint3(0u), bool3((x & uint3(255u)))); + x = (x >> b8); + uint3 const b4 = select(uint3(4u), uint3(0u), bool3((x & uint3(15u)))); + x = (x >> b4); + uint3 const b2 = select(uint3(2u), uint3(0u), bool3((x & uint3(3u)))); + x = (x >> b2); + uint3 const b1 = select(uint3(1u), uint3(0u), bool3((x & uint3(1u)))); + uint3 const is_zero = select(uint3(0u), uint3(4294967295u), (x == uint3(0u))); + return uint3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_cb51ce() { + uint3 arg_0 = uint3(0u); + uint3 res = tint_first_trailing_bit(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + firstTrailingBit_cb51ce(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + firstTrailingBit_cb51ce(); + return; +} + +kernel void compute_main() { + firstTrailingBit_cb51ce(); + return; +} + diff --git a/test/tint/builtins/gen/var/firstTrailingBit/cb51ce.wgsl.expected.spvasm b/test/tint/builtins/gen/var/firstTrailingBit/cb51ce.wgsl.expected.spvasm new file mode 100644 index 0000000000..742b42ba17 --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/cb51ce.wgsl.expected.spvasm @@ -0,0 +1,144 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 100 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_first_trailing_bit "tint_first_trailing_bit" + OpName %v "v" + OpName %x "x" + OpName %firstTrailingBit_cb51ce "firstTrailingBit_cb51ce" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %9 = OpTypeFunction %v3uint %v3uint +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %18 = OpConstantNull %v3uint + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %uint_65535 = OpConstant %uint 65535 + %25 = OpConstantComposite %v3uint %uint_65535 %uint_65535 %uint_65535 + %uint_16 = OpConstant %uint 16 + %28 = OpConstantComposite %v3uint %uint_16 %uint_16 %uint_16 + %uint_255 = OpConstant %uint 255 + %35 = OpConstantComposite %v3uint %uint_255 %uint_255 %uint_255 + %uint_8 = OpConstant %uint 8 + %38 = OpConstantComposite %v3uint %uint_8 %uint_8 %uint_8 + %uint_15 = OpConstant %uint 15 + %45 = OpConstantComposite %v3uint %uint_15 %uint_15 %uint_15 + %uint_4 = OpConstant %uint 4 + %48 = OpConstantComposite %v3uint %uint_4 %uint_4 %uint_4 + %uint_3 = OpConstant %uint 3 + %55 = OpConstantComposite %v3uint %uint_3 %uint_3 %uint_3 + %uint_2 = OpConstant %uint 2 + %58 = OpConstantComposite %v3uint %uint_2 %uint_2 %uint_2 + %uint_1 = OpConstant %uint 1 + %65 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 +%uint_4294967295 = OpConstant %uint 4294967295 + %71 = OpConstantComposite %v3uint %uint_4294967295 %uint_4294967295 %uint_4294967295 + %void = OpTypeVoid + %78 = OpTypeFunction %void + %86 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_first_trailing_bit = OpFunction %v3uint None %9 + %v = OpFunctionParameter %v3uint + %14 = OpLabel + %x = OpVariable %_ptr_Function_v3uint Function %18 + OpStore %x %v + %23 = OpLoad %v3uint %x + %26 = OpBitwiseAnd %v3uint %23 %25 + %20 = OpINotEqual %v3bool %26 %18 + %19 = OpSelect %v3uint %20 %18 %28 + %29 = OpLoad %v3uint %x + %30 = OpShiftRightLogical %v3uint %29 %19 + OpStore %x %30 + %33 = OpLoad %v3uint %x + %36 = OpBitwiseAnd %v3uint %33 %35 + %32 = OpINotEqual %v3bool %36 %18 + %31 = OpSelect %v3uint %32 %18 %38 + %39 = OpLoad %v3uint %x + %40 = OpShiftRightLogical %v3uint %39 %31 + OpStore %x %40 + %43 = OpLoad %v3uint %x + %46 = OpBitwiseAnd %v3uint %43 %45 + %42 = OpINotEqual %v3bool %46 %18 + %41 = OpSelect %v3uint %42 %18 %48 + %49 = OpLoad %v3uint %x + %50 = OpShiftRightLogical %v3uint %49 %41 + OpStore %x %50 + %53 = OpLoad %v3uint %x + %56 = OpBitwiseAnd %v3uint %53 %55 + %52 = OpINotEqual %v3bool %56 %18 + %51 = OpSelect %v3uint %52 %18 %58 + %59 = OpLoad %v3uint %x + %60 = OpShiftRightLogical %v3uint %59 %51 + OpStore %x %60 + %63 = OpLoad %v3uint %x + %66 = OpBitwiseAnd %v3uint %63 %65 + %62 = OpINotEqual %v3bool %66 %18 + %61 = OpSelect %v3uint %62 %18 %65 + %68 = OpLoad %v3uint %x + %69 = OpIEqual %v3bool %68 %18 + %67 = OpSelect %v3uint %69 %71 %18 + %73 = OpBitwiseOr %v3uint %19 %31 + %74 = OpBitwiseOr %v3uint %73 %41 + %75 = OpBitwiseOr %v3uint %74 %51 + %76 = OpBitwiseOr %v3uint %75 %61 + %77 = OpBitwiseOr %v3uint %76 %67 + OpReturnValue %77 + OpFunctionEnd +%firstTrailingBit_cb51ce = OpFunction %void None %78 + %81 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3uint Function %18 + %res = OpVariable %_ptr_Function_v3uint Function %18 + OpStore %arg_0 %18 + %84 = OpLoad %v3uint %arg_0 + %83 = OpFunctionCall %v3uint %tint_first_trailing_bit %84 + OpStore %res %83 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %86 + %88 = OpLabel + %89 = OpFunctionCall %void %firstTrailingBit_cb51ce + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %78 + %91 = OpLabel + %92 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %92 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %78 + %95 = OpLabel + %96 = OpFunctionCall %void %firstTrailingBit_cb51ce + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %78 + %98 = OpLabel + %99 = OpFunctionCall %void %firstTrailingBit_cb51ce + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/firstTrailingBit/cb51ce.wgsl.expected.wgsl b/test/tint/builtins/gen/var/firstTrailingBit/cb51ce.wgsl.expected.wgsl new file mode 100644 index 0000000000..f167e27d0f --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/cb51ce.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn firstTrailingBit_cb51ce() { + var arg_0 = vec3(); + var res : vec3 = firstTrailingBit(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + firstTrailingBit_cb51ce(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + firstTrailingBit_cb51ce(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + firstTrailingBit_cb51ce(); +} diff --git a/test/tint/builtins/gen/var/floor/3bccc4.wgsl b/test/tint/builtins/gen/var/floor/3bccc4.wgsl new file mode 100644 index 0000000000..8ff9d8fa66 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/3bccc4.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn floor(vec<4, f32>) -> vec<4, f32> +fn floor_3bccc4() { + var arg_0 = vec4(); + var res: vec4 = floor(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + floor_3bccc4(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + floor_3bccc4(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + floor_3bccc4(); +} diff --git a/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.glsl b/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.glsl new file mode 100644 index 0000000000..3b91e5d61d --- /dev/null +++ b/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void floor_3bccc4() { + vec4 arg_0 = vec4(0.0f); + vec4 res = floor(arg_0); +} + +vec4 vertex_main() { + floor_3bccc4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void floor_3bccc4() { + vec4 arg_0 = vec4(0.0f); + vec4 res = floor(arg_0); +} + +void fragment_main() { + floor_3bccc4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void floor_3bccc4() { + vec4 arg_0 = vec4(0.0f); + vec4 res = floor(arg_0); +} + +void compute_main() { + floor_3bccc4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.hlsl b/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.hlsl new file mode 100644 index 0000000000..18d11a34b2 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void floor_3bccc4() { + float4 arg_0 = (0.0f).xxxx; + float4 res = floor(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + floor_3bccc4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + floor_3bccc4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + floor_3bccc4(); + return; +} diff --git a/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.msl b/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.msl new file mode 100644 index 0000000000..1c6a7e75a0 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void floor_3bccc4() { + float4 arg_0 = float4(0.0f); + float4 res = floor(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + floor_3bccc4(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + floor_3bccc4(); + return; +} + +kernel void compute_main() { + floor_3bccc4(); + return; +} + diff --git a/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.spvasm new file mode 100644 index 0000000000..b2e800a036 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %floor_3bccc4 "floor_3bccc4" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%floor_3bccc4 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %5 + %17 = OpLoad %v4float %arg_0 + %15 = OpExtInst %v4float %16 Floor %17 + OpStore %res %15 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %floor_3bccc4 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %floor_3bccc4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %floor_3bccc4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.wgsl new file mode 100644 index 0000000000..119d8fe867 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn floor_3bccc4() { + var arg_0 = vec4(); + var res : vec4 = floor(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + floor_3bccc4(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + floor_3bccc4(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + floor_3bccc4(); +} diff --git a/test/tint/builtins/gen/var/floor/5fc9ac.wgsl b/test/tint/builtins/gen/var/floor/5fc9ac.wgsl new file mode 100644 index 0000000000..0f701821e9 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/5fc9ac.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn floor(vec<2, f32>) -> vec<2, f32> +fn floor_5fc9ac() { + var arg_0 = vec2(); + var res: vec2 = floor(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + floor_5fc9ac(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + floor_5fc9ac(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + floor_5fc9ac(); +} diff --git a/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.glsl b/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.glsl new file mode 100644 index 0000000000..570e48b050 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void floor_5fc9ac() { + vec2 arg_0 = vec2(0.0f); + vec2 res = floor(arg_0); +} + +vec4 vertex_main() { + floor_5fc9ac(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void floor_5fc9ac() { + vec2 arg_0 = vec2(0.0f); + vec2 res = floor(arg_0); +} + +void fragment_main() { + floor_5fc9ac(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void floor_5fc9ac() { + vec2 arg_0 = vec2(0.0f); + vec2 res = floor(arg_0); +} + +void compute_main() { + floor_5fc9ac(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.hlsl b/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.hlsl new file mode 100644 index 0000000000..74dd9c53d3 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void floor_5fc9ac() { + float2 arg_0 = (0.0f).xx; + float2 res = floor(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + floor_5fc9ac(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + floor_5fc9ac(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + floor_5fc9ac(); + return; +} diff --git a/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.msl b/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.msl new file mode 100644 index 0000000000..01c6b5f922 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void floor_5fc9ac() { + float2 arg_0 = float2(0.0f); + float2 res = floor(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + floor_5fc9ac(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + floor_5fc9ac(); + return; +} + +kernel void compute_main() { + floor_5fc9ac(); + return; +} + diff --git a/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.spvasm b/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.spvasm new file mode 100644 index 0000000000..0ce4a88330 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %floor_5fc9ac "floor_5fc9ac" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %14 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%floor_5fc9ac = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %14 + %res = OpVariable %_ptr_Function_v2float Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %v2float %arg_0 + %17 = OpExtInst %v2float %18 Floor %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %floor_5fc9ac + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %floor_5fc9ac + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %floor_5fc9ac + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.wgsl b/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.wgsl new file mode 100644 index 0000000000..6ebabfcafa --- /dev/null +++ b/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn floor_5fc9ac() { + var arg_0 = vec2(); + var res : vec2 = floor(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + floor_5fc9ac(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + floor_5fc9ac(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + floor_5fc9ac(); +} diff --git a/test/tint/builtins/gen/var/floor/60d7ea.wgsl b/test/tint/builtins/gen/var/floor/60d7ea.wgsl new file mode 100644 index 0000000000..fe6a56eeae --- /dev/null +++ b/test/tint/builtins/gen/var/floor/60d7ea.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn floor(vec<3, f32>) -> vec<3, f32> +fn floor_60d7ea() { + var arg_0 = vec3(); + var res: vec3 = floor(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + floor_60d7ea(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + floor_60d7ea(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + floor_60d7ea(); +} diff --git a/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.glsl b/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.glsl new file mode 100644 index 0000000000..22fae37bc1 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void floor_60d7ea() { + vec3 arg_0 = vec3(0.0f); + vec3 res = floor(arg_0); +} + +vec4 vertex_main() { + floor_60d7ea(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void floor_60d7ea() { + vec3 arg_0 = vec3(0.0f); + vec3 res = floor(arg_0); +} + +void fragment_main() { + floor_60d7ea(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void floor_60d7ea() { + vec3 arg_0 = vec3(0.0f); + vec3 res = floor(arg_0); +} + +void compute_main() { + floor_60d7ea(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.hlsl b/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.hlsl new file mode 100644 index 0000000000..7659782421 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void floor_60d7ea() { + float3 arg_0 = (0.0f).xxx; + float3 res = floor(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + floor_60d7ea(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + floor_60d7ea(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + floor_60d7ea(); + return; +} diff --git a/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.msl b/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.msl new file mode 100644 index 0000000000..fd7f6d5623 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void floor_60d7ea() { + float3 arg_0 = float3(0.0f); + float3 res = floor(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + floor_60d7ea(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + floor_60d7ea(); + return; +} + +kernel void compute_main() { + floor_60d7ea(); + return; +} + diff --git a/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.spvasm b/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.spvasm new file mode 100644 index 0000000000..0da636b061 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %floor_60d7ea "floor_60d7ea" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %14 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%floor_60d7ea = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %14 + %res = OpVariable %_ptr_Function_v3float Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %v3float %arg_0 + %17 = OpExtInst %v3float %18 Floor %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %floor_60d7ea + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %floor_60d7ea + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %floor_60d7ea + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.wgsl b/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.wgsl new file mode 100644 index 0000000000..efb4036270 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn floor_60d7ea() { + var arg_0 = vec3(); + var res : vec3 = floor(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + floor_60d7ea(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + floor_60d7ea(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + floor_60d7ea(); +} diff --git a/test/tint/builtins/gen/var/floor/66f154.wgsl b/test/tint/builtins/gen/var/floor/66f154.wgsl new file mode 100644 index 0000000000..20f91b660a --- /dev/null +++ b/test/tint/builtins/gen/var/floor/66f154.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn floor(f32) -> f32 +fn floor_66f154() { + var arg_0 = 1.0; + var res: f32 = floor(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + floor_66f154(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + floor_66f154(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + floor_66f154(); +} diff --git a/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.glsl b/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.glsl new file mode 100644 index 0000000000..4de296cd7c --- /dev/null +++ b/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void floor_66f154() { + float arg_0 = 1.0f; + float res = floor(arg_0); +} + +vec4 vertex_main() { + floor_66f154(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void floor_66f154() { + float arg_0 = 1.0f; + float res = floor(arg_0); +} + +void fragment_main() { + floor_66f154(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void floor_66f154() { + float arg_0 = 1.0f; + float res = floor(arg_0); +} + +void compute_main() { + floor_66f154(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.hlsl b/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.hlsl new file mode 100644 index 0000000000..43aecf810f --- /dev/null +++ b/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void floor_66f154() { + float arg_0 = 1.0f; + float res = floor(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + floor_66f154(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + floor_66f154(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + floor_66f154(); + return; +} diff --git a/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.msl b/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.msl new file mode 100644 index 0000000000..577960f4a8 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void floor_66f154() { + float arg_0 = 1.0f; + float res = floor(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + floor_66f154(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + floor_66f154(); + return; +} + +kernel void compute_main() { + floor_66f154(); + return; +} + diff --git a/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.spvasm b/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.spvasm new file mode 100644 index 0000000000..dc8849461d --- /dev/null +++ b/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %floor_66f154 "floor_66f154" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %20 = OpTypeFunction %v4float +%floor_66f154 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + %18 = OpLoad %float %arg_0 + %16 = OpExtInst %float %17 Floor %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %floor_66f154 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %floor_66f154 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %floor_66f154 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.wgsl b/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.wgsl new file mode 100644 index 0000000000..a368ec4c74 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn floor_66f154() { + var arg_0 = 1.0; + var res : f32 = floor(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + floor_66f154(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + floor_66f154(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + floor_66f154(); +} diff --git a/test/tint/builtins/gen/var/fma/26a7a9.wgsl b/test/tint/builtins/gen/var/fma/26a7a9.wgsl new file mode 100644 index 0000000000..77a07d664b --- /dev/null +++ b/test/tint/builtins/gen/var/fma/26a7a9.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn fma(vec<2, f32>, vec<2, f32>, vec<2, f32>) -> vec<2, f32> +fn fma_26a7a9() { + var arg_0 = vec2(); + var arg_1 = vec2(); + var arg_2 = vec2(); + var res: vec2 = fma(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + fma_26a7a9(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + fma_26a7a9(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + fma_26a7a9(); +} diff --git a/test/tint/builtins/gen/var/fma/26a7a9.wgsl.expected.glsl b/test/tint/builtins/gen/var/fma/26a7a9.wgsl.expected.glsl new file mode 100644 index 0000000000..dbc3037b33 --- /dev/null +++ b/test/tint/builtins/gen/var/fma/26a7a9.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void fma_26a7a9() { + vec2 arg_0 = vec2(0.0f); + vec2 arg_1 = vec2(0.0f); + vec2 arg_2 = vec2(0.0f); + vec2 res = ((arg_0) * (arg_1) + (arg_2)); +} + +vec4 vertex_main() { + fma_26a7a9(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void fma_26a7a9() { + vec2 arg_0 = vec2(0.0f); + vec2 arg_1 = vec2(0.0f); + vec2 arg_2 = vec2(0.0f); + vec2 res = ((arg_0) * (arg_1) + (arg_2)); +} + +void fragment_main() { + fma_26a7a9(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void fma_26a7a9() { + vec2 arg_0 = vec2(0.0f); + vec2 arg_1 = vec2(0.0f); + vec2 arg_2 = vec2(0.0f); + vec2 res = ((arg_0) * (arg_1) + (arg_2)); +} + +void compute_main() { + fma_26a7a9(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/fma/26a7a9.wgsl.expected.hlsl b/test/tint/builtins/gen/var/fma/26a7a9.wgsl.expected.hlsl new file mode 100644 index 0000000000..b8a1465814 --- /dev/null +++ b/test/tint/builtins/gen/var/fma/26a7a9.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +void fma_26a7a9() { + float2 arg_0 = (0.0f).xx; + float2 arg_1 = (0.0f).xx; + float2 arg_2 = (0.0f).xx; + float2 res = mad(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fma_26a7a9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fma_26a7a9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fma_26a7a9(); + return; +} diff --git a/test/tint/builtins/gen/var/fma/26a7a9.wgsl.expected.msl b/test/tint/builtins/gen/var/fma/26a7a9.wgsl.expected.msl new file mode 100644 index 0000000000..678c2ce86e --- /dev/null +++ b/test/tint/builtins/gen/var/fma/26a7a9.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void fma_26a7a9() { + float2 arg_0 = float2(0.0f); + float2 arg_1 = float2(0.0f); + float2 arg_2 = float2(0.0f); + float2 res = fma(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + fma_26a7a9(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + fma_26a7a9(); + return; +} + +kernel void compute_main() { + fma_26a7a9(); + return; +} + diff --git a/test/tint/builtins/gen/var/fma/26a7a9.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fma/26a7a9.wgsl.expected.spvasm new file mode 100644 index 0000000000..6f96fbed11 --- /dev/null +++ b/test/tint/builtins/gen/var/fma/26a7a9.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %fma_26a7a9 "fma_26a7a9" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %14 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %fma_26a7a9 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %14 + %arg_1 = OpVariable %_ptr_Function_v2float Function %14 + %arg_2 = OpVariable %_ptr_Function_v2float Function %14 + %res = OpVariable %_ptr_Function_v2float Function %14 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + OpStore %arg_2 %14 + %21 = OpLoad %v2float %arg_0 + %22 = OpLoad %v2float %arg_1 + %23 = OpLoad %v2float %arg_2 + %19 = OpExtInst %v2float %20 Fma %21 %22 %23 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %fma_26a7a9 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %fma_26a7a9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %fma_26a7a9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/fma/26a7a9.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fma/26a7a9.wgsl.expected.wgsl new file mode 100644 index 0000000000..ee689746d2 --- /dev/null +++ b/test/tint/builtins/gen/var/fma/26a7a9.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn fma_26a7a9() { + var arg_0 = vec2(); + var arg_1 = vec2(); + var arg_2 = vec2(); + var res : vec2 = fma(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + fma_26a7a9(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + fma_26a7a9(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + fma_26a7a9(); +} diff --git a/test/tint/builtins/gen/var/fma/6a3283.wgsl b/test/tint/builtins/gen/var/fma/6a3283.wgsl new file mode 100644 index 0000000000..4cfaff29ad --- /dev/null +++ b/test/tint/builtins/gen/var/fma/6a3283.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn fma(vec<4, f32>, vec<4, f32>, vec<4, f32>) -> vec<4, f32> +fn fma_6a3283() { + var arg_0 = vec4(); + var arg_1 = vec4(); + var arg_2 = vec4(); + var res: vec4 = fma(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + fma_6a3283(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + fma_6a3283(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + fma_6a3283(); +} diff --git a/test/tint/builtins/gen/var/fma/6a3283.wgsl.expected.glsl b/test/tint/builtins/gen/var/fma/6a3283.wgsl.expected.glsl new file mode 100644 index 0000000000..2b0fd3d0dd --- /dev/null +++ b/test/tint/builtins/gen/var/fma/6a3283.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void fma_6a3283() { + vec4 arg_0 = vec4(0.0f); + vec4 arg_1 = vec4(0.0f); + vec4 arg_2 = vec4(0.0f); + vec4 res = ((arg_0) * (arg_1) + (arg_2)); +} + +vec4 vertex_main() { + fma_6a3283(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void fma_6a3283() { + vec4 arg_0 = vec4(0.0f); + vec4 arg_1 = vec4(0.0f); + vec4 arg_2 = vec4(0.0f); + vec4 res = ((arg_0) * (arg_1) + (arg_2)); +} + +void fragment_main() { + fma_6a3283(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void fma_6a3283() { + vec4 arg_0 = vec4(0.0f); + vec4 arg_1 = vec4(0.0f); + vec4 arg_2 = vec4(0.0f); + vec4 res = ((arg_0) * (arg_1) + (arg_2)); +} + +void compute_main() { + fma_6a3283(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/fma/6a3283.wgsl.expected.hlsl b/test/tint/builtins/gen/var/fma/6a3283.wgsl.expected.hlsl new file mode 100644 index 0000000000..8786af1a0a --- /dev/null +++ b/test/tint/builtins/gen/var/fma/6a3283.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +void fma_6a3283() { + float4 arg_0 = (0.0f).xxxx; + float4 arg_1 = (0.0f).xxxx; + float4 arg_2 = (0.0f).xxxx; + float4 res = mad(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fma_6a3283(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fma_6a3283(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fma_6a3283(); + return; +} diff --git a/test/tint/builtins/gen/var/fma/6a3283.wgsl.expected.msl b/test/tint/builtins/gen/var/fma/6a3283.wgsl.expected.msl new file mode 100644 index 0000000000..34687c1a67 --- /dev/null +++ b/test/tint/builtins/gen/var/fma/6a3283.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void fma_6a3283() { + float4 arg_0 = float4(0.0f); + float4 arg_1 = float4(0.0f); + float4 arg_2 = float4(0.0f); + float4 res = fma(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + fma_6a3283(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + fma_6a3283(); + return; +} + +kernel void compute_main() { + fma_6a3283(); + return; +} + diff --git a/test/tint/builtins/gen/var/fma/6a3283.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fma/6a3283.wgsl.expected.spvasm new file mode 100644 index 0000000000..ab7b9b8958 --- /dev/null +++ b/test/tint/builtins/gen/var/fma/6a3283.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %fma_6a3283 "fma_6a3283" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %fma_6a3283 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %arg_1 = OpVariable %_ptr_Function_v4float Function %5 + %arg_2 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %5 + OpStore %arg_1 %5 + OpStore %arg_2 %5 + %19 = OpLoad %v4float %arg_0 + %20 = OpLoad %v4float %arg_1 + %21 = OpLoad %v4float %arg_2 + %17 = OpExtInst %v4float %18 Fma %19 %20 %21 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %fma_6a3283 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %fma_6a3283 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %fma_6a3283 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/fma/6a3283.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fma/6a3283.wgsl.expected.wgsl new file mode 100644 index 0000000000..4cf1dde575 --- /dev/null +++ b/test/tint/builtins/gen/var/fma/6a3283.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn fma_6a3283() { + var arg_0 = vec4(); + var arg_1 = vec4(); + var arg_2 = vec4(); + var res : vec4 = fma(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + fma_6a3283(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + fma_6a3283(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + fma_6a3283(); +} diff --git a/test/tint/builtins/gen/var/fma/c10ba3.wgsl b/test/tint/builtins/gen/var/fma/c10ba3.wgsl new file mode 100644 index 0000000000..8f7bb65735 --- /dev/null +++ b/test/tint/builtins/gen/var/fma/c10ba3.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn fma(f32, f32, f32) -> f32 +fn fma_c10ba3() { + var arg_0 = 1.0; + var arg_1 = 1.0; + var arg_2 = 1.0; + var res: f32 = fma(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + fma_c10ba3(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + fma_c10ba3(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + fma_c10ba3(); +} diff --git a/test/tint/builtins/gen/var/fma/c10ba3.wgsl.expected.glsl b/test/tint/builtins/gen/var/fma/c10ba3.wgsl.expected.glsl new file mode 100644 index 0000000000..895f1bc45e --- /dev/null +++ b/test/tint/builtins/gen/var/fma/c10ba3.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void fma_c10ba3() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float arg_2 = 1.0f; + float res = ((arg_0) * (arg_1) + (arg_2)); +} + +vec4 vertex_main() { + fma_c10ba3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void fma_c10ba3() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float arg_2 = 1.0f; + float res = ((arg_0) * (arg_1) + (arg_2)); +} + +void fragment_main() { + fma_c10ba3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void fma_c10ba3() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float arg_2 = 1.0f; + float res = ((arg_0) * (arg_1) + (arg_2)); +} + +void compute_main() { + fma_c10ba3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/fma/c10ba3.wgsl.expected.hlsl b/test/tint/builtins/gen/var/fma/c10ba3.wgsl.expected.hlsl new file mode 100644 index 0000000000..0c4b6a2d3f --- /dev/null +++ b/test/tint/builtins/gen/var/fma/c10ba3.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +void fma_c10ba3() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float arg_2 = 1.0f; + float res = mad(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fma_c10ba3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fma_c10ba3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fma_c10ba3(); + return; +} diff --git a/test/tint/builtins/gen/var/fma/c10ba3.wgsl.expected.msl b/test/tint/builtins/gen/var/fma/c10ba3.wgsl.expected.msl new file mode 100644 index 0000000000..a58b323c9a --- /dev/null +++ b/test/tint/builtins/gen/var/fma/c10ba3.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void fma_c10ba3() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float arg_2 = 1.0f; + float res = fma(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + fma_c10ba3(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + fma_c10ba3(); + return; +} + +kernel void compute_main() { + fma_c10ba3(); + return; +} + diff --git a/test/tint/builtins/gen/var/fma/c10ba3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fma/c10ba3.wgsl.expected.spvasm new file mode 100644 index 0000000000..5c99fc8eda --- /dev/null +++ b/test/tint/builtins/gen/var/fma/c10ba3.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %fma_c10ba3 "fma_c10ba3" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %24 = OpTypeFunction %v4float + %fma_c10ba3 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %arg_1 = OpVariable %_ptr_Function_float Function %8 + %arg_2 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + OpStore %arg_1 %float_1 + OpStore %arg_2 %float_1 + %20 = OpLoad %float %arg_0 + %21 = OpLoad %float %arg_1 + %22 = OpLoad %float %arg_2 + %18 = OpExtInst %float %19 Fma %20 %21 %22 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %fma_c10ba3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %fma_c10ba3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %fma_c10ba3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/fma/c10ba3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fma/c10ba3.wgsl.expected.wgsl new file mode 100644 index 0000000000..4b4da4303d --- /dev/null +++ b/test/tint/builtins/gen/var/fma/c10ba3.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn fma_c10ba3() { + var arg_0 = 1.0; + var arg_1 = 1.0; + var arg_2 = 1.0; + var res : f32 = fma(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + fma_c10ba3(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + fma_c10ba3(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + fma_c10ba3(); +} diff --git a/test/tint/builtins/gen/var/fma/e17c5c.wgsl b/test/tint/builtins/gen/var/fma/e17c5c.wgsl new file mode 100644 index 0000000000..d2b71c42f1 --- /dev/null +++ b/test/tint/builtins/gen/var/fma/e17c5c.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn fma(vec<3, f32>, vec<3, f32>, vec<3, f32>) -> vec<3, f32> +fn fma_e17c5c() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var arg_2 = vec3(); + var res: vec3 = fma(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + fma_e17c5c(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + fma_e17c5c(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + fma_e17c5c(); +} diff --git a/test/tint/builtins/gen/var/fma/e17c5c.wgsl.expected.glsl b/test/tint/builtins/gen/var/fma/e17c5c.wgsl.expected.glsl new file mode 100644 index 0000000000..548579c276 --- /dev/null +++ b/test/tint/builtins/gen/var/fma/e17c5c.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void fma_e17c5c() { + vec3 arg_0 = vec3(0.0f); + vec3 arg_1 = vec3(0.0f); + vec3 arg_2 = vec3(0.0f); + vec3 res = ((arg_0) * (arg_1) + (arg_2)); +} + +vec4 vertex_main() { + fma_e17c5c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void fma_e17c5c() { + vec3 arg_0 = vec3(0.0f); + vec3 arg_1 = vec3(0.0f); + vec3 arg_2 = vec3(0.0f); + vec3 res = ((arg_0) * (arg_1) + (arg_2)); +} + +void fragment_main() { + fma_e17c5c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void fma_e17c5c() { + vec3 arg_0 = vec3(0.0f); + vec3 arg_1 = vec3(0.0f); + vec3 arg_2 = vec3(0.0f); + vec3 res = ((arg_0) * (arg_1) + (arg_2)); +} + +void compute_main() { + fma_e17c5c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/fma/e17c5c.wgsl.expected.hlsl b/test/tint/builtins/gen/var/fma/e17c5c.wgsl.expected.hlsl new file mode 100644 index 0000000000..5e4d025bd7 --- /dev/null +++ b/test/tint/builtins/gen/var/fma/e17c5c.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +void fma_e17c5c() { + float3 arg_0 = (0.0f).xxx; + float3 arg_1 = (0.0f).xxx; + float3 arg_2 = (0.0f).xxx; + float3 res = mad(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fma_e17c5c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fma_e17c5c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fma_e17c5c(); + return; +} diff --git a/test/tint/builtins/gen/var/fma/e17c5c.wgsl.expected.msl b/test/tint/builtins/gen/var/fma/e17c5c.wgsl.expected.msl new file mode 100644 index 0000000000..ac34e5c6e5 --- /dev/null +++ b/test/tint/builtins/gen/var/fma/e17c5c.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void fma_e17c5c() { + float3 arg_0 = float3(0.0f); + float3 arg_1 = float3(0.0f); + float3 arg_2 = float3(0.0f); + float3 res = fma(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + fma_e17c5c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + fma_e17c5c(); + return; +} + +kernel void compute_main() { + fma_e17c5c(); + return; +} + diff --git a/test/tint/builtins/gen/var/fma/e17c5c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fma/e17c5c.wgsl.expected.spvasm new file mode 100644 index 0000000000..9b4d8bf7e7 --- /dev/null +++ b/test/tint/builtins/gen/var/fma/e17c5c.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %fma_e17c5c "fma_e17c5c" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %14 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %fma_e17c5c = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %14 + %arg_1 = OpVariable %_ptr_Function_v3float Function %14 + %arg_2 = OpVariable %_ptr_Function_v3float Function %14 + %res = OpVariable %_ptr_Function_v3float Function %14 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + OpStore %arg_2 %14 + %21 = OpLoad %v3float %arg_0 + %22 = OpLoad %v3float %arg_1 + %23 = OpLoad %v3float %arg_2 + %19 = OpExtInst %v3float %20 Fma %21 %22 %23 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %fma_e17c5c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %fma_e17c5c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %fma_e17c5c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/fma/e17c5c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fma/e17c5c.wgsl.expected.wgsl new file mode 100644 index 0000000000..e47a18e901 --- /dev/null +++ b/test/tint/builtins/gen/var/fma/e17c5c.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn fma_e17c5c() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var arg_2 = vec3(); + var res : vec3 = fma(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + fma_e17c5c(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + fma_e17c5c(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + fma_e17c5c(); +} diff --git a/test/tint/builtins/gen/var/fract/8bc1e9.wgsl b/test/tint/builtins/gen/var/fract/8bc1e9.wgsl new file mode 100644 index 0000000000..eb6d1de6c6 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/8bc1e9.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn fract(vec<4, f32>) -> vec<4, f32> +fn fract_8bc1e9() { + var arg_0 = vec4(); + var res: vec4 = fract(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + fract_8bc1e9(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + fract_8bc1e9(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + fract_8bc1e9(); +} diff --git a/test/tint/builtins/gen/var/fract/8bc1e9.wgsl.expected.glsl b/test/tint/builtins/gen/var/fract/8bc1e9.wgsl.expected.glsl new file mode 100644 index 0000000000..10d6f35f56 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/8bc1e9.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void fract_8bc1e9() { + vec4 arg_0 = vec4(0.0f); + vec4 res = fract(arg_0); +} + +vec4 vertex_main() { + fract_8bc1e9(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void fract_8bc1e9() { + vec4 arg_0 = vec4(0.0f); + vec4 res = fract(arg_0); +} + +void fragment_main() { + fract_8bc1e9(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void fract_8bc1e9() { + vec4 arg_0 = vec4(0.0f); + vec4 res = fract(arg_0); +} + +void compute_main() { + fract_8bc1e9(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/fract/8bc1e9.wgsl.expected.hlsl b/test/tint/builtins/gen/var/fract/8bc1e9.wgsl.expected.hlsl new file mode 100644 index 0000000000..cc5fa7c5d5 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/8bc1e9.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void fract_8bc1e9() { + float4 arg_0 = (0.0f).xxxx; + float4 res = frac(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fract_8bc1e9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fract_8bc1e9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fract_8bc1e9(); + return; +} diff --git a/test/tint/builtins/gen/var/fract/8bc1e9.wgsl.expected.msl b/test/tint/builtins/gen/var/fract/8bc1e9.wgsl.expected.msl new file mode 100644 index 0000000000..10b36c8db9 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/8bc1e9.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void fract_8bc1e9() { + float4 arg_0 = float4(0.0f); + float4 res = fract(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + fract_8bc1e9(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + fract_8bc1e9(); + return; +} + +kernel void compute_main() { + fract_8bc1e9(); + return; +} + diff --git a/test/tint/builtins/gen/var/fract/8bc1e9.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fract/8bc1e9.wgsl.expected.spvasm new file mode 100644 index 0000000000..5b20c6f263 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/8bc1e9.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %fract_8bc1e9 "fract_8bc1e9" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%fract_8bc1e9 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %5 + %17 = OpLoad %v4float %arg_0 + %15 = OpExtInst %v4float %16 Fract %17 + OpStore %res %15 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %fract_8bc1e9 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %fract_8bc1e9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %fract_8bc1e9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/fract/8bc1e9.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fract/8bc1e9.wgsl.expected.wgsl new file mode 100644 index 0000000000..9447b8d364 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/8bc1e9.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn fract_8bc1e9() { + var arg_0 = vec4(); + var res : vec4 = fract(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + fract_8bc1e9(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + fract_8bc1e9(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + fract_8bc1e9(); +} diff --git a/test/tint/builtins/gen/var/fract/943cb1.wgsl b/test/tint/builtins/gen/var/fract/943cb1.wgsl new file mode 100644 index 0000000000..f82334ea27 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/943cb1.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn fract(vec<2, f32>) -> vec<2, f32> +fn fract_943cb1() { + var arg_0 = vec2(); + var res: vec2 = fract(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + fract_943cb1(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + fract_943cb1(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + fract_943cb1(); +} diff --git a/test/tint/builtins/gen/var/fract/943cb1.wgsl.expected.glsl b/test/tint/builtins/gen/var/fract/943cb1.wgsl.expected.glsl new file mode 100644 index 0000000000..ba5a3f76ed --- /dev/null +++ b/test/tint/builtins/gen/var/fract/943cb1.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void fract_943cb1() { + vec2 arg_0 = vec2(0.0f); + vec2 res = fract(arg_0); +} + +vec4 vertex_main() { + fract_943cb1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void fract_943cb1() { + vec2 arg_0 = vec2(0.0f); + vec2 res = fract(arg_0); +} + +void fragment_main() { + fract_943cb1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void fract_943cb1() { + vec2 arg_0 = vec2(0.0f); + vec2 res = fract(arg_0); +} + +void compute_main() { + fract_943cb1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/fract/943cb1.wgsl.expected.hlsl b/test/tint/builtins/gen/var/fract/943cb1.wgsl.expected.hlsl new file mode 100644 index 0000000000..38f6505413 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/943cb1.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void fract_943cb1() { + float2 arg_0 = (0.0f).xx; + float2 res = frac(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fract_943cb1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fract_943cb1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fract_943cb1(); + return; +} diff --git a/test/tint/builtins/gen/var/fract/943cb1.wgsl.expected.msl b/test/tint/builtins/gen/var/fract/943cb1.wgsl.expected.msl new file mode 100644 index 0000000000..c80a69bad0 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/943cb1.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void fract_943cb1() { + float2 arg_0 = float2(0.0f); + float2 res = fract(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + fract_943cb1(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + fract_943cb1(); + return; +} + +kernel void compute_main() { + fract_943cb1(); + return; +} + diff --git a/test/tint/builtins/gen/var/fract/943cb1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fract/943cb1.wgsl.expected.spvasm new file mode 100644 index 0000000000..d63463bf11 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/943cb1.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %fract_943cb1 "fract_943cb1" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %14 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%fract_943cb1 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %14 + %res = OpVariable %_ptr_Function_v2float Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %v2float %arg_0 + %17 = OpExtInst %v2float %18 Fract %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %fract_943cb1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %fract_943cb1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %fract_943cb1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/fract/943cb1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fract/943cb1.wgsl.expected.wgsl new file mode 100644 index 0000000000..089b08d9f2 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/943cb1.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn fract_943cb1() { + var arg_0 = vec2(); + var res : vec2 = fract(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + fract_943cb1(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + fract_943cb1(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + fract_943cb1(); +} diff --git a/test/tint/builtins/gen/var/fract/a49758.wgsl b/test/tint/builtins/gen/var/fract/a49758.wgsl new file mode 100644 index 0000000000..51ebe9b6c4 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/a49758.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn fract(vec<3, f32>) -> vec<3, f32> +fn fract_a49758() { + var arg_0 = vec3(); + var res: vec3 = fract(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + fract_a49758(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + fract_a49758(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + fract_a49758(); +} diff --git a/test/tint/builtins/gen/var/fract/a49758.wgsl.expected.glsl b/test/tint/builtins/gen/var/fract/a49758.wgsl.expected.glsl new file mode 100644 index 0000000000..9f2b8f53da --- /dev/null +++ b/test/tint/builtins/gen/var/fract/a49758.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void fract_a49758() { + vec3 arg_0 = vec3(0.0f); + vec3 res = fract(arg_0); +} + +vec4 vertex_main() { + fract_a49758(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void fract_a49758() { + vec3 arg_0 = vec3(0.0f); + vec3 res = fract(arg_0); +} + +void fragment_main() { + fract_a49758(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void fract_a49758() { + vec3 arg_0 = vec3(0.0f); + vec3 res = fract(arg_0); +} + +void compute_main() { + fract_a49758(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/fract/a49758.wgsl.expected.hlsl b/test/tint/builtins/gen/var/fract/a49758.wgsl.expected.hlsl new file mode 100644 index 0000000000..1efd8ae7cb --- /dev/null +++ b/test/tint/builtins/gen/var/fract/a49758.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void fract_a49758() { + float3 arg_0 = (0.0f).xxx; + float3 res = frac(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fract_a49758(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fract_a49758(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fract_a49758(); + return; +} diff --git a/test/tint/builtins/gen/var/fract/a49758.wgsl.expected.msl b/test/tint/builtins/gen/var/fract/a49758.wgsl.expected.msl new file mode 100644 index 0000000000..ee497e71ae --- /dev/null +++ b/test/tint/builtins/gen/var/fract/a49758.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void fract_a49758() { + float3 arg_0 = float3(0.0f); + float3 res = fract(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + fract_a49758(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + fract_a49758(); + return; +} + +kernel void compute_main() { + fract_a49758(); + return; +} + diff --git a/test/tint/builtins/gen/var/fract/a49758.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fract/a49758.wgsl.expected.spvasm new file mode 100644 index 0000000000..7aed99e1af --- /dev/null +++ b/test/tint/builtins/gen/var/fract/a49758.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %fract_a49758 "fract_a49758" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %14 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%fract_a49758 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %14 + %res = OpVariable %_ptr_Function_v3float Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %v3float %arg_0 + %17 = OpExtInst %v3float %18 Fract %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %fract_a49758 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %fract_a49758 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %fract_a49758 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/fract/a49758.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fract/a49758.wgsl.expected.wgsl new file mode 100644 index 0000000000..0aef8a8c8b --- /dev/null +++ b/test/tint/builtins/gen/var/fract/a49758.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn fract_a49758() { + var arg_0 = vec3(); + var res : vec3 = fract(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + fract_a49758(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + fract_a49758(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + fract_a49758(); +} diff --git a/test/tint/builtins/gen/var/fract/fa5c71.wgsl b/test/tint/builtins/gen/var/fract/fa5c71.wgsl new file mode 100644 index 0000000000..22bff95f8f --- /dev/null +++ b/test/tint/builtins/gen/var/fract/fa5c71.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn fract(f32) -> f32 +fn fract_fa5c71() { + var arg_0 = 1.0; + var res: f32 = fract(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + fract_fa5c71(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + fract_fa5c71(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + fract_fa5c71(); +} diff --git a/test/tint/builtins/gen/var/fract/fa5c71.wgsl.expected.glsl b/test/tint/builtins/gen/var/fract/fa5c71.wgsl.expected.glsl new file mode 100644 index 0000000000..1727089675 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/fa5c71.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void fract_fa5c71() { + float arg_0 = 1.0f; + float res = fract(arg_0); +} + +vec4 vertex_main() { + fract_fa5c71(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void fract_fa5c71() { + float arg_0 = 1.0f; + float res = fract(arg_0); +} + +void fragment_main() { + fract_fa5c71(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void fract_fa5c71() { + float arg_0 = 1.0f; + float res = fract(arg_0); +} + +void compute_main() { + fract_fa5c71(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/fract/fa5c71.wgsl.expected.hlsl b/test/tint/builtins/gen/var/fract/fa5c71.wgsl.expected.hlsl new file mode 100644 index 0000000000..c24fc77101 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/fa5c71.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void fract_fa5c71() { + float arg_0 = 1.0f; + float res = frac(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fract_fa5c71(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fract_fa5c71(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fract_fa5c71(); + return; +} diff --git a/test/tint/builtins/gen/var/fract/fa5c71.wgsl.expected.msl b/test/tint/builtins/gen/var/fract/fa5c71.wgsl.expected.msl new file mode 100644 index 0000000000..28643cc127 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/fa5c71.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void fract_fa5c71() { + float arg_0 = 1.0f; + float res = fract(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + fract_fa5c71(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + fract_fa5c71(); + return; +} + +kernel void compute_main() { + fract_fa5c71(); + return; +} + diff --git a/test/tint/builtins/gen/var/fract/fa5c71.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fract/fa5c71.wgsl.expected.spvasm new file mode 100644 index 0000000000..18cc7aad61 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/fa5c71.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %fract_fa5c71 "fract_fa5c71" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %20 = OpTypeFunction %v4float +%fract_fa5c71 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + %18 = OpLoad %float %arg_0 + %16 = OpExtInst %float %17 Fract %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %fract_fa5c71 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %fract_fa5c71 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %fract_fa5c71 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/fract/fa5c71.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fract/fa5c71.wgsl.expected.wgsl new file mode 100644 index 0000000000..b41cb8b1b8 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/fa5c71.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn fract_fa5c71() { + var arg_0 = 1.0; + var res : f32 = fract(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + fract_fa5c71(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + fract_fa5c71(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + fract_fa5c71(); +} diff --git a/test/tint/builtins/gen/var/frexp/368997.wgsl b/test/tint/builtins/gen/var/frexp/368997.wgsl new file mode 100644 index 0000000000..b71eb10eca --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/368997.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn frexp(vec<3, f32>) -> __frexp_result_vec<3> +fn frexp_368997() { + var arg_0 = vec3(); + var res = frexp(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + frexp_368997(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + frexp_368997(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + frexp_368997(); +} diff --git a/test/tint/builtins/gen/var/frexp/368997.wgsl.expected.glsl b/test/tint/builtins/gen/var/frexp/368997.wgsl.expected.glsl new file mode 100644 index 0000000000..122794f3a3 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/368997.wgsl.expected.glsl @@ -0,0 +1,88 @@ +#version 310 es + +struct frexp_result_vec3 { + vec3 sig; + ivec3 exp; +}; + +frexp_result_vec3 tint_frexp(vec3 param_0) { + frexp_result_vec3 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_368997() { + vec3 arg_0 = vec3(0.0f); + frexp_result_vec3 res = tint_frexp(arg_0); +} + +vec4 vertex_main() { + frexp_368997(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +struct frexp_result_vec3 { + vec3 sig; + ivec3 exp; +}; + +frexp_result_vec3 tint_frexp(vec3 param_0) { + frexp_result_vec3 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_368997() { + vec3 arg_0 = vec3(0.0f); + frexp_result_vec3 res = tint_frexp(arg_0); +} + +void fragment_main() { + frexp_368997(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct frexp_result_vec3 { + vec3 sig; + ivec3 exp; +}; + +frexp_result_vec3 tint_frexp(vec3 param_0) { + frexp_result_vec3 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_368997() { + vec3 arg_0 = vec3(0.0f); + frexp_result_vec3 res = tint_frexp(arg_0); +} + +void compute_main() { + frexp_368997(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/frexp/368997.wgsl.expected.hlsl b/test/tint/builtins/gen/var/frexp/368997.wgsl.expected.hlsl new file mode 100644 index 0000000000..59aa53adf7 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/368997.wgsl.expected.hlsl @@ -0,0 +1,42 @@ +struct frexp_result_vec3 { + float3 sig; + int3 exp; +}; +frexp_result_vec3 tint_frexp(float3 param_0) { + float3 exp; + float3 sig = frexp(param_0, exp); + frexp_result_vec3 result = {sig, int3(exp)}; + return result; +} + +void frexp_368997() { + float3 arg_0 = (0.0f).xxx; + frexp_result_vec3 res = tint_frexp(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + frexp_368997(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + frexp_368997(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + frexp_368997(); + return; +} diff --git a/test/tint/builtins/gen/var/frexp/368997.wgsl.expected.msl b/test/tint/builtins/gen/var/frexp/368997.wgsl.expected.msl new file mode 100644 index 0000000000..a94bf9677c --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/368997.wgsl.expected.msl @@ -0,0 +1,45 @@ +#include + +using namespace metal; + +struct frexp_result_vec3 { + float3 sig; + int3 exp; +}; +frexp_result_vec3 tint_frexp(float3 param_0) { + int3 exp; + float3 sig = frexp(param_0, exp); + return {sig, exp}; +} + +void frexp_368997() { + float3 arg_0 = float3(0.0f); + frexp_result_vec3 res = tint_frexp(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + frexp_368997(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + frexp_368997(); + return; +} + +kernel void compute_main() { + frexp_368997(); + return; +} + diff --git a/test/tint/builtins/gen/var/frexp/368997.wgsl.expected.spvasm b/test/tint/builtins/gen/var/frexp/368997.wgsl.expected.spvasm new file mode 100644 index 0000000000..020e6a47ef --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/368997.wgsl.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + %21 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %frexp_368997 "frexp_368997" + OpName %arg_0 "arg_0" + OpName %__frexp_result_vec3 "__frexp_result_vec3" + OpMemberName %__frexp_result_vec3 0 "sig" + OpMemberName %__frexp_result_vec3 1 "exp" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpMemberDecorate %__frexp_result_vec3 0 Offset 0 + OpMemberDecorate %__frexp_result_vec3 1 Offset 16 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %14 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 +%__frexp_result_vec3 = OpTypeStruct %v3float %v3int +%_ptr_Function___frexp_result_vec3 = OpTypePointer Function %__frexp_result_vec3 + %25 = OpConstantNull %__frexp_result_vec3 + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%frexp_368997 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %14 + %res = OpVariable %_ptr_Function___frexp_result_vec3 Function %25 + OpStore %arg_0 %14 + %22 = OpLoad %v3float %arg_0 + %17 = OpExtInst %__frexp_result_vec3 %21 FrexpStruct %22 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %frexp_368997 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %frexp_368997 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %frexp_368997 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/frexp/368997.wgsl.expected.wgsl b/test/tint/builtins/gen/var/frexp/368997.wgsl.expected.wgsl new file mode 100644 index 0000000000..41b485e0ac --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/368997.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn frexp_368997() { + var arg_0 = vec3(); + var res = frexp(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + frexp_368997(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + frexp_368997(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + frexp_368997(); +} diff --git a/test/tint/builtins/gen/var/frexp/3c4f48.wgsl b/test/tint/builtins/gen/var/frexp/3c4f48.wgsl new file mode 100644 index 0000000000..8dc637360c --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/3c4f48.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn frexp(vec<4, f32>) -> __frexp_result_vec<4> +fn frexp_3c4f48() { + var arg_0 = vec4(); + var res = frexp(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + frexp_3c4f48(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + frexp_3c4f48(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + frexp_3c4f48(); +} diff --git a/test/tint/builtins/gen/var/frexp/3c4f48.wgsl.expected.glsl b/test/tint/builtins/gen/var/frexp/3c4f48.wgsl.expected.glsl new file mode 100644 index 0000000000..fbee2193be --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/3c4f48.wgsl.expected.glsl @@ -0,0 +1,88 @@ +#version 310 es + +struct frexp_result_vec4 { + vec4 sig; + ivec4 exp; +}; + +frexp_result_vec4 tint_frexp(vec4 param_0) { + frexp_result_vec4 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_3c4f48() { + vec4 arg_0 = vec4(0.0f); + frexp_result_vec4 res = tint_frexp(arg_0); +} + +vec4 vertex_main() { + frexp_3c4f48(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +struct frexp_result_vec4 { + vec4 sig; + ivec4 exp; +}; + +frexp_result_vec4 tint_frexp(vec4 param_0) { + frexp_result_vec4 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_3c4f48() { + vec4 arg_0 = vec4(0.0f); + frexp_result_vec4 res = tint_frexp(arg_0); +} + +void fragment_main() { + frexp_3c4f48(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct frexp_result_vec4 { + vec4 sig; + ivec4 exp; +}; + +frexp_result_vec4 tint_frexp(vec4 param_0) { + frexp_result_vec4 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_3c4f48() { + vec4 arg_0 = vec4(0.0f); + frexp_result_vec4 res = tint_frexp(arg_0); +} + +void compute_main() { + frexp_3c4f48(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/frexp/3c4f48.wgsl.expected.hlsl b/test/tint/builtins/gen/var/frexp/3c4f48.wgsl.expected.hlsl new file mode 100644 index 0000000000..7997378e87 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/3c4f48.wgsl.expected.hlsl @@ -0,0 +1,42 @@ +struct frexp_result_vec4 { + float4 sig; + int4 exp; +}; +frexp_result_vec4 tint_frexp(float4 param_0) { + float4 exp; + float4 sig = frexp(param_0, exp); + frexp_result_vec4 result = {sig, int4(exp)}; + return result; +} + +void frexp_3c4f48() { + float4 arg_0 = (0.0f).xxxx; + frexp_result_vec4 res = tint_frexp(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + frexp_3c4f48(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + frexp_3c4f48(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + frexp_3c4f48(); + return; +} diff --git a/test/tint/builtins/gen/var/frexp/3c4f48.wgsl.expected.msl b/test/tint/builtins/gen/var/frexp/3c4f48.wgsl.expected.msl new file mode 100644 index 0000000000..a4a3e889d2 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/3c4f48.wgsl.expected.msl @@ -0,0 +1,45 @@ +#include + +using namespace metal; + +struct frexp_result_vec4 { + float4 sig; + int4 exp; +}; +frexp_result_vec4 tint_frexp(float4 param_0) { + int4 exp; + float4 sig = frexp(param_0, exp); + return {sig, exp}; +} + +void frexp_3c4f48() { + float4 arg_0 = float4(0.0f); + frexp_result_vec4 res = tint_frexp(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + frexp_3c4f48(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + frexp_3c4f48(); + return; +} + +kernel void compute_main() { + frexp_3c4f48(); + return; +} + diff --git a/test/tint/builtins/gen/var/frexp/3c4f48.wgsl.expected.spvasm b/test/tint/builtins/gen/var/frexp/3c4f48.wgsl.expected.spvasm new file mode 100644 index 0000000000..093c05c56d --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/3c4f48.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %frexp_3c4f48 "frexp_3c4f48" + OpName %arg_0 "arg_0" + OpName %__frexp_result_vec4 "__frexp_result_vec4" + OpMemberName %__frexp_result_vec4 0 "sig" + OpMemberName %__frexp_result_vec4 1 "exp" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpMemberDecorate %__frexp_result_vec4 0 Offset 0 + OpMemberDecorate %__frexp_result_vec4 1 Offset 16 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 +%__frexp_result_vec4 = OpTypeStruct %v4float %v4int +%_ptr_Function___frexp_result_vec4 = OpTypePointer Function %__frexp_result_vec4 + %23 = OpConstantNull %__frexp_result_vec4 + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%frexp_3c4f48 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function___frexp_result_vec4 Function %23 + OpStore %arg_0 %5 + %20 = OpLoad %v4float %arg_0 + %15 = OpExtInst %__frexp_result_vec4 %19 FrexpStruct %20 + OpStore %res %15 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %frexp_3c4f48 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %frexp_3c4f48 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %frexp_3c4f48 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/frexp/3c4f48.wgsl.expected.wgsl b/test/tint/builtins/gen/var/frexp/3c4f48.wgsl.expected.wgsl new file mode 100644 index 0000000000..3123659370 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/3c4f48.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn frexp_3c4f48() { + var arg_0 = vec4(); + var res = frexp(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + frexp_3c4f48(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + frexp_3c4f48(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + frexp_3c4f48(); +} diff --git a/test/tint/builtins/gen/var/frexp/4bdfc7.wgsl b/test/tint/builtins/gen/var/frexp/4bdfc7.wgsl new file mode 100644 index 0000000000..8ea610754a --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/4bdfc7.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn frexp(vec<2, f32>) -> __frexp_result_vec<2> +fn frexp_4bdfc7() { + var arg_0 = vec2(); + var res = frexp(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + frexp_4bdfc7(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + frexp_4bdfc7(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + frexp_4bdfc7(); +} diff --git a/test/tint/builtins/gen/var/frexp/4bdfc7.wgsl.expected.glsl b/test/tint/builtins/gen/var/frexp/4bdfc7.wgsl.expected.glsl new file mode 100644 index 0000000000..479ea01e80 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/4bdfc7.wgsl.expected.glsl @@ -0,0 +1,88 @@ +#version 310 es + +struct frexp_result_vec2 { + vec2 sig; + ivec2 exp; +}; + +frexp_result_vec2 tint_frexp(vec2 param_0) { + frexp_result_vec2 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_4bdfc7() { + vec2 arg_0 = vec2(0.0f); + frexp_result_vec2 res = tint_frexp(arg_0); +} + +vec4 vertex_main() { + frexp_4bdfc7(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +struct frexp_result_vec2 { + vec2 sig; + ivec2 exp; +}; + +frexp_result_vec2 tint_frexp(vec2 param_0) { + frexp_result_vec2 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_4bdfc7() { + vec2 arg_0 = vec2(0.0f); + frexp_result_vec2 res = tint_frexp(arg_0); +} + +void fragment_main() { + frexp_4bdfc7(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct frexp_result_vec2 { + vec2 sig; + ivec2 exp; +}; + +frexp_result_vec2 tint_frexp(vec2 param_0) { + frexp_result_vec2 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_4bdfc7() { + vec2 arg_0 = vec2(0.0f); + frexp_result_vec2 res = tint_frexp(arg_0); +} + +void compute_main() { + frexp_4bdfc7(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/frexp/4bdfc7.wgsl.expected.hlsl b/test/tint/builtins/gen/var/frexp/4bdfc7.wgsl.expected.hlsl new file mode 100644 index 0000000000..f47aba8e6e --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/4bdfc7.wgsl.expected.hlsl @@ -0,0 +1,42 @@ +struct frexp_result_vec2 { + float2 sig; + int2 exp; +}; +frexp_result_vec2 tint_frexp(float2 param_0) { + float2 exp; + float2 sig = frexp(param_0, exp); + frexp_result_vec2 result = {sig, int2(exp)}; + return result; +} + +void frexp_4bdfc7() { + float2 arg_0 = (0.0f).xx; + frexp_result_vec2 res = tint_frexp(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + frexp_4bdfc7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + frexp_4bdfc7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + frexp_4bdfc7(); + return; +} diff --git a/test/tint/builtins/gen/var/frexp/4bdfc7.wgsl.expected.msl b/test/tint/builtins/gen/var/frexp/4bdfc7.wgsl.expected.msl new file mode 100644 index 0000000000..51dac58510 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/4bdfc7.wgsl.expected.msl @@ -0,0 +1,45 @@ +#include + +using namespace metal; + +struct frexp_result_vec2 { + float2 sig; + int2 exp; +}; +frexp_result_vec2 tint_frexp(float2 param_0) { + int2 exp; + float2 sig = frexp(param_0, exp); + return {sig, exp}; +} + +void frexp_4bdfc7() { + float2 arg_0 = float2(0.0f); + frexp_result_vec2 res = tint_frexp(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + frexp_4bdfc7(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + frexp_4bdfc7(); + return; +} + +kernel void compute_main() { + frexp_4bdfc7(); + return; +} + diff --git a/test/tint/builtins/gen/var/frexp/4bdfc7.wgsl.expected.spvasm b/test/tint/builtins/gen/var/frexp/4bdfc7.wgsl.expected.spvasm new file mode 100644 index 0000000000..0b5e768480 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/4bdfc7.wgsl.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + %21 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %frexp_4bdfc7 "frexp_4bdfc7" + OpName %arg_0 "arg_0" + OpName %__frexp_result_vec2 "__frexp_result_vec2" + OpMemberName %__frexp_result_vec2 0 "sig" + OpMemberName %__frexp_result_vec2 1 "exp" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpMemberDecorate %__frexp_result_vec2 0 Offset 0 + OpMemberDecorate %__frexp_result_vec2 1 Offset 8 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %14 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%__frexp_result_vec2 = OpTypeStruct %v2float %v2int +%_ptr_Function___frexp_result_vec2 = OpTypePointer Function %__frexp_result_vec2 + %25 = OpConstantNull %__frexp_result_vec2 + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%frexp_4bdfc7 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %14 + %res = OpVariable %_ptr_Function___frexp_result_vec2 Function %25 + OpStore %arg_0 %14 + %22 = OpLoad %v2float %arg_0 + %17 = OpExtInst %__frexp_result_vec2 %21 FrexpStruct %22 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %frexp_4bdfc7 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %frexp_4bdfc7 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %frexp_4bdfc7 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/frexp/4bdfc7.wgsl.expected.wgsl b/test/tint/builtins/gen/var/frexp/4bdfc7.wgsl.expected.wgsl new file mode 100644 index 0000000000..757df25bff --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/4bdfc7.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn frexp_4bdfc7() { + var arg_0 = vec2(); + var res = frexp(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + frexp_4bdfc7(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + frexp_4bdfc7(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + frexp_4bdfc7(); +} diff --git a/test/tint/builtins/gen/var/frexp/eabd40.wgsl b/test/tint/builtins/gen/var/frexp/eabd40.wgsl new file mode 100644 index 0000000000..a3b1aa44b6 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/eabd40.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn frexp(f32) -> __frexp_result +fn frexp_eabd40() { + var arg_0 = 1.0; + var res = frexp(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + frexp_eabd40(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + frexp_eabd40(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + frexp_eabd40(); +} diff --git a/test/tint/builtins/gen/var/frexp/eabd40.wgsl.expected.glsl b/test/tint/builtins/gen/var/frexp/eabd40.wgsl.expected.glsl new file mode 100644 index 0000000000..6d1a1b18e3 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/eabd40.wgsl.expected.glsl @@ -0,0 +1,88 @@ +#version 310 es + +struct frexp_result { + float sig; + int exp; +}; + +frexp_result tint_frexp(float param_0) { + frexp_result result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_eabd40() { + float arg_0 = 1.0f; + frexp_result res = tint_frexp(arg_0); +} + +vec4 vertex_main() { + frexp_eabd40(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +struct frexp_result { + float sig; + int exp; +}; + +frexp_result tint_frexp(float param_0) { + frexp_result result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_eabd40() { + float arg_0 = 1.0f; + frexp_result res = tint_frexp(arg_0); +} + +void fragment_main() { + frexp_eabd40(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct frexp_result { + float sig; + int exp; +}; + +frexp_result tint_frexp(float param_0) { + frexp_result result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_eabd40() { + float arg_0 = 1.0f; + frexp_result res = tint_frexp(arg_0); +} + +void compute_main() { + frexp_eabd40(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/frexp/eabd40.wgsl.expected.hlsl b/test/tint/builtins/gen/var/frexp/eabd40.wgsl.expected.hlsl new file mode 100644 index 0000000000..a3e419530b --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/eabd40.wgsl.expected.hlsl @@ -0,0 +1,42 @@ +struct frexp_result { + float sig; + int exp; +}; +frexp_result tint_frexp(float param_0) { + float exp; + float sig = frexp(param_0, exp); + frexp_result result = {sig, int(exp)}; + return result; +} + +void frexp_eabd40() { + float arg_0 = 1.0f; + frexp_result res = tint_frexp(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + frexp_eabd40(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + frexp_eabd40(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + frexp_eabd40(); + return; +} diff --git a/test/tint/builtins/gen/var/frexp/eabd40.wgsl.expected.msl b/test/tint/builtins/gen/var/frexp/eabd40.wgsl.expected.msl new file mode 100644 index 0000000000..3249522c40 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/eabd40.wgsl.expected.msl @@ -0,0 +1,45 @@ +#include + +using namespace metal; + +struct frexp_result { + float sig; + int exp; +}; +frexp_result tint_frexp(float param_0) { + int exp; + float sig = frexp(param_0, exp); + return {sig, exp}; +} + +void frexp_eabd40() { + float arg_0 = 1.0f; + frexp_result res = tint_frexp(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + frexp_eabd40(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + frexp_eabd40(); + return; +} + +kernel void compute_main() { + frexp_eabd40(); + return; +} + diff --git a/test/tint/builtins/gen/var/frexp/eabd40.wgsl.expected.spvasm b/test/tint/builtins/gen/var/frexp/eabd40.wgsl.expected.spvasm new file mode 100644 index 0000000000..4b0fed2381 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/eabd40.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %frexp_eabd40 "frexp_eabd40" + OpName %arg_0 "arg_0" + OpName %__frexp_result "__frexp_result" + OpMemberName %__frexp_result 0 "sig" + OpMemberName %__frexp_result 1 "exp" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpMemberDecorate %__frexp_result 0 Offset 0 + OpMemberDecorate %__frexp_result 1 Offset 4 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %int = OpTypeInt 32 1 +%__frexp_result = OpTypeStruct %float %int +%_ptr_Function___frexp_result = OpTypePointer Function %__frexp_result + %23 = OpConstantNull %__frexp_result + %24 = OpTypeFunction %v4float +%frexp_eabd40 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function___frexp_result Function %23 + OpStore %arg_0 %float_1 + %20 = OpLoad %float %arg_0 + %16 = OpExtInst %__frexp_result %19 FrexpStruct %20 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %frexp_eabd40 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %frexp_eabd40 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %frexp_eabd40 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/frexp/eabd40.wgsl.expected.wgsl b/test/tint/builtins/gen/var/frexp/eabd40.wgsl.expected.wgsl new file mode 100644 index 0000000000..746e9bb130 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/eabd40.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn frexp_eabd40() { + var arg_0 = 1.0; + var res = frexp(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + frexp_eabd40(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + frexp_eabd40(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + frexp_eabd40(); +} diff --git a/test/tint/builtins/gen/var/fwidth/5d1b39.wgsl b/test/tint/builtins/gen/var/fwidth/5d1b39.wgsl new file mode 100644 index 0000000000..8446a7d89b --- /dev/null +++ b/test/tint/builtins/gen/var/fwidth/5d1b39.wgsl @@ -0,0 +1,35 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn fwidth(vec<3, f32>) -> vec<3, f32> +fn fwidth_5d1b39() { + var arg_0 = vec3(); + var res: vec3 = fwidth(arg_0); +} + +@stage(fragment) +fn fragment_main() { + fwidth_5d1b39(); +} diff --git a/test/tint/builtins/gen/var/fwidth/5d1b39.wgsl.expected.glsl b/test/tint/builtins/gen/var/fwidth/5d1b39.wgsl.expected.glsl new file mode 100644 index 0000000000..876dc56841 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidth/5d1b39.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void fwidth_5d1b39() { + vec3 arg_0 = vec3(0.0f); + vec3 res = fwidth(arg_0); +} + +void fragment_main() { + fwidth_5d1b39(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/fwidth/5d1b39.wgsl.expected.hlsl b/test/tint/builtins/gen/var/fwidth/5d1b39.wgsl.expected.hlsl new file mode 100644 index 0000000000..6e992c3091 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidth/5d1b39.wgsl.expected.hlsl @@ -0,0 +1,9 @@ +void fwidth_5d1b39() { + float3 arg_0 = (0.0f).xxx; + float3 res = fwidth(arg_0); +} + +void fragment_main() { + fwidth_5d1b39(); + return; +} diff --git a/test/tint/builtins/gen/var/fwidth/5d1b39.wgsl.expected.msl b/test/tint/builtins/gen/var/fwidth/5d1b39.wgsl.expected.msl new file mode 100644 index 0000000000..1afd1e81eb --- /dev/null +++ b/test/tint/builtins/gen/var/fwidth/5d1b39.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void fwidth_5d1b39() { + float3 arg_0 = float3(0.0f); + float3 res = fwidth(arg_0); +} + +fragment void fragment_main() { + fwidth_5d1b39(); + return; +} + diff --git a/test/tint/builtins/gen/var/fwidth/5d1b39.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fwidth/5d1b39.wgsl.expected.spvasm new file mode 100644 index 0000000000..4bd061cc7b --- /dev/null +++ b/test/tint/builtins/gen/var/fwidth/5d1b39.wgsl.expected.spvasm @@ -0,0 +1,34 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %fwidth_5d1b39 "fwidth_5d1b39" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %7 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float +%fwidth_5d1b39 = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %7 + %res = OpVariable %_ptr_Function_v3float Function %7 + OpStore %arg_0 %7 + %11 = OpLoad %v3float %arg_0 + %10 = OpFwidth %v3float %11 + OpStore %res %10 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %fwidth_5d1b39 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/fwidth/5d1b39.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fwidth/5d1b39.wgsl.expected.wgsl new file mode 100644 index 0000000000..eed9270d99 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidth/5d1b39.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn fwidth_5d1b39() { + var arg_0 = vec3(); + var res : vec3 = fwidth(arg_0); +} + +@stage(fragment) +fn fragment_main() { + fwidth_5d1b39(); +} diff --git a/test/tint/builtins/gen/var/fwidth/b83ebb.wgsl b/test/tint/builtins/gen/var/fwidth/b83ebb.wgsl new file mode 100644 index 0000000000..abd769d068 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidth/b83ebb.wgsl @@ -0,0 +1,35 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn fwidth(vec<2, f32>) -> vec<2, f32> +fn fwidth_b83ebb() { + var arg_0 = vec2(); + var res: vec2 = fwidth(arg_0); +} + +@stage(fragment) +fn fragment_main() { + fwidth_b83ebb(); +} diff --git a/test/tint/builtins/gen/var/fwidth/b83ebb.wgsl.expected.glsl b/test/tint/builtins/gen/var/fwidth/b83ebb.wgsl.expected.glsl new file mode 100644 index 0000000000..fa2ef3e989 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidth/b83ebb.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void fwidth_b83ebb() { + vec2 arg_0 = vec2(0.0f); + vec2 res = fwidth(arg_0); +} + +void fragment_main() { + fwidth_b83ebb(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/fwidth/b83ebb.wgsl.expected.hlsl b/test/tint/builtins/gen/var/fwidth/b83ebb.wgsl.expected.hlsl new file mode 100644 index 0000000000..7452af760c --- /dev/null +++ b/test/tint/builtins/gen/var/fwidth/b83ebb.wgsl.expected.hlsl @@ -0,0 +1,9 @@ +void fwidth_b83ebb() { + float2 arg_0 = (0.0f).xx; + float2 res = fwidth(arg_0); +} + +void fragment_main() { + fwidth_b83ebb(); + return; +} diff --git a/test/tint/builtins/gen/var/fwidth/b83ebb.wgsl.expected.msl b/test/tint/builtins/gen/var/fwidth/b83ebb.wgsl.expected.msl new file mode 100644 index 0000000000..0d58110fb4 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidth/b83ebb.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void fwidth_b83ebb() { + float2 arg_0 = float2(0.0f); + float2 res = fwidth(arg_0); +} + +fragment void fragment_main() { + fwidth_b83ebb(); + return; +} + diff --git a/test/tint/builtins/gen/var/fwidth/b83ebb.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fwidth/b83ebb.wgsl.expected.spvasm new file mode 100644 index 0000000000..29986304ee --- /dev/null +++ b/test/tint/builtins/gen/var/fwidth/b83ebb.wgsl.expected.spvasm @@ -0,0 +1,34 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %fwidth_b83ebb "fwidth_b83ebb" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %7 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float +%fwidth_b83ebb = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %7 + %res = OpVariable %_ptr_Function_v2float Function %7 + OpStore %arg_0 %7 + %11 = OpLoad %v2float %arg_0 + %10 = OpFwidth %v2float %11 + OpStore %res %10 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %fwidth_b83ebb + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/fwidth/b83ebb.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fwidth/b83ebb.wgsl.expected.wgsl new file mode 100644 index 0000000000..091f6274b9 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidth/b83ebb.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn fwidth_b83ebb() { + var arg_0 = vec2(); + var res : vec2 = fwidth(arg_0); +} + +@stage(fragment) +fn fragment_main() { + fwidth_b83ebb(); +} diff --git a/test/tint/builtins/gen/var/fwidth/d2ab9a.wgsl b/test/tint/builtins/gen/var/fwidth/d2ab9a.wgsl new file mode 100644 index 0000000000..0f907632da --- /dev/null +++ b/test/tint/builtins/gen/var/fwidth/d2ab9a.wgsl @@ -0,0 +1,35 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn fwidth(vec<4, f32>) -> vec<4, f32> +fn fwidth_d2ab9a() { + var arg_0 = vec4(); + var res: vec4 = fwidth(arg_0); +} + +@stage(fragment) +fn fragment_main() { + fwidth_d2ab9a(); +} diff --git a/test/tint/builtins/gen/var/fwidth/d2ab9a.wgsl.expected.glsl b/test/tint/builtins/gen/var/fwidth/d2ab9a.wgsl.expected.glsl new file mode 100644 index 0000000000..efc08b0526 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidth/d2ab9a.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void fwidth_d2ab9a() { + vec4 arg_0 = vec4(0.0f); + vec4 res = fwidth(arg_0); +} + +void fragment_main() { + fwidth_d2ab9a(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/fwidth/d2ab9a.wgsl.expected.hlsl b/test/tint/builtins/gen/var/fwidth/d2ab9a.wgsl.expected.hlsl new file mode 100644 index 0000000000..7b21ef9ff1 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidth/d2ab9a.wgsl.expected.hlsl @@ -0,0 +1,9 @@ +void fwidth_d2ab9a() { + float4 arg_0 = (0.0f).xxxx; + float4 res = fwidth(arg_0); +} + +void fragment_main() { + fwidth_d2ab9a(); + return; +} diff --git a/test/tint/builtins/gen/var/fwidth/d2ab9a.wgsl.expected.msl b/test/tint/builtins/gen/var/fwidth/d2ab9a.wgsl.expected.msl new file mode 100644 index 0000000000..9da0673289 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidth/d2ab9a.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void fwidth_d2ab9a() { + float4 arg_0 = float4(0.0f); + float4 res = fwidth(arg_0); +} + +fragment void fragment_main() { + fwidth_d2ab9a(); + return; +} + diff --git a/test/tint/builtins/gen/var/fwidth/d2ab9a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fwidth/d2ab9a.wgsl.expected.spvasm new file mode 100644 index 0000000000..996a65b449 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidth/d2ab9a.wgsl.expected.spvasm @@ -0,0 +1,34 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %fwidth_d2ab9a "fwidth_d2ab9a" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %7 = OpConstantNull %v4float +%_ptr_Function_v4float = OpTypePointer Function %v4float +%fwidth_d2ab9a = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %7 + %res = OpVariable %_ptr_Function_v4float Function %7 + OpStore %arg_0 %7 + %11 = OpLoad %v4float %arg_0 + %10 = OpFwidth %v4float %11 + OpStore %res %10 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %fwidth_d2ab9a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/fwidth/d2ab9a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fwidth/d2ab9a.wgsl.expected.wgsl new file mode 100644 index 0000000000..25547c0cac --- /dev/null +++ b/test/tint/builtins/gen/var/fwidth/d2ab9a.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn fwidth_d2ab9a() { + var arg_0 = vec4(); + var res : vec4 = fwidth(arg_0); +} + +@stage(fragment) +fn fragment_main() { + fwidth_d2ab9a(); +} diff --git a/test/tint/builtins/gen/var/fwidth/df38ef.wgsl b/test/tint/builtins/gen/var/fwidth/df38ef.wgsl new file mode 100644 index 0000000000..f1c3ab8ce5 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidth/df38ef.wgsl @@ -0,0 +1,35 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn fwidth(f32) -> f32 +fn fwidth_df38ef() { + var arg_0 = 1.0; + var res: f32 = fwidth(arg_0); +} + +@stage(fragment) +fn fragment_main() { + fwidth_df38ef(); +} diff --git a/test/tint/builtins/gen/var/fwidth/df38ef.wgsl.expected.glsl b/test/tint/builtins/gen/var/fwidth/df38ef.wgsl.expected.glsl new file mode 100644 index 0000000000..fd90c67695 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidth/df38ef.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void fwidth_df38ef() { + float arg_0 = 1.0f; + float res = fwidth(arg_0); +} + +void fragment_main() { + fwidth_df38ef(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/fwidth/df38ef.wgsl.expected.hlsl b/test/tint/builtins/gen/var/fwidth/df38ef.wgsl.expected.hlsl new file mode 100644 index 0000000000..8c0b254c76 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidth/df38ef.wgsl.expected.hlsl @@ -0,0 +1,9 @@ +void fwidth_df38ef() { + float arg_0 = 1.0f; + float res = fwidth(arg_0); +} + +void fragment_main() { + fwidth_df38ef(); + return; +} diff --git a/test/tint/builtins/gen/var/fwidth/df38ef.wgsl.expected.msl b/test/tint/builtins/gen/var/fwidth/df38ef.wgsl.expected.msl new file mode 100644 index 0000000000..45cdac69c0 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidth/df38ef.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void fwidth_df38ef() { + float arg_0 = 1.0f; + float res = fwidth(arg_0); +} + +fragment void fragment_main() { + fwidth_df38ef(); + return; +} + diff --git a/test/tint/builtins/gen/var/fwidth/df38ef.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fwidth/df38ef.wgsl.expected.spvasm new file mode 100644 index 0000000000..1b89aaa672 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidth/df38ef.wgsl.expected.spvasm @@ -0,0 +1,34 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %fwidth_df38ef "fwidth_df38ef" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %9 = OpConstantNull %float +%fwidth_df38ef = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %9 + %res = OpVariable %_ptr_Function_float Function %9 + OpStore %arg_0 %float_1 + %11 = OpLoad %float %arg_0 + %10 = OpFwidth %float %11 + OpStore %res %10 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %fwidth_df38ef + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/fwidth/df38ef.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fwidth/df38ef.wgsl.expected.wgsl new file mode 100644 index 0000000000..616fc529de --- /dev/null +++ b/test/tint/builtins/gen/var/fwidth/df38ef.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn fwidth_df38ef() { + var arg_0 = 1.0; + var res : f32 = fwidth(arg_0); +} + +@stage(fragment) +fn fragment_main() { + fwidth_df38ef(); +} diff --git a/test/tint/builtins/gen/var/fwidthCoarse/159c8a.wgsl b/test/tint/builtins/gen/var/fwidthCoarse/159c8a.wgsl new file mode 100644 index 0000000000..408d3ebe7c --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthCoarse/159c8a.wgsl @@ -0,0 +1,35 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn fwidthCoarse(f32) -> f32 +fn fwidthCoarse_159c8a() { + var arg_0 = 1.0; + var res: f32 = fwidthCoarse(arg_0); +} + +@stage(fragment) +fn fragment_main() { + fwidthCoarse_159c8a(); +} diff --git a/test/tint/builtins/gen/var/fwidthCoarse/159c8a.wgsl.expected.glsl b/test/tint/builtins/gen/var/fwidthCoarse/159c8a.wgsl.expected.glsl new file mode 100644 index 0000000000..7d57bbf632 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthCoarse/159c8a.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void fwidthCoarse_159c8a() { + float arg_0 = 1.0f; + float res = fwidth(arg_0); +} + +void fragment_main() { + fwidthCoarse_159c8a(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/fwidthCoarse/159c8a.wgsl.expected.hlsl b/test/tint/builtins/gen/var/fwidthCoarse/159c8a.wgsl.expected.hlsl new file mode 100644 index 0000000000..37bbb25ea1 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthCoarse/159c8a.wgsl.expected.hlsl @@ -0,0 +1,9 @@ +void fwidthCoarse_159c8a() { + float arg_0 = 1.0f; + float res = fwidth(arg_0); +} + +void fragment_main() { + fwidthCoarse_159c8a(); + return; +} diff --git a/test/tint/builtins/gen/var/fwidthCoarse/159c8a.wgsl.expected.msl b/test/tint/builtins/gen/var/fwidthCoarse/159c8a.wgsl.expected.msl new file mode 100644 index 0000000000..eb66e084bd --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthCoarse/159c8a.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void fwidthCoarse_159c8a() { + float arg_0 = 1.0f; + float res = fwidth(arg_0); +} + +fragment void fragment_main() { + fwidthCoarse_159c8a(); + return; +} + diff --git a/test/tint/builtins/gen/var/fwidthCoarse/159c8a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fwidthCoarse/159c8a.wgsl.expected.spvasm new file mode 100644 index 0000000000..324f1af78e --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthCoarse/159c8a.wgsl.expected.spvasm @@ -0,0 +1,35 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpCapability DerivativeControl + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %fwidthCoarse_159c8a "fwidthCoarse_159c8a" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %9 = OpConstantNull %float +%fwidthCoarse_159c8a = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %9 + %res = OpVariable %_ptr_Function_float Function %9 + OpStore %arg_0 %float_1 + %11 = OpLoad %float %arg_0 + %10 = OpFwidthCoarse %float %11 + OpStore %res %10 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %fwidthCoarse_159c8a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/fwidthCoarse/159c8a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fwidthCoarse/159c8a.wgsl.expected.wgsl new file mode 100644 index 0000000000..a5bb1db650 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthCoarse/159c8a.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn fwidthCoarse_159c8a() { + var arg_0 = 1.0; + var res : f32 = fwidthCoarse(arg_0); +} + +@stage(fragment) +fn fragment_main() { + fwidthCoarse_159c8a(); +} diff --git a/test/tint/builtins/gen/var/fwidthCoarse/1e59d9.wgsl b/test/tint/builtins/gen/var/fwidthCoarse/1e59d9.wgsl new file mode 100644 index 0000000000..6561279e20 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthCoarse/1e59d9.wgsl @@ -0,0 +1,35 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn fwidthCoarse(vec<3, f32>) -> vec<3, f32> +fn fwidthCoarse_1e59d9() { + var arg_0 = vec3(); + var res: vec3 = fwidthCoarse(arg_0); +} + +@stage(fragment) +fn fragment_main() { + fwidthCoarse_1e59d9(); +} diff --git a/test/tint/builtins/gen/var/fwidthCoarse/1e59d9.wgsl.expected.glsl b/test/tint/builtins/gen/var/fwidthCoarse/1e59d9.wgsl.expected.glsl new file mode 100644 index 0000000000..d856f71faa --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthCoarse/1e59d9.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void fwidthCoarse_1e59d9() { + vec3 arg_0 = vec3(0.0f); + vec3 res = fwidth(arg_0); +} + +void fragment_main() { + fwidthCoarse_1e59d9(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/fwidthCoarse/1e59d9.wgsl.expected.hlsl b/test/tint/builtins/gen/var/fwidthCoarse/1e59d9.wgsl.expected.hlsl new file mode 100644 index 0000000000..881032666e --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthCoarse/1e59d9.wgsl.expected.hlsl @@ -0,0 +1,9 @@ +void fwidthCoarse_1e59d9() { + float3 arg_0 = (0.0f).xxx; + float3 res = fwidth(arg_0); +} + +void fragment_main() { + fwidthCoarse_1e59d9(); + return; +} diff --git a/test/tint/builtins/gen/var/fwidthCoarse/1e59d9.wgsl.expected.msl b/test/tint/builtins/gen/var/fwidthCoarse/1e59d9.wgsl.expected.msl new file mode 100644 index 0000000000..86aeda0dd1 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthCoarse/1e59d9.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void fwidthCoarse_1e59d9() { + float3 arg_0 = float3(0.0f); + float3 res = fwidth(arg_0); +} + +fragment void fragment_main() { + fwidthCoarse_1e59d9(); + return; +} + diff --git a/test/tint/builtins/gen/var/fwidthCoarse/1e59d9.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fwidthCoarse/1e59d9.wgsl.expected.spvasm new file mode 100644 index 0000000000..ddcd3968ef --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthCoarse/1e59d9.wgsl.expected.spvasm @@ -0,0 +1,35 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpCapability DerivativeControl + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %fwidthCoarse_1e59d9 "fwidthCoarse_1e59d9" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %7 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float +%fwidthCoarse_1e59d9 = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %7 + %res = OpVariable %_ptr_Function_v3float Function %7 + OpStore %arg_0 %7 + %11 = OpLoad %v3float %arg_0 + %10 = OpFwidthCoarse %v3float %11 + OpStore %res %10 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %fwidthCoarse_1e59d9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/fwidthCoarse/1e59d9.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fwidthCoarse/1e59d9.wgsl.expected.wgsl new file mode 100644 index 0000000000..2bc3f68c05 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthCoarse/1e59d9.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn fwidthCoarse_1e59d9() { + var arg_0 = vec3(); + var res : vec3 = fwidthCoarse(arg_0); +} + +@stage(fragment) +fn fragment_main() { + fwidthCoarse_1e59d9(); +} diff --git a/test/tint/builtins/gen/var/fwidthCoarse/4e4fc4.wgsl b/test/tint/builtins/gen/var/fwidthCoarse/4e4fc4.wgsl new file mode 100644 index 0000000000..ce9b1a5ca8 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthCoarse/4e4fc4.wgsl @@ -0,0 +1,35 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn fwidthCoarse(vec<4, f32>) -> vec<4, f32> +fn fwidthCoarse_4e4fc4() { + var arg_0 = vec4(); + var res: vec4 = fwidthCoarse(arg_0); +} + +@stage(fragment) +fn fragment_main() { + fwidthCoarse_4e4fc4(); +} diff --git a/test/tint/builtins/gen/var/fwidthCoarse/4e4fc4.wgsl.expected.glsl b/test/tint/builtins/gen/var/fwidthCoarse/4e4fc4.wgsl.expected.glsl new file mode 100644 index 0000000000..ad154c6fca --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthCoarse/4e4fc4.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void fwidthCoarse_4e4fc4() { + vec4 arg_0 = vec4(0.0f); + vec4 res = fwidth(arg_0); +} + +void fragment_main() { + fwidthCoarse_4e4fc4(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/fwidthCoarse/4e4fc4.wgsl.expected.hlsl b/test/tint/builtins/gen/var/fwidthCoarse/4e4fc4.wgsl.expected.hlsl new file mode 100644 index 0000000000..f010dac4b9 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthCoarse/4e4fc4.wgsl.expected.hlsl @@ -0,0 +1,9 @@ +void fwidthCoarse_4e4fc4() { + float4 arg_0 = (0.0f).xxxx; + float4 res = fwidth(arg_0); +} + +void fragment_main() { + fwidthCoarse_4e4fc4(); + return; +} diff --git a/test/tint/builtins/gen/var/fwidthCoarse/4e4fc4.wgsl.expected.msl b/test/tint/builtins/gen/var/fwidthCoarse/4e4fc4.wgsl.expected.msl new file mode 100644 index 0000000000..9d388bc5b9 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthCoarse/4e4fc4.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void fwidthCoarse_4e4fc4() { + float4 arg_0 = float4(0.0f); + float4 res = fwidth(arg_0); +} + +fragment void fragment_main() { + fwidthCoarse_4e4fc4(); + return; +} + diff --git a/test/tint/builtins/gen/var/fwidthCoarse/4e4fc4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fwidthCoarse/4e4fc4.wgsl.expected.spvasm new file mode 100644 index 0000000000..e4b1f93725 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthCoarse/4e4fc4.wgsl.expected.spvasm @@ -0,0 +1,35 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpCapability DerivativeControl + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %fwidthCoarse_4e4fc4 "fwidthCoarse_4e4fc4" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %7 = OpConstantNull %v4float +%_ptr_Function_v4float = OpTypePointer Function %v4float +%fwidthCoarse_4e4fc4 = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %7 + %res = OpVariable %_ptr_Function_v4float Function %7 + OpStore %arg_0 %7 + %11 = OpLoad %v4float %arg_0 + %10 = OpFwidthCoarse %v4float %11 + OpStore %res %10 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %fwidthCoarse_4e4fc4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/fwidthCoarse/4e4fc4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fwidthCoarse/4e4fc4.wgsl.expected.wgsl new file mode 100644 index 0000000000..2ea994e6c4 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthCoarse/4e4fc4.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn fwidthCoarse_4e4fc4() { + var arg_0 = vec4(); + var res : vec4 = fwidthCoarse(arg_0); +} + +@stage(fragment) +fn fragment_main() { + fwidthCoarse_4e4fc4(); +} diff --git a/test/tint/builtins/gen/var/fwidthCoarse/e653f7.wgsl b/test/tint/builtins/gen/var/fwidthCoarse/e653f7.wgsl new file mode 100644 index 0000000000..2b51955fa2 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthCoarse/e653f7.wgsl @@ -0,0 +1,35 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn fwidthCoarse(vec<2, f32>) -> vec<2, f32> +fn fwidthCoarse_e653f7() { + var arg_0 = vec2(); + var res: vec2 = fwidthCoarse(arg_0); +} + +@stage(fragment) +fn fragment_main() { + fwidthCoarse_e653f7(); +} diff --git a/test/tint/builtins/gen/var/fwidthCoarse/e653f7.wgsl.expected.glsl b/test/tint/builtins/gen/var/fwidthCoarse/e653f7.wgsl.expected.glsl new file mode 100644 index 0000000000..585997c0da --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthCoarse/e653f7.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void fwidthCoarse_e653f7() { + vec2 arg_0 = vec2(0.0f); + vec2 res = fwidth(arg_0); +} + +void fragment_main() { + fwidthCoarse_e653f7(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/fwidthCoarse/e653f7.wgsl.expected.hlsl b/test/tint/builtins/gen/var/fwidthCoarse/e653f7.wgsl.expected.hlsl new file mode 100644 index 0000000000..e4fdde674e --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthCoarse/e653f7.wgsl.expected.hlsl @@ -0,0 +1,9 @@ +void fwidthCoarse_e653f7() { + float2 arg_0 = (0.0f).xx; + float2 res = fwidth(arg_0); +} + +void fragment_main() { + fwidthCoarse_e653f7(); + return; +} diff --git a/test/tint/builtins/gen/var/fwidthCoarse/e653f7.wgsl.expected.msl b/test/tint/builtins/gen/var/fwidthCoarse/e653f7.wgsl.expected.msl new file mode 100644 index 0000000000..522cf8ceb8 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthCoarse/e653f7.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void fwidthCoarse_e653f7() { + float2 arg_0 = float2(0.0f); + float2 res = fwidth(arg_0); +} + +fragment void fragment_main() { + fwidthCoarse_e653f7(); + return; +} + diff --git a/test/tint/builtins/gen/var/fwidthCoarse/e653f7.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fwidthCoarse/e653f7.wgsl.expected.spvasm new file mode 100644 index 0000000000..3ff087efc0 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthCoarse/e653f7.wgsl.expected.spvasm @@ -0,0 +1,35 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpCapability DerivativeControl + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %fwidthCoarse_e653f7 "fwidthCoarse_e653f7" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %7 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float +%fwidthCoarse_e653f7 = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %7 + %res = OpVariable %_ptr_Function_v2float Function %7 + OpStore %arg_0 %7 + %11 = OpLoad %v2float %arg_0 + %10 = OpFwidthCoarse %v2float %11 + OpStore %res %10 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %fwidthCoarse_e653f7 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/fwidthCoarse/e653f7.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fwidthCoarse/e653f7.wgsl.expected.wgsl new file mode 100644 index 0000000000..a62838349f --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthCoarse/e653f7.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn fwidthCoarse_e653f7() { + var arg_0 = vec2(); + var res : vec2 = fwidthCoarse(arg_0); +} + +@stage(fragment) +fn fragment_main() { + fwidthCoarse_e653f7(); +} diff --git a/test/tint/builtins/gen/var/fwidthFine/523fdc.wgsl b/test/tint/builtins/gen/var/fwidthFine/523fdc.wgsl new file mode 100644 index 0000000000..156d47fe64 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthFine/523fdc.wgsl @@ -0,0 +1,35 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn fwidthFine(vec<3, f32>) -> vec<3, f32> +fn fwidthFine_523fdc() { + var arg_0 = vec3(); + var res: vec3 = fwidthFine(arg_0); +} + +@stage(fragment) +fn fragment_main() { + fwidthFine_523fdc(); +} diff --git a/test/tint/builtins/gen/var/fwidthFine/523fdc.wgsl.expected.glsl b/test/tint/builtins/gen/var/fwidthFine/523fdc.wgsl.expected.glsl new file mode 100644 index 0000000000..5dc113935b --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthFine/523fdc.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void fwidthFine_523fdc() { + vec3 arg_0 = vec3(0.0f); + vec3 res = fwidth(arg_0); +} + +void fragment_main() { + fwidthFine_523fdc(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/fwidthFine/523fdc.wgsl.expected.hlsl b/test/tint/builtins/gen/var/fwidthFine/523fdc.wgsl.expected.hlsl new file mode 100644 index 0000000000..48a6f0a607 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthFine/523fdc.wgsl.expected.hlsl @@ -0,0 +1,9 @@ +void fwidthFine_523fdc() { + float3 arg_0 = (0.0f).xxx; + float3 res = fwidth(arg_0); +} + +void fragment_main() { + fwidthFine_523fdc(); + return; +} diff --git a/test/tint/builtins/gen/var/fwidthFine/523fdc.wgsl.expected.msl b/test/tint/builtins/gen/var/fwidthFine/523fdc.wgsl.expected.msl new file mode 100644 index 0000000000..fd137a834b --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthFine/523fdc.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void fwidthFine_523fdc() { + float3 arg_0 = float3(0.0f); + float3 res = fwidth(arg_0); +} + +fragment void fragment_main() { + fwidthFine_523fdc(); + return; +} + diff --git a/test/tint/builtins/gen/var/fwidthFine/523fdc.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fwidthFine/523fdc.wgsl.expected.spvasm new file mode 100644 index 0000000000..2ba3204778 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthFine/523fdc.wgsl.expected.spvasm @@ -0,0 +1,35 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpCapability DerivativeControl + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %fwidthFine_523fdc "fwidthFine_523fdc" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %7 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float +%fwidthFine_523fdc = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %7 + %res = OpVariable %_ptr_Function_v3float Function %7 + OpStore %arg_0 %7 + %11 = OpLoad %v3float %arg_0 + %10 = OpFwidthFine %v3float %11 + OpStore %res %10 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %fwidthFine_523fdc + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/fwidthFine/523fdc.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fwidthFine/523fdc.wgsl.expected.wgsl new file mode 100644 index 0000000000..31f63e1ce8 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthFine/523fdc.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn fwidthFine_523fdc() { + var arg_0 = vec3(); + var res : vec3 = fwidthFine(arg_0); +} + +@stage(fragment) +fn fragment_main() { + fwidthFine_523fdc(); +} diff --git a/test/tint/builtins/gen/var/fwidthFine/68f4ef.wgsl b/test/tint/builtins/gen/var/fwidthFine/68f4ef.wgsl new file mode 100644 index 0000000000..e9044b2ca6 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthFine/68f4ef.wgsl @@ -0,0 +1,35 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn fwidthFine(vec<4, f32>) -> vec<4, f32> +fn fwidthFine_68f4ef() { + var arg_0 = vec4(); + var res: vec4 = fwidthFine(arg_0); +} + +@stage(fragment) +fn fragment_main() { + fwidthFine_68f4ef(); +} diff --git a/test/tint/builtins/gen/var/fwidthFine/68f4ef.wgsl.expected.glsl b/test/tint/builtins/gen/var/fwidthFine/68f4ef.wgsl.expected.glsl new file mode 100644 index 0000000000..232c00e25c --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthFine/68f4ef.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void fwidthFine_68f4ef() { + vec4 arg_0 = vec4(0.0f); + vec4 res = fwidth(arg_0); +} + +void fragment_main() { + fwidthFine_68f4ef(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/fwidthFine/68f4ef.wgsl.expected.hlsl b/test/tint/builtins/gen/var/fwidthFine/68f4ef.wgsl.expected.hlsl new file mode 100644 index 0000000000..99d0ae4509 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthFine/68f4ef.wgsl.expected.hlsl @@ -0,0 +1,9 @@ +void fwidthFine_68f4ef() { + float4 arg_0 = (0.0f).xxxx; + float4 res = fwidth(arg_0); +} + +void fragment_main() { + fwidthFine_68f4ef(); + return; +} diff --git a/test/tint/builtins/gen/var/fwidthFine/68f4ef.wgsl.expected.msl b/test/tint/builtins/gen/var/fwidthFine/68f4ef.wgsl.expected.msl new file mode 100644 index 0000000000..aa4051397c --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthFine/68f4ef.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void fwidthFine_68f4ef() { + float4 arg_0 = float4(0.0f); + float4 res = fwidth(arg_0); +} + +fragment void fragment_main() { + fwidthFine_68f4ef(); + return; +} + diff --git a/test/tint/builtins/gen/var/fwidthFine/68f4ef.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fwidthFine/68f4ef.wgsl.expected.spvasm new file mode 100644 index 0000000000..d3a07dd4b6 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthFine/68f4ef.wgsl.expected.spvasm @@ -0,0 +1,35 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpCapability DerivativeControl + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %fwidthFine_68f4ef "fwidthFine_68f4ef" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %7 = OpConstantNull %v4float +%_ptr_Function_v4float = OpTypePointer Function %v4float +%fwidthFine_68f4ef = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %7 + %res = OpVariable %_ptr_Function_v4float Function %7 + OpStore %arg_0 %7 + %11 = OpLoad %v4float %arg_0 + %10 = OpFwidthFine %v4float %11 + OpStore %res %10 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %fwidthFine_68f4ef + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/fwidthFine/68f4ef.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fwidthFine/68f4ef.wgsl.expected.wgsl new file mode 100644 index 0000000000..226acfbc6b --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthFine/68f4ef.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn fwidthFine_68f4ef() { + var arg_0 = vec4(); + var res : vec4 = fwidthFine(arg_0); +} + +@stage(fragment) +fn fragment_main() { + fwidthFine_68f4ef(); +} diff --git a/test/tint/builtins/gen/var/fwidthFine/f1742d.wgsl b/test/tint/builtins/gen/var/fwidthFine/f1742d.wgsl new file mode 100644 index 0000000000..c614dbe1d6 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthFine/f1742d.wgsl @@ -0,0 +1,35 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn fwidthFine(f32) -> f32 +fn fwidthFine_f1742d() { + var arg_0 = 1.0; + var res: f32 = fwidthFine(arg_0); +} + +@stage(fragment) +fn fragment_main() { + fwidthFine_f1742d(); +} diff --git a/test/tint/builtins/gen/var/fwidthFine/f1742d.wgsl.expected.glsl b/test/tint/builtins/gen/var/fwidthFine/f1742d.wgsl.expected.glsl new file mode 100644 index 0000000000..8baea1cfbb --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthFine/f1742d.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void fwidthFine_f1742d() { + float arg_0 = 1.0f; + float res = fwidth(arg_0); +} + +void fragment_main() { + fwidthFine_f1742d(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/fwidthFine/f1742d.wgsl.expected.hlsl b/test/tint/builtins/gen/var/fwidthFine/f1742d.wgsl.expected.hlsl new file mode 100644 index 0000000000..8e2b50b96f --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthFine/f1742d.wgsl.expected.hlsl @@ -0,0 +1,9 @@ +void fwidthFine_f1742d() { + float arg_0 = 1.0f; + float res = fwidth(arg_0); +} + +void fragment_main() { + fwidthFine_f1742d(); + return; +} diff --git a/test/tint/builtins/gen/var/fwidthFine/f1742d.wgsl.expected.msl b/test/tint/builtins/gen/var/fwidthFine/f1742d.wgsl.expected.msl new file mode 100644 index 0000000000..badc5cbe31 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthFine/f1742d.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void fwidthFine_f1742d() { + float arg_0 = 1.0f; + float res = fwidth(arg_0); +} + +fragment void fragment_main() { + fwidthFine_f1742d(); + return; +} + diff --git a/test/tint/builtins/gen/var/fwidthFine/f1742d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fwidthFine/f1742d.wgsl.expected.spvasm new file mode 100644 index 0000000000..a2d3e96f6c --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthFine/f1742d.wgsl.expected.spvasm @@ -0,0 +1,35 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpCapability DerivativeControl + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %fwidthFine_f1742d "fwidthFine_f1742d" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %9 = OpConstantNull %float +%fwidthFine_f1742d = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %9 + %res = OpVariable %_ptr_Function_float Function %9 + OpStore %arg_0 %float_1 + %11 = OpLoad %float %arg_0 + %10 = OpFwidthFine %float %11 + OpStore %res %10 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %fwidthFine_f1742d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/fwidthFine/f1742d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fwidthFine/f1742d.wgsl.expected.wgsl new file mode 100644 index 0000000000..0f475d465a --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthFine/f1742d.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn fwidthFine_f1742d() { + var arg_0 = 1.0; + var res : f32 = fwidthFine(arg_0); +} + +@stage(fragment) +fn fragment_main() { + fwidthFine_f1742d(); +} diff --git a/test/tint/builtins/gen/var/fwidthFine/ff6aa0.wgsl b/test/tint/builtins/gen/var/fwidthFine/ff6aa0.wgsl new file mode 100644 index 0000000000..e5166eda3a --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthFine/ff6aa0.wgsl @@ -0,0 +1,35 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn fwidthFine(vec<2, f32>) -> vec<2, f32> +fn fwidthFine_ff6aa0() { + var arg_0 = vec2(); + var res: vec2 = fwidthFine(arg_0); +} + +@stage(fragment) +fn fragment_main() { + fwidthFine_ff6aa0(); +} diff --git a/test/tint/builtins/gen/var/fwidthFine/ff6aa0.wgsl.expected.glsl b/test/tint/builtins/gen/var/fwidthFine/ff6aa0.wgsl.expected.glsl new file mode 100644 index 0000000000..d28ae67e3c --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthFine/ff6aa0.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void fwidthFine_ff6aa0() { + vec2 arg_0 = vec2(0.0f); + vec2 res = fwidth(arg_0); +} + +void fragment_main() { + fwidthFine_ff6aa0(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/fwidthFine/ff6aa0.wgsl.expected.hlsl b/test/tint/builtins/gen/var/fwidthFine/ff6aa0.wgsl.expected.hlsl new file mode 100644 index 0000000000..3ac7b17e10 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthFine/ff6aa0.wgsl.expected.hlsl @@ -0,0 +1,9 @@ +void fwidthFine_ff6aa0() { + float2 arg_0 = (0.0f).xx; + float2 res = fwidth(arg_0); +} + +void fragment_main() { + fwidthFine_ff6aa0(); + return; +} diff --git a/test/tint/builtins/gen/var/fwidthFine/ff6aa0.wgsl.expected.msl b/test/tint/builtins/gen/var/fwidthFine/ff6aa0.wgsl.expected.msl new file mode 100644 index 0000000000..857729e9f3 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthFine/ff6aa0.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void fwidthFine_ff6aa0() { + float2 arg_0 = float2(0.0f); + float2 res = fwidth(arg_0); +} + +fragment void fragment_main() { + fwidthFine_ff6aa0(); + return; +} + diff --git a/test/tint/builtins/gen/var/fwidthFine/ff6aa0.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fwidthFine/ff6aa0.wgsl.expected.spvasm new file mode 100644 index 0000000000..3bad08fb6f --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthFine/ff6aa0.wgsl.expected.spvasm @@ -0,0 +1,35 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpCapability DerivativeControl + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %fwidthFine_ff6aa0 "fwidthFine_ff6aa0" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %7 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float +%fwidthFine_ff6aa0 = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %7 + %res = OpVariable %_ptr_Function_v2float Function %7 + OpStore %arg_0 %7 + %11 = OpLoad %v2float %arg_0 + %10 = OpFwidthFine %v2float %11 + OpStore %res %10 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %fwidthFine_ff6aa0 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/fwidthFine/ff6aa0.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fwidthFine/ff6aa0.wgsl.expected.wgsl new file mode 100644 index 0000000000..db8da89d11 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthFine/ff6aa0.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn fwidthFine_ff6aa0() { + var arg_0 = vec2(); + var res : vec2 = fwidthFine(arg_0); +} + +@stage(fragment) +fn fragment_main() { + fwidthFine_ff6aa0(); +} diff --git a/test/tint/builtins/gen/var/insertBits/3c7ba5.wgsl b/test/tint/builtins/gen/var/insertBits/3c7ba5.wgsl new file mode 100644 index 0000000000..d6ce9d93ef --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/3c7ba5.wgsl @@ -0,0 +1,49 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn insertBits(vec<2, u32>, vec<2, u32>, u32, u32) -> vec<2, u32> +fn insertBits_3c7ba5() { + var arg_0 = vec2(); + var arg_1 = vec2(); + var arg_2 = 1u; + var arg_3 = 1u; + var res: vec2 = insertBits(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + insertBits_3c7ba5(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + insertBits_3c7ba5(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + insertBits_3c7ba5(); +} diff --git a/test/tint/builtins/gen/var/insertBits/3c7ba5.wgsl.expected.glsl b/test/tint/builtins/gen/var/insertBits/3c7ba5.wgsl.expected.glsl new file mode 100644 index 0000000000..5b8eaca520 --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/3c7ba5.wgsl.expected.glsl @@ -0,0 +1,79 @@ +#version 310 es + +uvec2 tint_insert_bits(uvec2 v, uvec2 n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_3c7ba5() { + uvec2 arg_0 = uvec2(0u); + uvec2 arg_1 = uvec2(0u); + uint arg_2 = 1u; + uint arg_3 = 1u; + uvec2 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +vec4 vertex_main() { + insertBits_3c7ba5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uvec2 tint_insert_bits(uvec2 v, uvec2 n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_3c7ba5() { + uvec2 arg_0 = uvec2(0u); + uvec2 arg_1 = uvec2(0u); + uint arg_2 = 1u; + uint arg_3 = 1u; + uvec2 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +void fragment_main() { + insertBits_3c7ba5(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uvec2 tint_insert_bits(uvec2 v, uvec2 n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_3c7ba5() { + uvec2 arg_0 = uvec2(0u); + uvec2 arg_1 = uvec2(0u); + uint arg_2 = 1u; + uint arg_3 = 1u; + uvec2 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +void compute_main() { + insertBits_3c7ba5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/insertBits/3c7ba5.wgsl.expected.hlsl b/test/tint/builtins/gen/var/insertBits/3c7ba5.wgsl.expected.hlsl new file mode 100644 index 0000000000..027a68f46e --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/3c7ba5.wgsl.expected.hlsl @@ -0,0 +1,41 @@ +uint2 tint_insert_bits(uint2 v, uint2 n, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u)); + return (((n << uint2((s).xx)) & uint2((mask).xx)) | (v & uint2((~(mask)).xx))); +} + +void insertBits_3c7ba5() { + uint2 arg_0 = (0u).xx; + uint2 arg_1 = (0u).xx; + uint arg_2 = 1u; + uint arg_3 = 1u; + uint2 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + insertBits_3c7ba5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + insertBits_3c7ba5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + insertBits_3c7ba5(); + return; +} diff --git a/test/tint/builtins/gen/var/insertBits/3c7ba5.wgsl.expected.msl b/test/tint/builtins/gen/var/insertBits/3c7ba5.wgsl.expected.msl new file mode 100644 index 0000000000..fb8a854380 --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/3c7ba5.wgsl.expected.msl @@ -0,0 +1,43 @@ +#include + +using namespace metal; +uint2 tint_insert_bits(uint2 v, uint2 n, uint offset, uint count) { + uint const s = min(offset, 32u); + uint const e = min(32u, (s + count)); + return insert_bits(v, n, s, (e - s)); +} + +void insertBits_3c7ba5() { + uint2 arg_0 = uint2(0u); + uint2 arg_1 = uint2(0u); + uint arg_2 = 1u; + uint arg_3 = 1u; + uint2 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + insertBits_3c7ba5(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + insertBits_3c7ba5(); + return; +} + +kernel void compute_main() { + insertBits_3c7ba5(); + return; +} + diff --git a/test/tint/builtins/gen/var/insertBits/3c7ba5.wgsl.expected.spvasm b/test/tint/builtins/gen/var/insertBits/3c7ba5.wgsl.expected.spvasm new file mode 100644 index 0000000000..801c089fdb --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/3c7ba5.wgsl.expected.spvasm @@ -0,0 +1,107 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 58 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_insert_bits "tint_insert_bits" + OpName %v "v" + OpName %n "n" + OpName %offset "offset" + OpName %count "count" + OpName %insertBits_3c7ba5 "insertBits_3c7ba5" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %9 = OpTypeFunction %v2uint %v2uint %v2uint %uint %uint + %uint_32 = OpConstant %uint 32 + %void = OpTypeVoid + %25 = OpTypeFunction %void + %29 = OpConstantNull %v2uint +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %36 = OpConstantNull %uint + %44 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_insert_bits = OpFunction %v2uint None %9 + %v = OpFunctionParameter %v2uint + %n = OpFunctionParameter %v2uint + %offset = OpFunctionParameter %uint + %count = OpFunctionParameter %uint + %17 = OpLabel + %18 = OpExtInst %uint %19 UMin %offset %uint_32 + %22 = OpIAdd %uint %18 %count + %21 = OpExtInst %uint %19 UMin %uint_32 %22 + %24 = OpISub %uint %21 %18 + %23 = OpBitFieldInsert %v2uint %v %n %18 %24 + OpReturnValue %23 + OpFunctionEnd +%insertBits_3c7ba5 = OpFunction %void None %25 + %28 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2uint Function %29 + %arg_1 = OpVariable %_ptr_Function_v2uint Function %29 + %arg_2 = OpVariable %_ptr_Function_uint Function %36 + %arg_3 = OpVariable %_ptr_Function_uint Function %36 + %res = OpVariable %_ptr_Function_v2uint Function %29 + OpStore %arg_0 %29 + OpStore %arg_1 %29 + OpStore %arg_2 %uint_1 + OpStore %arg_3 %uint_1 + %39 = OpLoad %v2uint %arg_0 + %40 = OpLoad %v2uint %arg_1 + %41 = OpLoad %uint %arg_2 + %42 = OpLoad %uint %arg_3 + %38 = OpFunctionCall %v2uint %tint_insert_bits %39 %40 %41 %42 + OpStore %res %38 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %44 + %46 = OpLabel + %47 = OpFunctionCall %void %insertBits_3c7ba5 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %25 + %49 = OpLabel + %50 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %50 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %25 + %53 = OpLabel + %54 = OpFunctionCall %void %insertBits_3c7ba5 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %25 + %56 = OpLabel + %57 = OpFunctionCall %void %insertBits_3c7ba5 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/insertBits/3c7ba5.wgsl.expected.wgsl b/test/tint/builtins/gen/var/insertBits/3c7ba5.wgsl.expected.wgsl new file mode 100644 index 0000000000..d8fb021c73 --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/3c7ba5.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +fn insertBits_3c7ba5() { + var arg_0 = vec2(); + var arg_1 = vec2(); + var arg_2 = 1u; + var arg_3 = 1u; + var res : vec2 = insertBits(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + insertBits_3c7ba5(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + insertBits_3c7ba5(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + insertBits_3c7ba5(); +} diff --git a/test/tint/builtins/gen/var/insertBits/428b0b.wgsl b/test/tint/builtins/gen/var/insertBits/428b0b.wgsl new file mode 100644 index 0000000000..4e97da10ba --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/428b0b.wgsl @@ -0,0 +1,49 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn insertBits(vec<3, i32>, vec<3, i32>, u32, u32) -> vec<3, i32> +fn insertBits_428b0b() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var arg_2 = 1u; + var arg_3 = 1u; + var res: vec3 = insertBits(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + insertBits_428b0b(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + insertBits_428b0b(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + insertBits_428b0b(); +} diff --git a/test/tint/builtins/gen/var/insertBits/428b0b.wgsl.expected.glsl b/test/tint/builtins/gen/var/insertBits/428b0b.wgsl.expected.glsl new file mode 100644 index 0000000000..1bda33f349 --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/428b0b.wgsl.expected.glsl @@ -0,0 +1,79 @@ +#version 310 es + +ivec3 tint_insert_bits(ivec3 v, ivec3 n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_428b0b() { + ivec3 arg_0 = ivec3(0); + ivec3 arg_1 = ivec3(0); + uint arg_2 = 1u; + uint arg_3 = 1u; + ivec3 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +vec4 vertex_main() { + insertBits_428b0b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +ivec3 tint_insert_bits(ivec3 v, ivec3 n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_428b0b() { + ivec3 arg_0 = ivec3(0); + ivec3 arg_1 = ivec3(0); + uint arg_2 = 1u; + uint arg_3 = 1u; + ivec3 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +void fragment_main() { + insertBits_428b0b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +ivec3 tint_insert_bits(ivec3 v, ivec3 n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_428b0b() { + ivec3 arg_0 = ivec3(0); + ivec3 arg_1 = ivec3(0); + uint arg_2 = 1u; + uint arg_3 = 1u; + ivec3 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +void compute_main() { + insertBits_428b0b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/insertBits/428b0b.wgsl.expected.hlsl b/test/tint/builtins/gen/var/insertBits/428b0b.wgsl.expected.hlsl new file mode 100644 index 0000000000..20225c7eb3 --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/428b0b.wgsl.expected.hlsl @@ -0,0 +1,41 @@ +int3 tint_insert_bits(int3 v, int3 n, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u)); + return (((n << uint3((s).xxx)) & int3((int(mask)).xxx)) | (v & int3((int(~(mask))).xxx))); +} + +void insertBits_428b0b() { + int3 arg_0 = (0).xxx; + int3 arg_1 = (0).xxx; + uint arg_2 = 1u; + uint arg_3 = 1u; + int3 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + insertBits_428b0b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + insertBits_428b0b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + insertBits_428b0b(); + return; +} diff --git a/test/tint/builtins/gen/var/insertBits/428b0b.wgsl.expected.msl b/test/tint/builtins/gen/var/insertBits/428b0b.wgsl.expected.msl new file mode 100644 index 0000000000..6c8fd4d814 --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/428b0b.wgsl.expected.msl @@ -0,0 +1,43 @@ +#include + +using namespace metal; +int3 tint_insert_bits(int3 v, int3 n, uint offset, uint count) { + uint const s = min(offset, 32u); + uint const e = min(32u, (s + count)); + return insert_bits(v, n, s, (e - s)); +} + +void insertBits_428b0b() { + int3 arg_0 = int3(0); + int3 arg_1 = int3(0); + uint arg_2 = 1u; + uint arg_3 = 1u; + int3 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + insertBits_428b0b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + insertBits_428b0b(); + return; +} + +kernel void compute_main() { + insertBits_428b0b(); + return; +} + diff --git a/test/tint/builtins/gen/var/insertBits/428b0b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/insertBits/428b0b.wgsl.expected.spvasm new file mode 100644 index 0000000000..3de50bb9a5 --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/428b0b.wgsl.expected.spvasm @@ -0,0 +1,108 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 59 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_insert_bits "tint_insert_bits" + OpName %v "v" + OpName %n "n" + OpName %offset "offset" + OpName %count "count" + OpName %insertBits_428b0b "insertBits_428b0b" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %uint = OpTypeInt 32 0 + %9 = OpTypeFunction %v3int %v3int %v3int %uint %uint + %uint_32 = OpConstant %uint 32 + %void = OpTypeVoid + %26 = OpTypeFunction %void + %30 = OpConstantNull %v3int +%_ptr_Function_v3int = OpTypePointer Function %v3int + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %37 = OpConstantNull %uint + %45 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_insert_bits = OpFunction %v3int None %9 + %v = OpFunctionParameter %v3int + %n = OpFunctionParameter %v3int + %offset = OpFunctionParameter %uint + %count = OpFunctionParameter %uint + %18 = OpLabel + %19 = OpExtInst %uint %20 UMin %offset %uint_32 + %23 = OpIAdd %uint %19 %count + %22 = OpExtInst %uint %20 UMin %uint_32 %23 + %25 = OpISub %uint %22 %19 + %24 = OpBitFieldInsert %v3int %v %n %19 %25 + OpReturnValue %24 + OpFunctionEnd +%insertBits_428b0b = OpFunction %void None %26 + %29 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3int Function %30 + %arg_1 = OpVariable %_ptr_Function_v3int Function %30 + %arg_2 = OpVariable %_ptr_Function_uint Function %37 + %arg_3 = OpVariable %_ptr_Function_uint Function %37 + %res = OpVariable %_ptr_Function_v3int Function %30 + OpStore %arg_0 %30 + OpStore %arg_1 %30 + OpStore %arg_2 %uint_1 + OpStore %arg_3 %uint_1 + %40 = OpLoad %v3int %arg_0 + %41 = OpLoad %v3int %arg_1 + %42 = OpLoad %uint %arg_2 + %43 = OpLoad %uint %arg_3 + %39 = OpFunctionCall %v3int %tint_insert_bits %40 %41 %42 %43 + OpStore %res %39 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %45 + %47 = OpLabel + %48 = OpFunctionCall %void %insertBits_428b0b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %26 + %50 = OpLabel + %51 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %51 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %26 + %54 = OpLabel + %55 = OpFunctionCall %void %insertBits_428b0b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %26 + %57 = OpLabel + %58 = OpFunctionCall %void %insertBits_428b0b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/insertBits/428b0b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/insertBits/428b0b.wgsl.expected.wgsl new file mode 100644 index 0000000000..2dbf3575ad --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/428b0b.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +fn insertBits_428b0b() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var arg_2 = 1u; + var arg_3 = 1u; + var res : vec3 = insertBits(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + insertBits_428b0b(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + insertBits_428b0b(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + insertBits_428b0b(); +} diff --git a/test/tint/builtins/gen/var/insertBits/51ede1.wgsl b/test/tint/builtins/gen/var/insertBits/51ede1.wgsl new file mode 100644 index 0000000000..0d1a93d9b4 --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/51ede1.wgsl @@ -0,0 +1,49 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn insertBits(vec<4, u32>, vec<4, u32>, u32, u32) -> vec<4, u32> +fn insertBits_51ede1() { + var arg_0 = vec4(); + var arg_1 = vec4(); + var arg_2 = 1u; + var arg_3 = 1u; + var res: vec4 = insertBits(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + insertBits_51ede1(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + insertBits_51ede1(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + insertBits_51ede1(); +} diff --git a/test/tint/builtins/gen/var/insertBits/51ede1.wgsl.expected.glsl b/test/tint/builtins/gen/var/insertBits/51ede1.wgsl.expected.glsl new file mode 100644 index 0000000000..e2a8070c05 --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/51ede1.wgsl.expected.glsl @@ -0,0 +1,79 @@ +#version 310 es + +uvec4 tint_insert_bits(uvec4 v, uvec4 n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_51ede1() { + uvec4 arg_0 = uvec4(0u); + uvec4 arg_1 = uvec4(0u); + uint arg_2 = 1u; + uint arg_3 = 1u; + uvec4 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +vec4 vertex_main() { + insertBits_51ede1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uvec4 tint_insert_bits(uvec4 v, uvec4 n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_51ede1() { + uvec4 arg_0 = uvec4(0u); + uvec4 arg_1 = uvec4(0u); + uint arg_2 = 1u; + uint arg_3 = 1u; + uvec4 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +void fragment_main() { + insertBits_51ede1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uvec4 tint_insert_bits(uvec4 v, uvec4 n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_51ede1() { + uvec4 arg_0 = uvec4(0u); + uvec4 arg_1 = uvec4(0u); + uint arg_2 = 1u; + uint arg_3 = 1u; + uvec4 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +void compute_main() { + insertBits_51ede1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/insertBits/51ede1.wgsl.expected.hlsl b/test/tint/builtins/gen/var/insertBits/51ede1.wgsl.expected.hlsl new file mode 100644 index 0000000000..d4a9778375 --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/51ede1.wgsl.expected.hlsl @@ -0,0 +1,41 @@ +uint4 tint_insert_bits(uint4 v, uint4 n, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u)); + return (((n << uint4((s).xxxx)) & uint4((mask).xxxx)) | (v & uint4((~(mask)).xxxx))); +} + +void insertBits_51ede1() { + uint4 arg_0 = (0u).xxxx; + uint4 arg_1 = (0u).xxxx; + uint arg_2 = 1u; + uint arg_3 = 1u; + uint4 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + insertBits_51ede1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + insertBits_51ede1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + insertBits_51ede1(); + return; +} diff --git a/test/tint/builtins/gen/var/insertBits/51ede1.wgsl.expected.msl b/test/tint/builtins/gen/var/insertBits/51ede1.wgsl.expected.msl new file mode 100644 index 0000000000..7f65c996be --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/51ede1.wgsl.expected.msl @@ -0,0 +1,43 @@ +#include + +using namespace metal; +uint4 tint_insert_bits(uint4 v, uint4 n, uint offset, uint count) { + uint const s = min(offset, 32u); + uint const e = min(32u, (s + count)); + return insert_bits(v, n, s, (e - s)); +} + +void insertBits_51ede1() { + uint4 arg_0 = uint4(0u); + uint4 arg_1 = uint4(0u); + uint arg_2 = 1u; + uint arg_3 = 1u; + uint4 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + insertBits_51ede1(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + insertBits_51ede1(); + return; +} + +kernel void compute_main() { + insertBits_51ede1(); + return; +} + diff --git a/test/tint/builtins/gen/var/insertBits/51ede1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/insertBits/51ede1.wgsl.expected.spvasm new file mode 100644 index 0000000000..da0edfc4b8 --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/51ede1.wgsl.expected.spvasm @@ -0,0 +1,107 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 58 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_insert_bits "tint_insert_bits" + OpName %v "v" + OpName %n "n" + OpName %offset "offset" + OpName %count "count" + OpName %insertBits_51ede1 "insertBits_51ede1" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + %9 = OpTypeFunction %v4uint %v4uint %v4uint %uint %uint + %uint_32 = OpConstant %uint 32 + %void = OpTypeVoid + %25 = OpTypeFunction %void + %29 = OpConstantNull %v4uint +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %36 = OpConstantNull %uint + %44 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_insert_bits = OpFunction %v4uint None %9 + %v = OpFunctionParameter %v4uint + %n = OpFunctionParameter %v4uint + %offset = OpFunctionParameter %uint + %count = OpFunctionParameter %uint + %17 = OpLabel + %18 = OpExtInst %uint %19 UMin %offset %uint_32 + %22 = OpIAdd %uint %18 %count + %21 = OpExtInst %uint %19 UMin %uint_32 %22 + %24 = OpISub %uint %21 %18 + %23 = OpBitFieldInsert %v4uint %v %n %18 %24 + OpReturnValue %23 + OpFunctionEnd +%insertBits_51ede1 = OpFunction %void None %25 + %28 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4uint Function %29 + %arg_1 = OpVariable %_ptr_Function_v4uint Function %29 + %arg_2 = OpVariable %_ptr_Function_uint Function %36 + %arg_3 = OpVariable %_ptr_Function_uint Function %36 + %res = OpVariable %_ptr_Function_v4uint Function %29 + OpStore %arg_0 %29 + OpStore %arg_1 %29 + OpStore %arg_2 %uint_1 + OpStore %arg_3 %uint_1 + %39 = OpLoad %v4uint %arg_0 + %40 = OpLoad %v4uint %arg_1 + %41 = OpLoad %uint %arg_2 + %42 = OpLoad %uint %arg_3 + %38 = OpFunctionCall %v4uint %tint_insert_bits %39 %40 %41 %42 + OpStore %res %38 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %44 + %46 = OpLabel + %47 = OpFunctionCall %void %insertBits_51ede1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %25 + %49 = OpLabel + %50 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %50 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %25 + %53 = OpLabel + %54 = OpFunctionCall %void %insertBits_51ede1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %25 + %56 = OpLabel + %57 = OpFunctionCall %void %insertBits_51ede1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/insertBits/51ede1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/insertBits/51ede1.wgsl.expected.wgsl new file mode 100644 index 0000000000..169d42656d --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/51ede1.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +fn insertBits_51ede1() { + var arg_0 = vec4(); + var arg_1 = vec4(); + var arg_2 = 1u; + var arg_3 = 1u; + var res : vec4 = insertBits(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + insertBits_51ede1(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + insertBits_51ede1(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + insertBits_51ede1(); +} diff --git a/test/tint/builtins/gen/var/insertBits/65468b.wgsl b/test/tint/builtins/gen/var/insertBits/65468b.wgsl new file mode 100644 index 0000000000..1d9618f169 --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/65468b.wgsl @@ -0,0 +1,49 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn insertBits(i32, i32, u32, u32) -> i32 +fn insertBits_65468b() { + var arg_0 = 1; + var arg_1 = 1; + var arg_2 = 1u; + var arg_3 = 1u; + var res: i32 = insertBits(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + insertBits_65468b(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + insertBits_65468b(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + insertBits_65468b(); +} diff --git a/test/tint/builtins/gen/var/insertBits/65468b.wgsl.expected.glsl b/test/tint/builtins/gen/var/insertBits/65468b.wgsl.expected.glsl new file mode 100644 index 0000000000..8d9614e4e0 --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/65468b.wgsl.expected.glsl @@ -0,0 +1,79 @@ +#version 310 es + +int tint_insert_bits(int v, int n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_65468b() { + int arg_0 = 1; + int arg_1 = 1; + uint arg_2 = 1u; + uint arg_3 = 1u; + int res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +vec4 vertex_main() { + insertBits_65468b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +int tint_insert_bits(int v, int n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_65468b() { + int arg_0 = 1; + int arg_1 = 1; + uint arg_2 = 1u; + uint arg_3 = 1u; + int res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +void fragment_main() { + insertBits_65468b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +int tint_insert_bits(int v, int n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_65468b() { + int arg_0 = 1; + int arg_1 = 1; + uint arg_2 = 1u; + uint arg_3 = 1u; + int res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +void compute_main() { + insertBits_65468b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/insertBits/65468b.wgsl.expected.hlsl b/test/tint/builtins/gen/var/insertBits/65468b.wgsl.expected.hlsl new file mode 100644 index 0000000000..f87cc19c6b --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/65468b.wgsl.expected.hlsl @@ -0,0 +1,41 @@ +int tint_insert_bits(int v, int n, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u)); + return (((n << s) & int(mask)) | (v & int(~(mask)))); +} + +void insertBits_65468b() { + int arg_0 = 1; + int arg_1 = 1; + uint arg_2 = 1u; + uint arg_3 = 1u; + int res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + insertBits_65468b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + insertBits_65468b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + insertBits_65468b(); + return; +} diff --git a/test/tint/builtins/gen/var/insertBits/65468b.wgsl.expected.msl b/test/tint/builtins/gen/var/insertBits/65468b.wgsl.expected.msl new file mode 100644 index 0000000000..21411f7ce2 --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/65468b.wgsl.expected.msl @@ -0,0 +1,43 @@ +#include + +using namespace metal; +int tint_insert_bits(int v, int n, uint offset, uint count) { + uint const s = min(offset, 32u); + uint const e = min(32u, (s + count)); + return insert_bits(v, n, s, (e - s)); +} + +void insertBits_65468b() { + int arg_0 = 1; + int arg_1 = 1; + uint arg_2 = 1u; + uint arg_3 = 1u; + int res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + insertBits_65468b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + insertBits_65468b(); + return; +} + +kernel void compute_main() { + insertBits_65468b(); + return; +} + diff --git a/test/tint/builtins/gen/var/insertBits/65468b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/insertBits/65468b.wgsl.expected.spvasm new file mode 100644 index 0000000000..3d4e69f1eb --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/65468b.wgsl.expected.spvasm @@ -0,0 +1,108 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 59 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_insert_bits "tint_insert_bits" + OpName %v "v" + OpName %n "n" + OpName %offset "offset" + OpName %count "count" + OpName %insertBits_65468b "insertBits_65468b" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %9 = OpTypeFunction %int %int %int %uint %uint + %uint_32 = OpConstant %uint 32 + %void = OpTypeVoid + %25 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %32 = OpConstantNull %int + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %37 = OpConstantNull %uint + %45 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_insert_bits = OpFunction %int None %9 + %v = OpFunctionParameter %int + %n = OpFunctionParameter %int + %offset = OpFunctionParameter %uint + %count = OpFunctionParameter %uint + %17 = OpLabel + %18 = OpExtInst %uint %19 UMin %offset %uint_32 + %22 = OpIAdd %uint %18 %count + %21 = OpExtInst %uint %19 UMin %uint_32 %22 + %24 = OpISub %uint %21 %18 + %23 = OpBitFieldInsert %int %v %n %18 %24 + OpReturnValue %23 + OpFunctionEnd +%insertBits_65468b = OpFunction %void None %25 + %28 = OpLabel + %arg_0 = OpVariable %_ptr_Function_int Function %32 + %arg_1 = OpVariable %_ptr_Function_int Function %32 + %arg_2 = OpVariable %_ptr_Function_uint Function %37 + %arg_3 = OpVariable %_ptr_Function_uint Function %37 + %res = OpVariable %_ptr_Function_int Function %32 + OpStore %arg_0 %int_1 + OpStore %arg_1 %int_1 + OpStore %arg_2 %uint_1 + OpStore %arg_3 %uint_1 + %40 = OpLoad %int %arg_0 + %41 = OpLoad %int %arg_1 + %42 = OpLoad %uint %arg_2 + %43 = OpLoad %uint %arg_3 + %39 = OpFunctionCall %int %tint_insert_bits %40 %41 %42 %43 + OpStore %res %39 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %45 + %47 = OpLabel + %48 = OpFunctionCall %void %insertBits_65468b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %25 + %50 = OpLabel + %51 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %51 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %25 + %54 = OpLabel + %55 = OpFunctionCall %void %insertBits_65468b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %25 + %57 = OpLabel + %58 = OpFunctionCall %void %insertBits_65468b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/insertBits/65468b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/insertBits/65468b.wgsl.expected.wgsl new file mode 100644 index 0000000000..cee6ffecd5 --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/65468b.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +fn insertBits_65468b() { + var arg_0 = 1; + var arg_1 = 1; + var arg_2 = 1u; + var arg_3 = 1u; + var res : i32 = insertBits(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + insertBits_65468b(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + insertBits_65468b(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + insertBits_65468b(); +} diff --git a/test/tint/builtins/gen/var/insertBits/87826b.wgsl b/test/tint/builtins/gen/var/insertBits/87826b.wgsl new file mode 100644 index 0000000000..6f1fca8c02 --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/87826b.wgsl @@ -0,0 +1,49 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn insertBits(vec<3, u32>, vec<3, u32>, u32, u32) -> vec<3, u32> +fn insertBits_87826b() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var arg_2 = 1u; + var arg_3 = 1u; + var res: vec3 = insertBits(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + insertBits_87826b(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + insertBits_87826b(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + insertBits_87826b(); +} diff --git a/test/tint/builtins/gen/var/insertBits/87826b.wgsl.expected.glsl b/test/tint/builtins/gen/var/insertBits/87826b.wgsl.expected.glsl new file mode 100644 index 0000000000..3c9a3ade34 --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/87826b.wgsl.expected.glsl @@ -0,0 +1,79 @@ +#version 310 es + +uvec3 tint_insert_bits(uvec3 v, uvec3 n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_87826b() { + uvec3 arg_0 = uvec3(0u); + uvec3 arg_1 = uvec3(0u); + uint arg_2 = 1u; + uint arg_3 = 1u; + uvec3 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +vec4 vertex_main() { + insertBits_87826b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uvec3 tint_insert_bits(uvec3 v, uvec3 n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_87826b() { + uvec3 arg_0 = uvec3(0u); + uvec3 arg_1 = uvec3(0u); + uint arg_2 = 1u; + uint arg_3 = 1u; + uvec3 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +void fragment_main() { + insertBits_87826b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uvec3 tint_insert_bits(uvec3 v, uvec3 n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_87826b() { + uvec3 arg_0 = uvec3(0u); + uvec3 arg_1 = uvec3(0u); + uint arg_2 = 1u; + uint arg_3 = 1u; + uvec3 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +void compute_main() { + insertBits_87826b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/insertBits/87826b.wgsl.expected.hlsl b/test/tint/builtins/gen/var/insertBits/87826b.wgsl.expected.hlsl new file mode 100644 index 0000000000..c7b4134186 --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/87826b.wgsl.expected.hlsl @@ -0,0 +1,41 @@ +uint3 tint_insert_bits(uint3 v, uint3 n, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u)); + return (((n << uint3((s).xxx)) & uint3((mask).xxx)) | (v & uint3((~(mask)).xxx))); +} + +void insertBits_87826b() { + uint3 arg_0 = (0u).xxx; + uint3 arg_1 = (0u).xxx; + uint arg_2 = 1u; + uint arg_3 = 1u; + uint3 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + insertBits_87826b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + insertBits_87826b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + insertBits_87826b(); + return; +} diff --git a/test/tint/builtins/gen/var/insertBits/87826b.wgsl.expected.msl b/test/tint/builtins/gen/var/insertBits/87826b.wgsl.expected.msl new file mode 100644 index 0000000000..7c093e44c2 --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/87826b.wgsl.expected.msl @@ -0,0 +1,43 @@ +#include + +using namespace metal; +uint3 tint_insert_bits(uint3 v, uint3 n, uint offset, uint count) { + uint const s = min(offset, 32u); + uint const e = min(32u, (s + count)); + return insert_bits(v, n, s, (e - s)); +} + +void insertBits_87826b() { + uint3 arg_0 = uint3(0u); + uint3 arg_1 = uint3(0u); + uint arg_2 = 1u; + uint arg_3 = 1u; + uint3 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + insertBits_87826b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + insertBits_87826b(); + return; +} + +kernel void compute_main() { + insertBits_87826b(); + return; +} + diff --git a/test/tint/builtins/gen/var/insertBits/87826b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/insertBits/87826b.wgsl.expected.spvasm new file mode 100644 index 0000000000..397311eb5e --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/87826b.wgsl.expected.spvasm @@ -0,0 +1,107 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 58 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_insert_bits "tint_insert_bits" + OpName %v "v" + OpName %n "n" + OpName %offset "offset" + OpName %count "count" + OpName %insertBits_87826b "insertBits_87826b" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %9 = OpTypeFunction %v3uint %v3uint %v3uint %uint %uint + %uint_32 = OpConstant %uint 32 + %void = OpTypeVoid + %25 = OpTypeFunction %void + %29 = OpConstantNull %v3uint +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %36 = OpConstantNull %uint + %44 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_insert_bits = OpFunction %v3uint None %9 + %v = OpFunctionParameter %v3uint + %n = OpFunctionParameter %v3uint + %offset = OpFunctionParameter %uint + %count = OpFunctionParameter %uint + %17 = OpLabel + %18 = OpExtInst %uint %19 UMin %offset %uint_32 + %22 = OpIAdd %uint %18 %count + %21 = OpExtInst %uint %19 UMin %uint_32 %22 + %24 = OpISub %uint %21 %18 + %23 = OpBitFieldInsert %v3uint %v %n %18 %24 + OpReturnValue %23 + OpFunctionEnd +%insertBits_87826b = OpFunction %void None %25 + %28 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3uint Function %29 + %arg_1 = OpVariable %_ptr_Function_v3uint Function %29 + %arg_2 = OpVariable %_ptr_Function_uint Function %36 + %arg_3 = OpVariable %_ptr_Function_uint Function %36 + %res = OpVariable %_ptr_Function_v3uint Function %29 + OpStore %arg_0 %29 + OpStore %arg_1 %29 + OpStore %arg_2 %uint_1 + OpStore %arg_3 %uint_1 + %39 = OpLoad %v3uint %arg_0 + %40 = OpLoad %v3uint %arg_1 + %41 = OpLoad %uint %arg_2 + %42 = OpLoad %uint %arg_3 + %38 = OpFunctionCall %v3uint %tint_insert_bits %39 %40 %41 %42 + OpStore %res %38 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %44 + %46 = OpLabel + %47 = OpFunctionCall %void %insertBits_87826b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %25 + %49 = OpLabel + %50 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %50 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %25 + %53 = OpLabel + %54 = OpFunctionCall %void %insertBits_87826b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %25 + %56 = OpLabel + %57 = OpFunctionCall %void %insertBits_87826b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/insertBits/87826b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/insertBits/87826b.wgsl.expected.wgsl new file mode 100644 index 0000000000..48253d4892 --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/87826b.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +fn insertBits_87826b() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var arg_2 = 1u; + var arg_3 = 1u; + var res : vec3 = insertBits(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + insertBits_87826b(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + insertBits_87826b(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + insertBits_87826b(); +} diff --git a/test/tint/builtins/gen/var/insertBits/d86978.wgsl b/test/tint/builtins/gen/var/insertBits/d86978.wgsl new file mode 100644 index 0000000000..db3006980f --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/d86978.wgsl @@ -0,0 +1,49 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn insertBits(vec<4, i32>, vec<4, i32>, u32, u32) -> vec<4, i32> +fn insertBits_d86978() { + var arg_0 = vec4(); + var arg_1 = vec4(); + var arg_2 = 1u; + var arg_3 = 1u; + var res: vec4 = insertBits(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + insertBits_d86978(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + insertBits_d86978(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + insertBits_d86978(); +} diff --git a/test/tint/builtins/gen/var/insertBits/d86978.wgsl.expected.glsl b/test/tint/builtins/gen/var/insertBits/d86978.wgsl.expected.glsl new file mode 100644 index 0000000000..ac28a7e4ad --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/d86978.wgsl.expected.glsl @@ -0,0 +1,79 @@ +#version 310 es + +ivec4 tint_insert_bits(ivec4 v, ivec4 n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_d86978() { + ivec4 arg_0 = ivec4(0); + ivec4 arg_1 = ivec4(0); + uint arg_2 = 1u; + uint arg_3 = 1u; + ivec4 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +vec4 vertex_main() { + insertBits_d86978(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +ivec4 tint_insert_bits(ivec4 v, ivec4 n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_d86978() { + ivec4 arg_0 = ivec4(0); + ivec4 arg_1 = ivec4(0); + uint arg_2 = 1u; + uint arg_3 = 1u; + ivec4 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +void fragment_main() { + insertBits_d86978(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +ivec4 tint_insert_bits(ivec4 v, ivec4 n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_d86978() { + ivec4 arg_0 = ivec4(0); + ivec4 arg_1 = ivec4(0); + uint arg_2 = 1u; + uint arg_3 = 1u; + ivec4 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +void compute_main() { + insertBits_d86978(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/insertBits/d86978.wgsl.expected.hlsl b/test/tint/builtins/gen/var/insertBits/d86978.wgsl.expected.hlsl new file mode 100644 index 0000000000..a6689bba5f --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/d86978.wgsl.expected.hlsl @@ -0,0 +1,41 @@ +int4 tint_insert_bits(int4 v, int4 n, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u)); + return (((n << uint4((s).xxxx)) & int4((int(mask)).xxxx)) | (v & int4((int(~(mask))).xxxx))); +} + +void insertBits_d86978() { + int4 arg_0 = (0).xxxx; + int4 arg_1 = (0).xxxx; + uint arg_2 = 1u; + uint arg_3 = 1u; + int4 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + insertBits_d86978(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + insertBits_d86978(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + insertBits_d86978(); + return; +} diff --git a/test/tint/builtins/gen/var/insertBits/d86978.wgsl.expected.msl b/test/tint/builtins/gen/var/insertBits/d86978.wgsl.expected.msl new file mode 100644 index 0000000000..7cb5abcab1 --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/d86978.wgsl.expected.msl @@ -0,0 +1,43 @@ +#include + +using namespace metal; +int4 tint_insert_bits(int4 v, int4 n, uint offset, uint count) { + uint const s = min(offset, 32u); + uint const e = min(32u, (s + count)); + return insert_bits(v, n, s, (e - s)); +} + +void insertBits_d86978() { + int4 arg_0 = int4(0); + int4 arg_1 = int4(0); + uint arg_2 = 1u; + uint arg_3 = 1u; + int4 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + insertBits_d86978(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + insertBits_d86978(); + return; +} + +kernel void compute_main() { + insertBits_d86978(); + return; +} + diff --git a/test/tint/builtins/gen/var/insertBits/d86978.wgsl.expected.spvasm b/test/tint/builtins/gen/var/insertBits/d86978.wgsl.expected.spvasm new file mode 100644 index 0000000000..9591bbf453 --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/d86978.wgsl.expected.spvasm @@ -0,0 +1,108 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 59 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_insert_bits "tint_insert_bits" + OpName %v "v" + OpName %n "n" + OpName %offset "offset" + OpName %count "count" + OpName %insertBits_d86978 "insertBits_d86978" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %uint = OpTypeInt 32 0 + %9 = OpTypeFunction %v4int %v4int %v4int %uint %uint + %uint_32 = OpConstant %uint 32 + %void = OpTypeVoid + %26 = OpTypeFunction %void + %30 = OpConstantNull %v4int +%_ptr_Function_v4int = OpTypePointer Function %v4int + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %37 = OpConstantNull %uint + %45 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_insert_bits = OpFunction %v4int None %9 + %v = OpFunctionParameter %v4int + %n = OpFunctionParameter %v4int + %offset = OpFunctionParameter %uint + %count = OpFunctionParameter %uint + %18 = OpLabel + %19 = OpExtInst %uint %20 UMin %offset %uint_32 + %23 = OpIAdd %uint %19 %count + %22 = OpExtInst %uint %20 UMin %uint_32 %23 + %25 = OpISub %uint %22 %19 + %24 = OpBitFieldInsert %v4int %v %n %19 %25 + OpReturnValue %24 + OpFunctionEnd +%insertBits_d86978 = OpFunction %void None %26 + %29 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4int Function %30 + %arg_1 = OpVariable %_ptr_Function_v4int Function %30 + %arg_2 = OpVariable %_ptr_Function_uint Function %37 + %arg_3 = OpVariable %_ptr_Function_uint Function %37 + %res = OpVariable %_ptr_Function_v4int Function %30 + OpStore %arg_0 %30 + OpStore %arg_1 %30 + OpStore %arg_2 %uint_1 + OpStore %arg_3 %uint_1 + %40 = OpLoad %v4int %arg_0 + %41 = OpLoad %v4int %arg_1 + %42 = OpLoad %uint %arg_2 + %43 = OpLoad %uint %arg_3 + %39 = OpFunctionCall %v4int %tint_insert_bits %40 %41 %42 %43 + OpStore %res %39 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %45 + %47 = OpLabel + %48 = OpFunctionCall %void %insertBits_d86978 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %26 + %50 = OpLabel + %51 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %51 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %26 + %54 = OpLabel + %55 = OpFunctionCall %void %insertBits_d86978 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %26 + %57 = OpLabel + %58 = OpFunctionCall %void %insertBits_d86978 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/insertBits/d86978.wgsl.expected.wgsl b/test/tint/builtins/gen/var/insertBits/d86978.wgsl.expected.wgsl new file mode 100644 index 0000000000..0678533d7e --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/d86978.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +fn insertBits_d86978() { + var arg_0 = vec4(); + var arg_1 = vec4(); + var arg_2 = 1u; + var arg_3 = 1u; + var res : vec4 = insertBits(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + insertBits_d86978(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + insertBits_d86978(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + insertBits_d86978(); +} diff --git a/test/tint/builtins/gen/var/insertBits/e3e3a2.wgsl b/test/tint/builtins/gen/var/insertBits/e3e3a2.wgsl new file mode 100644 index 0000000000..82178dcf93 --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/e3e3a2.wgsl @@ -0,0 +1,49 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn insertBits(u32, u32, u32, u32) -> u32 +fn insertBits_e3e3a2() { + var arg_0 = 1u; + var arg_1 = 1u; + var arg_2 = 1u; + var arg_3 = 1u; + var res: u32 = insertBits(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + insertBits_e3e3a2(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + insertBits_e3e3a2(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + insertBits_e3e3a2(); +} diff --git a/test/tint/builtins/gen/var/insertBits/e3e3a2.wgsl.expected.glsl b/test/tint/builtins/gen/var/insertBits/e3e3a2.wgsl.expected.glsl new file mode 100644 index 0000000000..07f56be678 --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/e3e3a2.wgsl.expected.glsl @@ -0,0 +1,79 @@ +#version 310 es + +uint tint_insert_bits(uint v, uint n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_e3e3a2() { + uint arg_0 = 1u; + uint arg_1 = 1u; + uint arg_2 = 1u; + uint arg_3 = 1u; + uint res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +vec4 vertex_main() { + insertBits_e3e3a2(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uint tint_insert_bits(uint v, uint n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_e3e3a2() { + uint arg_0 = 1u; + uint arg_1 = 1u; + uint arg_2 = 1u; + uint arg_3 = 1u; + uint res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +void fragment_main() { + insertBits_e3e3a2(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uint tint_insert_bits(uint v, uint n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_e3e3a2() { + uint arg_0 = 1u; + uint arg_1 = 1u; + uint arg_2 = 1u; + uint arg_3 = 1u; + uint res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +void compute_main() { + insertBits_e3e3a2(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/insertBits/e3e3a2.wgsl.expected.hlsl b/test/tint/builtins/gen/var/insertBits/e3e3a2.wgsl.expected.hlsl new file mode 100644 index 0000000000..cfbbeee243 --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/e3e3a2.wgsl.expected.hlsl @@ -0,0 +1,41 @@ +uint tint_insert_bits(uint v, uint n, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u)); + return (((n << s) & mask) | (v & ~(mask))); +} + +void insertBits_e3e3a2() { + uint arg_0 = 1u; + uint arg_1 = 1u; + uint arg_2 = 1u; + uint arg_3 = 1u; + uint res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + insertBits_e3e3a2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + insertBits_e3e3a2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + insertBits_e3e3a2(); + return; +} diff --git a/test/tint/builtins/gen/var/insertBits/e3e3a2.wgsl.expected.msl b/test/tint/builtins/gen/var/insertBits/e3e3a2.wgsl.expected.msl new file mode 100644 index 0000000000..20a4950d72 --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/e3e3a2.wgsl.expected.msl @@ -0,0 +1,43 @@ +#include + +using namespace metal; +uint tint_insert_bits(uint v, uint n, uint offset, uint count) { + uint const s = min(offset, 32u); + uint const e = min(32u, (s + count)); + return insert_bits(v, n, s, (e - s)); +} + +void insertBits_e3e3a2() { + uint arg_0 = 1u; + uint arg_1 = 1u; + uint arg_2 = 1u; + uint arg_3 = 1u; + uint res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + insertBits_e3e3a2(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + insertBits_e3e3a2(); + return; +} + +kernel void compute_main() { + insertBits_e3e3a2(); + return; +} + diff --git a/test/tint/builtins/gen/var/insertBits/e3e3a2.wgsl.expected.spvasm b/test/tint/builtins/gen/var/insertBits/e3e3a2.wgsl.expected.spvasm new file mode 100644 index 0000000000..17e63b9b9d --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/e3e3a2.wgsl.expected.spvasm @@ -0,0 +1,104 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 55 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_insert_bits "tint_insert_bits" + OpName %v "v" + OpName %n "n" + OpName %offset "offset" + OpName %count "count" + OpName %insertBits_e3e3a2 "insertBits_e3e3a2" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %9 = OpTypeFunction %uint %uint %uint %uint %uint + %uint_32 = OpConstant %uint 32 + %void = OpTypeVoid + %24 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %31 = OpConstantNull %uint + %41 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_insert_bits = OpFunction %uint None %9 + %v = OpFunctionParameter %uint + %n = OpFunctionParameter %uint + %offset = OpFunctionParameter %uint + %count = OpFunctionParameter %uint + %16 = OpLabel + %17 = OpExtInst %uint %18 UMin %offset %uint_32 + %21 = OpIAdd %uint %17 %count + %20 = OpExtInst %uint %18 UMin %uint_32 %21 + %23 = OpISub %uint %20 %17 + %22 = OpBitFieldInsert %uint %v %n %17 %23 + OpReturnValue %22 + OpFunctionEnd +%insertBits_e3e3a2 = OpFunction %void None %24 + %27 = OpLabel + %arg_0 = OpVariable %_ptr_Function_uint Function %31 + %arg_1 = OpVariable %_ptr_Function_uint Function %31 + %arg_2 = OpVariable %_ptr_Function_uint Function %31 + %arg_3 = OpVariable %_ptr_Function_uint Function %31 + %res = OpVariable %_ptr_Function_uint Function %31 + OpStore %arg_0 %uint_1 + OpStore %arg_1 %uint_1 + OpStore %arg_2 %uint_1 + OpStore %arg_3 %uint_1 + %36 = OpLoad %uint %arg_0 + %37 = OpLoad %uint %arg_1 + %38 = OpLoad %uint %arg_2 + %39 = OpLoad %uint %arg_3 + %35 = OpFunctionCall %uint %tint_insert_bits %36 %37 %38 %39 + OpStore %res %35 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %41 + %43 = OpLabel + %44 = OpFunctionCall %void %insertBits_e3e3a2 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %24 + %46 = OpLabel + %47 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %47 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %24 + %50 = OpLabel + %51 = OpFunctionCall %void %insertBits_e3e3a2 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %24 + %53 = OpLabel + %54 = OpFunctionCall %void %insertBits_e3e3a2 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/insertBits/e3e3a2.wgsl.expected.wgsl b/test/tint/builtins/gen/var/insertBits/e3e3a2.wgsl.expected.wgsl new file mode 100644 index 0000000000..a11ca1ea5a --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/e3e3a2.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +fn insertBits_e3e3a2() { + var arg_0 = 1u; + var arg_1 = 1u; + var arg_2 = 1u; + var arg_3 = 1u; + var res : u32 = insertBits(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + insertBits_e3e3a2(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + insertBits_e3e3a2(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + insertBits_e3e3a2(); +} diff --git a/test/tint/builtins/gen/var/insertBits/fe6ba6.wgsl b/test/tint/builtins/gen/var/insertBits/fe6ba6.wgsl new file mode 100644 index 0000000000..1d1b8b16ce --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/fe6ba6.wgsl @@ -0,0 +1,49 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn insertBits(vec<2, i32>, vec<2, i32>, u32, u32) -> vec<2, i32> +fn insertBits_fe6ba6() { + var arg_0 = vec2(); + var arg_1 = vec2(); + var arg_2 = 1u; + var arg_3 = 1u; + var res: vec2 = insertBits(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + insertBits_fe6ba6(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + insertBits_fe6ba6(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + insertBits_fe6ba6(); +} diff --git a/test/tint/builtins/gen/var/insertBits/fe6ba6.wgsl.expected.glsl b/test/tint/builtins/gen/var/insertBits/fe6ba6.wgsl.expected.glsl new file mode 100644 index 0000000000..2cfb3a09a5 --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/fe6ba6.wgsl.expected.glsl @@ -0,0 +1,79 @@ +#version 310 es + +ivec2 tint_insert_bits(ivec2 v, ivec2 n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_fe6ba6() { + ivec2 arg_0 = ivec2(0); + ivec2 arg_1 = ivec2(0); + uint arg_2 = 1u; + uint arg_3 = 1u; + ivec2 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +vec4 vertex_main() { + insertBits_fe6ba6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +ivec2 tint_insert_bits(ivec2 v, ivec2 n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_fe6ba6() { + ivec2 arg_0 = ivec2(0); + ivec2 arg_1 = ivec2(0); + uint arg_2 = 1u; + uint arg_3 = 1u; + ivec2 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +void fragment_main() { + insertBits_fe6ba6(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +ivec2 tint_insert_bits(ivec2 v, ivec2 n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_fe6ba6() { + ivec2 arg_0 = ivec2(0); + ivec2 arg_1 = ivec2(0); + uint arg_2 = 1u; + uint arg_3 = 1u; + ivec2 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +void compute_main() { + insertBits_fe6ba6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/insertBits/fe6ba6.wgsl.expected.hlsl b/test/tint/builtins/gen/var/insertBits/fe6ba6.wgsl.expected.hlsl new file mode 100644 index 0000000000..c00768bf1a --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/fe6ba6.wgsl.expected.hlsl @@ -0,0 +1,41 @@ +int2 tint_insert_bits(int2 v, int2 n, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u)); + return (((n << uint2((s).xx)) & int2((int(mask)).xx)) | (v & int2((int(~(mask))).xx))); +} + +void insertBits_fe6ba6() { + int2 arg_0 = (0).xx; + int2 arg_1 = (0).xx; + uint arg_2 = 1u; + uint arg_3 = 1u; + int2 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + insertBits_fe6ba6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + insertBits_fe6ba6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + insertBits_fe6ba6(); + return; +} diff --git a/test/tint/builtins/gen/var/insertBits/fe6ba6.wgsl.expected.msl b/test/tint/builtins/gen/var/insertBits/fe6ba6.wgsl.expected.msl new file mode 100644 index 0000000000..da47190bf6 --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/fe6ba6.wgsl.expected.msl @@ -0,0 +1,43 @@ +#include + +using namespace metal; +int2 tint_insert_bits(int2 v, int2 n, uint offset, uint count) { + uint const s = min(offset, 32u); + uint const e = min(32u, (s + count)); + return insert_bits(v, n, s, (e - s)); +} + +void insertBits_fe6ba6() { + int2 arg_0 = int2(0); + int2 arg_1 = int2(0); + uint arg_2 = 1u; + uint arg_3 = 1u; + int2 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + insertBits_fe6ba6(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + insertBits_fe6ba6(); + return; +} + +kernel void compute_main() { + insertBits_fe6ba6(); + return; +} + diff --git a/test/tint/builtins/gen/var/insertBits/fe6ba6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/insertBits/fe6ba6.wgsl.expected.spvasm new file mode 100644 index 0000000000..e67ff066e5 --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/fe6ba6.wgsl.expected.spvasm @@ -0,0 +1,108 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 59 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_insert_bits "tint_insert_bits" + OpName %v "v" + OpName %n "n" + OpName %offset "offset" + OpName %count "count" + OpName %insertBits_fe6ba6 "insertBits_fe6ba6" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %uint = OpTypeInt 32 0 + %9 = OpTypeFunction %v2int %v2int %v2int %uint %uint + %uint_32 = OpConstant %uint 32 + %void = OpTypeVoid + %26 = OpTypeFunction %void + %30 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %37 = OpConstantNull %uint + %45 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_insert_bits = OpFunction %v2int None %9 + %v = OpFunctionParameter %v2int + %n = OpFunctionParameter %v2int + %offset = OpFunctionParameter %uint + %count = OpFunctionParameter %uint + %18 = OpLabel + %19 = OpExtInst %uint %20 UMin %offset %uint_32 + %23 = OpIAdd %uint %19 %count + %22 = OpExtInst %uint %20 UMin %uint_32 %23 + %25 = OpISub %uint %22 %19 + %24 = OpBitFieldInsert %v2int %v %n %19 %25 + OpReturnValue %24 + OpFunctionEnd +%insertBits_fe6ba6 = OpFunction %void None %26 + %29 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2int Function %30 + %arg_1 = OpVariable %_ptr_Function_v2int Function %30 + %arg_2 = OpVariable %_ptr_Function_uint Function %37 + %arg_3 = OpVariable %_ptr_Function_uint Function %37 + %res = OpVariable %_ptr_Function_v2int Function %30 + OpStore %arg_0 %30 + OpStore %arg_1 %30 + OpStore %arg_2 %uint_1 + OpStore %arg_3 %uint_1 + %40 = OpLoad %v2int %arg_0 + %41 = OpLoad %v2int %arg_1 + %42 = OpLoad %uint %arg_2 + %43 = OpLoad %uint %arg_3 + %39 = OpFunctionCall %v2int %tint_insert_bits %40 %41 %42 %43 + OpStore %res %39 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %45 + %47 = OpLabel + %48 = OpFunctionCall %void %insertBits_fe6ba6 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %26 + %50 = OpLabel + %51 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %51 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %26 + %54 = OpLabel + %55 = OpFunctionCall %void %insertBits_fe6ba6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %26 + %57 = OpLabel + %58 = OpFunctionCall %void %insertBits_fe6ba6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/insertBits/fe6ba6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/insertBits/fe6ba6.wgsl.expected.wgsl new file mode 100644 index 0000000000..13f8c15f7b --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/fe6ba6.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +fn insertBits_fe6ba6() { + var arg_0 = vec2(); + var arg_1 = vec2(); + var arg_2 = 1u; + var arg_3 = 1u; + var res : vec2 = insertBits(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + insertBits_fe6ba6(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + insertBits_fe6ba6(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + insertBits_fe6ba6(); +} diff --git a/test/tint/builtins/gen/var/inverseSqrt/84407e.wgsl b/test/tint/builtins/gen/var/inverseSqrt/84407e.wgsl new file mode 100644 index 0000000000..a5dabf6fc5 --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/84407e.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn inverseSqrt(f32) -> f32 +fn inverseSqrt_84407e() { + var arg_0 = 1.0; + var res: f32 = inverseSqrt(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + inverseSqrt_84407e(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + inverseSqrt_84407e(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + inverseSqrt_84407e(); +} diff --git a/test/tint/builtins/gen/var/inverseSqrt/84407e.wgsl.expected.glsl b/test/tint/builtins/gen/var/inverseSqrt/84407e.wgsl.expected.glsl new file mode 100644 index 0000000000..9ddc69421a --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/84407e.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void inverseSqrt_84407e() { + float arg_0 = 1.0f; + float res = inversesqrt(arg_0); +} + +vec4 vertex_main() { + inverseSqrt_84407e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void inverseSqrt_84407e() { + float arg_0 = 1.0f; + float res = inversesqrt(arg_0); +} + +void fragment_main() { + inverseSqrt_84407e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void inverseSqrt_84407e() { + float arg_0 = 1.0f; + float res = inversesqrt(arg_0); +} + +void compute_main() { + inverseSqrt_84407e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/inverseSqrt/84407e.wgsl.expected.hlsl b/test/tint/builtins/gen/var/inverseSqrt/84407e.wgsl.expected.hlsl new file mode 100644 index 0000000000..97c63e575d --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/84407e.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void inverseSqrt_84407e() { + float arg_0 = 1.0f; + float res = rsqrt(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + inverseSqrt_84407e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + inverseSqrt_84407e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + inverseSqrt_84407e(); + return; +} diff --git a/test/tint/builtins/gen/var/inverseSqrt/84407e.wgsl.expected.msl b/test/tint/builtins/gen/var/inverseSqrt/84407e.wgsl.expected.msl new file mode 100644 index 0000000000..61e9b67c70 --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/84407e.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void inverseSqrt_84407e() { + float arg_0 = 1.0f; + float res = rsqrt(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + inverseSqrt_84407e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + inverseSqrt_84407e(); + return; +} + +kernel void compute_main() { + inverseSqrt_84407e(); + return; +} + diff --git a/test/tint/builtins/gen/var/inverseSqrt/84407e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/inverseSqrt/84407e.wgsl.expected.spvasm new file mode 100644 index 0000000000..c3503738fa --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/84407e.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %inverseSqrt_84407e "inverseSqrt_84407e" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %20 = OpTypeFunction %v4float +%inverseSqrt_84407e = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + %18 = OpLoad %float %arg_0 + %16 = OpExtInst %float %17 InverseSqrt %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %inverseSqrt_84407e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %inverseSqrt_84407e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %inverseSqrt_84407e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/inverseSqrt/84407e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/inverseSqrt/84407e.wgsl.expected.wgsl new file mode 100644 index 0000000000..f86db027dd --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/84407e.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn inverseSqrt_84407e() { + var arg_0 = 1.0; + var res : f32 = inverseSqrt(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + inverseSqrt_84407e(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + inverseSqrt_84407e(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + inverseSqrt_84407e(); +} diff --git a/test/tint/builtins/gen/var/inverseSqrt/8f2bd2.wgsl b/test/tint/builtins/gen/var/inverseSqrt/8f2bd2.wgsl new file mode 100644 index 0000000000..2f093e92dc --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/8f2bd2.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn inverseSqrt(vec<2, f32>) -> vec<2, f32> +fn inverseSqrt_8f2bd2() { + var arg_0 = vec2(); + var res: vec2 = inverseSqrt(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + inverseSqrt_8f2bd2(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + inverseSqrt_8f2bd2(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + inverseSqrt_8f2bd2(); +} diff --git a/test/tint/builtins/gen/var/inverseSqrt/8f2bd2.wgsl.expected.glsl b/test/tint/builtins/gen/var/inverseSqrt/8f2bd2.wgsl.expected.glsl new file mode 100644 index 0000000000..c84d6e02be --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/8f2bd2.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void inverseSqrt_8f2bd2() { + vec2 arg_0 = vec2(0.0f); + vec2 res = inversesqrt(arg_0); +} + +vec4 vertex_main() { + inverseSqrt_8f2bd2(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void inverseSqrt_8f2bd2() { + vec2 arg_0 = vec2(0.0f); + vec2 res = inversesqrt(arg_0); +} + +void fragment_main() { + inverseSqrt_8f2bd2(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void inverseSqrt_8f2bd2() { + vec2 arg_0 = vec2(0.0f); + vec2 res = inversesqrt(arg_0); +} + +void compute_main() { + inverseSqrt_8f2bd2(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/inverseSqrt/8f2bd2.wgsl.expected.hlsl b/test/tint/builtins/gen/var/inverseSqrt/8f2bd2.wgsl.expected.hlsl new file mode 100644 index 0000000000..88d14d465f --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/8f2bd2.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void inverseSqrt_8f2bd2() { + float2 arg_0 = (0.0f).xx; + float2 res = rsqrt(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + inverseSqrt_8f2bd2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + inverseSqrt_8f2bd2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + inverseSqrt_8f2bd2(); + return; +} diff --git a/test/tint/builtins/gen/var/inverseSqrt/8f2bd2.wgsl.expected.msl b/test/tint/builtins/gen/var/inverseSqrt/8f2bd2.wgsl.expected.msl new file mode 100644 index 0000000000..3d79e943c3 --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/8f2bd2.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void inverseSqrt_8f2bd2() { + float2 arg_0 = float2(0.0f); + float2 res = rsqrt(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + inverseSqrt_8f2bd2(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + inverseSqrt_8f2bd2(); + return; +} + +kernel void compute_main() { + inverseSqrt_8f2bd2(); + return; +} + diff --git a/test/tint/builtins/gen/var/inverseSqrt/8f2bd2.wgsl.expected.spvasm b/test/tint/builtins/gen/var/inverseSqrt/8f2bd2.wgsl.expected.spvasm new file mode 100644 index 0000000000..36b4d36125 --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/8f2bd2.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %inverseSqrt_8f2bd2 "inverseSqrt_8f2bd2" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %14 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%inverseSqrt_8f2bd2 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %14 + %res = OpVariable %_ptr_Function_v2float Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %v2float %arg_0 + %17 = OpExtInst %v2float %18 InverseSqrt %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %inverseSqrt_8f2bd2 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %inverseSqrt_8f2bd2 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %inverseSqrt_8f2bd2 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/inverseSqrt/8f2bd2.wgsl.expected.wgsl b/test/tint/builtins/gen/var/inverseSqrt/8f2bd2.wgsl.expected.wgsl new file mode 100644 index 0000000000..74b8db5084 --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/8f2bd2.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn inverseSqrt_8f2bd2() { + var arg_0 = vec2(); + var res : vec2 = inverseSqrt(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + inverseSqrt_8f2bd2(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + inverseSqrt_8f2bd2(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + inverseSqrt_8f2bd2(); +} diff --git a/test/tint/builtins/gen/var/inverseSqrt/b197b1.wgsl b/test/tint/builtins/gen/var/inverseSqrt/b197b1.wgsl new file mode 100644 index 0000000000..c4b094754c --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/b197b1.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn inverseSqrt(vec<3, f32>) -> vec<3, f32> +fn inverseSqrt_b197b1() { + var arg_0 = vec3(); + var res: vec3 = inverseSqrt(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + inverseSqrt_b197b1(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + inverseSqrt_b197b1(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + inverseSqrt_b197b1(); +} diff --git a/test/tint/builtins/gen/var/inverseSqrt/b197b1.wgsl.expected.glsl b/test/tint/builtins/gen/var/inverseSqrt/b197b1.wgsl.expected.glsl new file mode 100644 index 0000000000..f44044d8d7 --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/b197b1.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void inverseSqrt_b197b1() { + vec3 arg_0 = vec3(0.0f); + vec3 res = inversesqrt(arg_0); +} + +vec4 vertex_main() { + inverseSqrt_b197b1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void inverseSqrt_b197b1() { + vec3 arg_0 = vec3(0.0f); + vec3 res = inversesqrt(arg_0); +} + +void fragment_main() { + inverseSqrt_b197b1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void inverseSqrt_b197b1() { + vec3 arg_0 = vec3(0.0f); + vec3 res = inversesqrt(arg_0); +} + +void compute_main() { + inverseSqrt_b197b1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/inverseSqrt/b197b1.wgsl.expected.hlsl b/test/tint/builtins/gen/var/inverseSqrt/b197b1.wgsl.expected.hlsl new file mode 100644 index 0000000000..eeeabc5aad --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/b197b1.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void inverseSqrt_b197b1() { + float3 arg_0 = (0.0f).xxx; + float3 res = rsqrt(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + inverseSqrt_b197b1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + inverseSqrt_b197b1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + inverseSqrt_b197b1(); + return; +} diff --git a/test/tint/builtins/gen/var/inverseSqrt/b197b1.wgsl.expected.msl b/test/tint/builtins/gen/var/inverseSqrt/b197b1.wgsl.expected.msl new file mode 100644 index 0000000000..d31ca3b877 --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/b197b1.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void inverseSqrt_b197b1() { + float3 arg_0 = float3(0.0f); + float3 res = rsqrt(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + inverseSqrt_b197b1(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + inverseSqrt_b197b1(); + return; +} + +kernel void compute_main() { + inverseSqrt_b197b1(); + return; +} + diff --git a/test/tint/builtins/gen/var/inverseSqrt/b197b1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/inverseSqrt/b197b1.wgsl.expected.spvasm new file mode 100644 index 0000000000..aac400fe74 --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/b197b1.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %inverseSqrt_b197b1 "inverseSqrt_b197b1" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %14 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%inverseSqrt_b197b1 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %14 + %res = OpVariable %_ptr_Function_v3float Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %v3float %arg_0 + %17 = OpExtInst %v3float %18 InverseSqrt %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %inverseSqrt_b197b1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %inverseSqrt_b197b1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %inverseSqrt_b197b1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/inverseSqrt/b197b1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/inverseSqrt/b197b1.wgsl.expected.wgsl new file mode 100644 index 0000000000..092b101e7c --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/b197b1.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn inverseSqrt_b197b1() { + var arg_0 = vec3(); + var res : vec3 = inverseSqrt(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + inverseSqrt_b197b1(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + inverseSqrt_b197b1(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + inverseSqrt_b197b1(); +} diff --git a/test/tint/builtins/gen/var/inverseSqrt/c22347.wgsl b/test/tint/builtins/gen/var/inverseSqrt/c22347.wgsl new file mode 100644 index 0000000000..9fa254cdcc --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/c22347.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn inverseSqrt(vec<4, f32>) -> vec<4, f32> +fn inverseSqrt_c22347() { + var arg_0 = vec4(); + var res: vec4 = inverseSqrt(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + inverseSqrt_c22347(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + inverseSqrt_c22347(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + inverseSqrt_c22347(); +} diff --git a/test/tint/builtins/gen/var/inverseSqrt/c22347.wgsl.expected.glsl b/test/tint/builtins/gen/var/inverseSqrt/c22347.wgsl.expected.glsl new file mode 100644 index 0000000000..4665d41acf --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/c22347.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void inverseSqrt_c22347() { + vec4 arg_0 = vec4(0.0f); + vec4 res = inversesqrt(arg_0); +} + +vec4 vertex_main() { + inverseSqrt_c22347(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void inverseSqrt_c22347() { + vec4 arg_0 = vec4(0.0f); + vec4 res = inversesqrt(arg_0); +} + +void fragment_main() { + inverseSqrt_c22347(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void inverseSqrt_c22347() { + vec4 arg_0 = vec4(0.0f); + vec4 res = inversesqrt(arg_0); +} + +void compute_main() { + inverseSqrt_c22347(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/inverseSqrt/c22347.wgsl.expected.hlsl b/test/tint/builtins/gen/var/inverseSqrt/c22347.wgsl.expected.hlsl new file mode 100644 index 0000000000..70323e614b --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/c22347.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void inverseSqrt_c22347() { + float4 arg_0 = (0.0f).xxxx; + float4 res = rsqrt(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + inverseSqrt_c22347(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + inverseSqrt_c22347(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + inverseSqrt_c22347(); + return; +} diff --git a/test/tint/builtins/gen/var/inverseSqrt/c22347.wgsl.expected.msl b/test/tint/builtins/gen/var/inverseSqrt/c22347.wgsl.expected.msl new file mode 100644 index 0000000000..01d5eea322 --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/c22347.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void inverseSqrt_c22347() { + float4 arg_0 = float4(0.0f); + float4 res = rsqrt(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + inverseSqrt_c22347(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + inverseSqrt_c22347(); + return; +} + +kernel void compute_main() { + inverseSqrt_c22347(); + return; +} + diff --git a/test/tint/builtins/gen/var/inverseSqrt/c22347.wgsl.expected.spvasm b/test/tint/builtins/gen/var/inverseSqrt/c22347.wgsl.expected.spvasm new file mode 100644 index 0000000000..ed02dc64c7 --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/c22347.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %inverseSqrt_c22347 "inverseSqrt_c22347" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%inverseSqrt_c22347 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %5 + %17 = OpLoad %v4float %arg_0 + %15 = OpExtInst %v4float %16 InverseSqrt %17 + OpStore %res %15 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %inverseSqrt_c22347 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %inverseSqrt_c22347 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %inverseSqrt_c22347 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/inverseSqrt/c22347.wgsl.expected.wgsl b/test/tint/builtins/gen/var/inverseSqrt/c22347.wgsl.expected.wgsl new file mode 100644 index 0000000000..fb2b23a215 --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/c22347.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn inverseSqrt_c22347() { + var arg_0 = vec4(); + var res : vec4 = inverseSqrt(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + inverseSqrt_c22347(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + inverseSqrt_c22347(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + inverseSqrt_c22347(); +} diff --git a/test/tint/builtins/gen/var/ldexp/a31cdc.wgsl b/test/tint/builtins/gen/var/ldexp/a31cdc.wgsl new file mode 100644 index 0000000000..0b2123aeb6 --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/a31cdc.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn ldexp(vec<3, f32>, vec<3, i32>) -> vec<3, f32> +fn ldexp_a31cdc() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var res: vec3 = ldexp(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + ldexp_a31cdc(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + ldexp_a31cdc(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + ldexp_a31cdc(); +} diff --git a/test/tint/builtins/gen/var/ldexp/a31cdc.wgsl.expected.glsl b/test/tint/builtins/gen/var/ldexp/a31cdc.wgsl.expected.glsl new file mode 100644 index 0000000000..6336a2e400 --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/a31cdc.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void ldexp_a31cdc() { + vec3 arg_0 = vec3(0.0f); + ivec3 arg_1 = ivec3(0); + vec3 res = ldexp(arg_0, arg_1); +} + +vec4 vertex_main() { + ldexp_a31cdc(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void ldexp_a31cdc() { + vec3 arg_0 = vec3(0.0f); + ivec3 arg_1 = ivec3(0); + vec3 res = ldexp(arg_0, arg_1); +} + +void fragment_main() { + ldexp_a31cdc(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void ldexp_a31cdc() { + vec3 arg_0 = vec3(0.0f); + ivec3 arg_1 = ivec3(0); + vec3 res = ldexp(arg_0, arg_1); +} + +void compute_main() { + ldexp_a31cdc(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/ldexp/a31cdc.wgsl.expected.hlsl b/test/tint/builtins/gen/var/ldexp/a31cdc.wgsl.expected.hlsl new file mode 100644 index 0000000000..206b643af7 --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/a31cdc.wgsl.expected.hlsl @@ -0,0 +1,32 @@ +void ldexp_a31cdc() { + float3 arg_0 = (0.0f).xxx; + int3 arg_1 = (0).xxx; + float3 res = ldexp(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ldexp_a31cdc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ldexp_a31cdc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ldexp_a31cdc(); + return; +} diff --git a/test/tint/builtins/gen/var/ldexp/a31cdc.wgsl.expected.msl b/test/tint/builtins/gen/var/ldexp/a31cdc.wgsl.expected.msl new file mode 100644 index 0000000000..1d81f5ad3c --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/a31cdc.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void ldexp_a31cdc() { + float3 arg_0 = float3(0.0f); + int3 arg_1 = int3(0); + float3 res = ldexp(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + ldexp_a31cdc(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + ldexp_a31cdc(); + return; +} + +kernel void compute_main() { + ldexp_a31cdc(); + return; +} + diff --git a/test/tint/builtins/gen/var/ldexp/a31cdc.wgsl.expected.spvasm b/test/tint/builtins/gen/var/ldexp/a31cdc.wgsl.expected.spvasm new file mode 100644 index 0000000000..83ab21b295 --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/a31cdc.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + %23 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %ldexp_a31cdc "ldexp_a31cdc" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %14 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %19 = OpConstantNull %v3int +%_ptr_Function_v3int = OpTypePointer Function %v3int + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%ldexp_a31cdc = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %14 + %arg_1 = OpVariable %_ptr_Function_v3int Function %19 + %res = OpVariable %_ptr_Function_v3float Function %14 + OpStore %arg_0 %14 + OpStore %arg_1 %19 + %24 = OpLoad %v3float %arg_0 + %25 = OpLoad %v3int %arg_1 + %22 = OpExtInst %v3float %23 Ldexp %24 %25 + OpStore %res %22 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %ldexp_a31cdc + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %ldexp_a31cdc + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %39 = OpLabel + %40 = OpFunctionCall %void %ldexp_a31cdc + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/ldexp/a31cdc.wgsl.expected.wgsl b/test/tint/builtins/gen/var/ldexp/a31cdc.wgsl.expected.wgsl new file mode 100644 index 0000000000..ff1f93b521 --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/a31cdc.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn ldexp_a31cdc() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var res : vec3 = ldexp(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + ldexp_a31cdc(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + ldexp_a31cdc(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + ldexp_a31cdc(); +} diff --git a/test/tint/builtins/gen/var/ldexp/abd718.wgsl b/test/tint/builtins/gen/var/ldexp/abd718.wgsl new file mode 100644 index 0000000000..fa363d35c7 --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/abd718.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn ldexp(vec<2, f32>, vec<2, i32>) -> vec<2, f32> +fn ldexp_abd718() { + var arg_0 = vec2(); + var arg_1 = vec2(); + var res: vec2 = ldexp(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + ldexp_abd718(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + ldexp_abd718(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + ldexp_abd718(); +} diff --git a/test/tint/builtins/gen/var/ldexp/abd718.wgsl.expected.glsl b/test/tint/builtins/gen/var/ldexp/abd718.wgsl.expected.glsl new file mode 100644 index 0000000000..da03c14d88 --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/abd718.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void ldexp_abd718() { + vec2 arg_0 = vec2(0.0f); + ivec2 arg_1 = ivec2(0); + vec2 res = ldexp(arg_0, arg_1); +} + +vec4 vertex_main() { + ldexp_abd718(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void ldexp_abd718() { + vec2 arg_0 = vec2(0.0f); + ivec2 arg_1 = ivec2(0); + vec2 res = ldexp(arg_0, arg_1); +} + +void fragment_main() { + ldexp_abd718(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void ldexp_abd718() { + vec2 arg_0 = vec2(0.0f); + ivec2 arg_1 = ivec2(0); + vec2 res = ldexp(arg_0, arg_1); +} + +void compute_main() { + ldexp_abd718(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/ldexp/abd718.wgsl.expected.hlsl b/test/tint/builtins/gen/var/ldexp/abd718.wgsl.expected.hlsl new file mode 100644 index 0000000000..5399f52369 --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/abd718.wgsl.expected.hlsl @@ -0,0 +1,32 @@ +void ldexp_abd718() { + float2 arg_0 = (0.0f).xx; + int2 arg_1 = (0).xx; + float2 res = ldexp(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ldexp_abd718(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ldexp_abd718(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ldexp_abd718(); + return; +} diff --git a/test/tint/builtins/gen/var/ldexp/abd718.wgsl.expected.msl b/test/tint/builtins/gen/var/ldexp/abd718.wgsl.expected.msl new file mode 100644 index 0000000000..b924eeb31b --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/abd718.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void ldexp_abd718() { + float2 arg_0 = float2(0.0f); + int2 arg_1 = int2(0); + float2 res = ldexp(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + ldexp_abd718(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + ldexp_abd718(); + return; +} + +kernel void compute_main() { + ldexp_abd718(); + return; +} + diff --git a/test/tint/builtins/gen/var/ldexp/abd718.wgsl.expected.spvasm b/test/tint/builtins/gen/var/ldexp/abd718.wgsl.expected.spvasm new file mode 100644 index 0000000000..168ae695b1 --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/abd718.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + %23 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %ldexp_abd718 "ldexp_abd718" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %14 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %19 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%ldexp_abd718 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %14 + %arg_1 = OpVariable %_ptr_Function_v2int Function %19 + %res = OpVariable %_ptr_Function_v2float Function %14 + OpStore %arg_0 %14 + OpStore %arg_1 %19 + %24 = OpLoad %v2float %arg_0 + %25 = OpLoad %v2int %arg_1 + %22 = OpExtInst %v2float %23 Ldexp %24 %25 + OpStore %res %22 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %ldexp_abd718 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %ldexp_abd718 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %39 = OpLabel + %40 = OpFunctionCall %void %ldexp_abd718 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/ldexp/abd718.wgsl.expected.wgsl b/test/tint/builtins/gen/var/ldexp/abd718.wgsl.expected.wgsl new file mode 100644 index 0000000000..436192c740 --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/abd718.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn ldexp_abd718() { + var arg_0 = vec2(); + var arg_1 = vec2(); + var res : vec2 = ldexp(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + ldexp_abd718(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + ldexp_abd718(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + ldexp_abd718(); +} diff --git a/test/tint/builtins/gen/var/ldexp/cc9cde.wgsl b/test/tint/builtins/gen/var/ldexp/cc9cde.wgsl new file mode 100644 index 0000000000..2f89342685 --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/cc9cde.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn ldexp(vec<4, f32>, vec<4, i32>) -> vec<4, f32> +fn ldexp_cc9cde() { + var arg_0 = vec4(); + var arg_1 = vec4(); + var res: vec4 = ldexp(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + ldexp_cc9cde(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + ldexp_cc9cde(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + ldexp_cc9cde(); +} diff --git a/test/tint/builtins/gen/var/ldexp/cc9cde.wgsl.expected.glsl b/test/tint/builtins/gen/var/ldexp/cc9cde.wgsl.expected.glsl new file mode 100644 index 0000000000..c31b73b860 --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/cc9cde.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void ldexp_cc9cde() { + vec4 arg_0 = vec4(0.0f); + ivec4 arg_1 = ivec4(0); + vec4 res = ldexp(arg_0, arg_1); +} + +vec4 vertex_main() { + ldexp_cc9cde(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void ldexp_cc9cde() { + vec4 arg_0 = vec4(0.0f); + ivec4 arg_1 = ivec4(0); + vec4 res = ldexp(arg_0, arg_1); +} + +void fragment_main() { + ldexp_cc9cde(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void ldexp_cc9cde() { + vec4 arg_0 = vec4(0.0f); + ivec4 arg_1 = ivec4(0); + vec4 res = ldexp(arg_0, arg_1); +} + +void compute_main() { + ldexp_cc9cde(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/ldexp/cc9cde.wgsl.expected.hlsl b/test/tint/builtins/gen/var/ldexp/cc9cde.wgsl.expected.hlsl new file mode 100644 index 0000000000..f92216397d --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/cc9cde.wgsl.expected.hlsl @@ -0,0 +1,32 @@ +void ldexp_cc9cde() { + float4 arg_0 = (0.0f).xxxx; + int4 arg_1 = (0).xxxx; + float4 res = ldexp(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ldexp_cc9cde(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ldexp_cc9cde(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ldexp_cc9cde(); + return; +} diff --git a/test/tint/builtins/gen/var/ldexp/cc9cde.wgsl.expected.msl b/test/tint/builtins/gen/var/ldexp/cc9cde.wgsl.expected.msl new file mode 100644 index 0000000000..93c2d23e89 --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/cc9cde.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void ldexp_cc9cde() { + float4 arg_0 = float4(0.0f); + int4 arg_1 = int4(0); + float4 res = ldexp(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + ldexp_cc9cde(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + ldexp_cc9cde(); + return; +} + +kernel void compute_main() { + ldexp_cc9cde(); + return; +} + diff --git a/test/tint/builtins/gen/var/ldexp/cc9cde.wgsl.expected.spvasm b/test/tint/builtins/gen/var/ldexp/cc9cde.wgsl.expected.spvasm new file mode 100644 index 0000000000..3d6fe28ca6 --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/cc9cde.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + %21 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %ldexp_cc9cde "ldexp_cc9cde" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %17 = OpConstantNull %v4int +%_ptr_Function_v4int = OpTypePointer Function %v4int + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%ldexp_cc9cde = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %arg_1 = OpVariable %_ptr_Function_v4int Function %17 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %5 + OpStore %arg_1 %17 + %22 = OpLoad %v4float %arg_0 + %23 = OpLoad %v4int %arg_1 + %20 = OpExtInst %v4float %21 Ldexp %22 %23 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %ldexp_cc9cde + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %ldexp_cc9cde + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %ldexp_cc9cde + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/ldexp/cc9cde.wgsl.expected.wgsl b/test/tint/builtins/gen/var/ldexp/cc9cde.wgsl.expected.wgsl new file mode 100644 index 0000000000..f24c9704d6 --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/cc9cde.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn ldexp_cc9cde() { + var arg_0 = vec4(); + var arg_1 = vec4(); + var res : vec4 = ldexp(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + ldexp_cc9cde(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + ldexp_cc9cde(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + ldexp_cc9cde(); +} diff --git a/test/tint/builtins/gen/var/ldexp/db8b49.wgsl b/test/tint/builtins/gen/var/ldexp/db8b49.wgsl new file mode 100644 index 0000000000..140cef645a --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/db8b49.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn ldexp(f32, i32) -> f32 +fn ldexp_db8b49() { + var arg_0 = 1.0; + var arg_1 = 1; + var res: f32 = ldexp(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + ldexp_db8b49(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + ldexp_db8b49(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + ldexp_db8b49(); +} diff --git a/test/tint/builtins/gen/var/ldexp/db8b49.wgsl.expected.glsl b/test/tint/builtins/gen/var/ldexp/db8b49.wgsl.expected.glsl new file mode 100644 index 0000000000..72e097224d --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/db8b49.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void ldexp_db8b49() { + float arg_0 = 1.0f; + int arg_1 = 1; + float res = ldexp(arg_0, arg_1); +} + +vec4 vertex_main() { + ldexp_db8b49(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void ldexp_db8b49() { + float arg_0 = 1.0f; + int arg_1 = 1; + float res = ldexp(arg_0, arg_1); +} + +void fragment_main() { + ldexp_db8b49(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void ldexp_db8b49() { + float arg_0 = 1.0f; + int arg_1 = 1; + float res = ldexp(arg_0, arg_1); +} + +void compute_main() { + ldexp_db8b49(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/ldexp/db8b49.wgsl.expected.hlsl b/test/tint/builtins/gen/var/ldexp/db8b49.wgsl.expected.hlsl new file mode 100644 index 0000000000..9f6253185a --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/db8b49.wgsl.expected.hlsl @@ -0,0 +1,32 @@ +void ldexp_db8b49() { + float arg_0 = 1.0f; + int arg_1 = 1; + float res = ldexp(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ldexp_db8b49(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ldexp_db8b49(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ldexp_db8b49(); + return; +} diff --git a/test/tint/builtins/gen/var/ldexp/db8b49.wgsl.expected.msl b/test/tint/builtins/gen/var/ldexp/db8b49.wgsl.expected.msl new file mode 100644 index 0000000000..e980316da9 --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/db8b49.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void ldexp_db8b49() { + float arg_0 = 1.0f; + int arg_1 = 1; + float res = ldexp(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + ldexp_db8b49(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + ldexp_db8b49(); + return; +} + +kernel void compute_main() { + ldexp_db8b49(); + return; +} + diff --git a/test/tint/builtins/gen/var/ldexp/db8b49.wgsl.expected.spvasm b/test/tint/builtins/gen/var/ldexp/db8b49.wgsl.expected.spvasm new file mode 100644 index 0000000000..0a22486b7b --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/db8b49.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + %22 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %ldexp_db8b49 "ldexp_db8b49" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %20 = OpConstantNull %int + %26 = OpTypeFunction %v4float +%ldexp_db8b49 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %arg_1 = OpVariable %_ptr_Function_int Function %20 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + OpStore %arg_1 %int_1 + %23 = OpLoad %float %arg_0 + %24 = OpLoad %int %arg_1 + %21 = OpExtInst %float %22 Ldexp %23 %24 + OpStore %res %21 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %ldexp_db8b49 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %ldexp_db8b49 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %ldexp_db8b49 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/ldexp/db8b49.wgsl.expected.wgsl b/test/tint/builtins/gen/var/ldexp/db8b49.wgsl.expected.wgsl new file mode 100644 index 0000000000..764a162271 --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/db8b49.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn ldexp_db8b49() { + var arg_0 = 1.0; + var arg_1 = 1; + var res : f32 = ldexp(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + ldexp_db8b49(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + ldexp_db8b49(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + ldexp_db8b49(); +} diff --git a/test/tint/builtins/gen/var/length/056071.wgsl b/test/tint/builtins/gen/var/length/056071.wgsl new file mode 100644 index 0000000000..683f51183f --- /dev/null +++ b/test/tint/builtins/gen/var/length/056071.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn length(vec<3, f32>) -> f32 +fn length_056071() { + var arg_0 = vec3(); + var res: f32 = length(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + length_056071(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + length_056071(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + length_056071(); +} diff --git a/test/tint/builtins/gen/var/length/056071.wgsl.expected.glsl b/test/tint/builtins/gen/var/length/056071.wgsl.expected.glsl new file mode 100644 index 0000000000..f4f3920de8 --- /dev/null +++ b/test/tint/builtins/gen/var/length/056071.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void length_056071() { + vec3 arg_0 = vec3(0.0f); + float res = length(arg_0); +} + +vec4 vertex_main() { + length_056071(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void length_056071() { + vec3 arg_0 = vec3(0.0f); + float res = length(arg_0); +} + +void fragment_main() { + length_056071(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void length_056071() { + vec3 arg_0 = vec3(0.0f); + float res = length(arg_0); +} + +void compute_main() { + length_056071(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/length/056071.wgsl.expected.hlsl b/test/tint/builtins/gen/var/length/056071.wgsl.expected.hlsl new file mode 100644 index 0000000000..bd540fbe8b --- /dev/null +++ b/test/tint/builtins/gen/var/length/056071.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void length_056071() { + float3 arg_0 = (0.0f).xxx; + float res = length(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + length_056071(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + length_056071(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + length_056071(); + return; +} diff --git a/test/tint/builtins/gen/var/length/056071.wgsl.expected.msl b/test/tint/builtins/gen/var/length/056071.wgsl.expected.msl new file mode 100644 index 0000000000..1727b62ba1 --- /dev/null +++ b/test/tint/builtins/gen/var/length/056071.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void length_056071() { + float3 arg_0 = float3(0.0f); + float res = length(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + length_056071(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + length_056071(); + return; +} + +kernel void compute_main() { + length_056071(); + return; +} + diff --git a/test/tint/builtins/gen/var/length/056071.wgsl.expected.spvasm b/test/tint/builtins/gen/var/length/056071.wgsl.expected.spvasm new file mode 100644 index 0000000000..fb485c717e --- /dev/null +++ b/test/tint/builtins/gen/var/length/056071.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %length_056071 "length_056071" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %14 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float +%_ptr_Function_float = OpTypePointer Function %float + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%length_056071 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %14 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %14 + %19 = OpLoad %v3float %arg_0 + %17 = OpExtInst %float %18 Length %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %length_056071 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %length_056071 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %length_056071 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/length/056071.wgsl.expected.wgsl b/test/tint/builtins/gen/var/length/056071.wgsl.expected.wgsl new file mode 100644 index 0000000000..162ff85109 --- /dev/null +++ b/test/tint/builtins/gen/var/length/056071.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn length_056071() { + var arg_0 = vec3(); + var res : f32 = length(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + length_056071(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + length_056071(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + length_056071(); +} diff --git a/test/tint/builtins/gen/var/length/602a17.wgsl b/test/tint/builtins/gen/var/length/602a17.wgsl new file mode 100644 index 0000000000..6460b7cffb --- /dev/null +++ b/test/tint/builtins/gen/var/length/602a17.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn length(f32) -> f32 +fn length_602a17() { + var arg_0 = 1.0; + var res: f32 = length(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + length_602a17(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + length_602a17(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + length_602a17(); +} diff --git a/test/tint/builtins/gen/var/length/602a17.wgsl.expected.glsl b/test/tint/builtins/gen/var/length/602a17.wgsl.expected.glsl new file mode 100644 index 0000000000..41ad408b51 --- /dev/null +++ b/test/tint/builtins/gen/var/length/602a17.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void length_602a17() { + float arg_0 = 1.0f; + float res = length(arg_0); +} + +vec4 vertex_main() { + length_602a17(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void length_602a17() { + float arg_0 = 1.0f; + float res = length(arg_0); +} + +void fragment_main() { + length_602a17(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void length_602a17() { + float arg_0 = 1.0f; + float res = length(arg_0); +} + +void compute_main() { + length_602a17(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/length/602a17.wgsl.expected.hlsl b/test/tint/builtins/gen/var/length/602a17.wgsl.expected.hlsl new file mode 100644 index 0000000000..5f4310e82c --- /dev/null +++ b/test/tint/builtins/gen/var/length/602a17.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void length_602a17() { + float arg_0 = 1.0f; + float res = length(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + length_602a17(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + length_602a17(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + length_602a17(); + return; +} diff --git a/test/tint/builtins/gen/var/length/602a17.wgsl.expected.msl b/test/tint/builtins/gen/var/length/602a17.wgsl.expected.msl new file mode 100644 index 0000000000..a88e9edc14 --- /dev/null +++ b/test/tint/builtins/gen/var/length/602a17.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void length_602a17() { + float arg_0 = 1.0f; + float res = fabs(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + length_602a17(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + length_602a17(); + return; +} + +kernel void compute_main() { + length_602a17(); + return; +} + diff --git a/test/tint/builtins/gen/var/length/602a17.wgsl.expected.spvasm b/test/tint/builtins/gen/var/length/602a17.wgsl.expected.spvasm new file mode 100644 index 0000000000..7d99bccc7d --- /dev/null +++ b/test/tint/builtins/gen/var/length/602a17.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %length_602a17 "length_602a17" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %20 = OpTypeFunction %v4float +%length_602a17 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + %18 = OpLoad %float %arg_0 + %16 = OpExtInst %float %17 Length %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %length_602a17 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %length_602a17 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %length_602a17 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/length/602a17.wgsl.expected.wgsl b/test/tint/builtins/gen/var/length/602a17.wgsl.expected.wgsl new file mode 100644 index 0000000000..ad417980cc --- /dev/null +++ b/test/tint/builtins/gen/var/length/602a17.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn length_602a17() { + var arg_0 = 1.0; + var res : f32 = length(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + length_602a17(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + length_602a17(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + length_602a17(); +} diff --git a/test/tint/builtins/gen/var/length/afde8b.wgsl b/test/tint/builtins/gen/var/length/afde8b.wgsl new file mode 100644 index 0000000000..ec97606990 --- /dev/null +++ b/test/tint/builtins/gen/var/length/afde8b.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn length(vec<2, f32>) -> f32 +fn length_afde8b() { + var arg_0 = vec2(); + var res: f32 = length(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + length_afde8b(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + length_afde8b(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + length_afde8b(); +} diff --git a/test/tint/builtins/gen/var/length/afde8b.wgsl.expected.glsl b/test/tint/builtins/gen/var/length/afde8b.wgsl.expected.glsl new file mode 100644 index 0000000000..bee88075b8 --- /dev/null +++ b/test/tint/builtins/gen/var/length/afde8b.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void length_afde8b() { + vec2 arg_0 = vec2(0.0f); + float res = length(arg_0); +} + +vec4 vertex_main() { + length_afde8b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void length_afde8b() { + vec2 arg_0 = vec2(0.0f); + float res = length(arg_0); +} + +void fragment_main() { + length_afde8b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void length_afde8b() { + vec2 arg_0 = vec2(0.0f); + float res = length(arg_0); +} + +void compute_main() { + length_afde8b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/length/afde8b.wgsl.expected.hlsl b/test/tint/builtins/gen/var/length/afde8b.wgsl.expected.hlsl new file mode 100644 index 0000000000..f1ca92a377 --- /dev/null +++ b/test/tint/builtins/gen/var/length/afde8b.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void length_afde8b() { + float2 arg_0 = (0.0f).xx; + float res = length(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + length_afde8b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + length_afde8b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + length_afde8b(); + return; +} diff --git a/test/tint/builtins/gen/var/length/afde8b.wgsl.expected.msl b/test/tint/builtins/gen/var/length/afde8b.wgsl.expected.msl new file mode 100644 index 0000000000..ebda0cbf81 --- /dev/null +++ b/test/tint/builtins/gen/var/length/afde8b.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void length_afde8b() { + float2 arg_0 = float2(0.0f); + float res = length(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + length_afde8b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + length_afde8b(); + return; +} + +kernel void compute_main() { + length_afde8b(); + return; +} + diff --git a/test/tint/builtins/gen/var/length/afde8b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/length/afde8b.wgsl.expected.spvasm new file mode 100644 index 0000000000..975439ced2 --- /dev/null +++ b/test/tint/builtins/gen/var/length/afde8b.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %length_afde8b "length_afde8b" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %14 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float +%_ptr_Function_float = OpTypePointer Function %float + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%length_afde8b = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %14 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %14 + %19 = OpLoad %v2float %arg_0 + %17 = OpExtInst %float %18 Length %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %length_afde8b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %length_afde8b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %length_afde8b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/length/afde8b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/length/afde8b.wgsl.expected.wgsl new file mode 100644 index 0000000000..64f028dc44 --- /dev/null +++ b/test/tint/builtins/gen/var/length/afde8b.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn length_afde8b() { + var arg_0 = vec2(); + var res : f32 = length(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + length_afde8b(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + length_afde8b(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + length_afde8b(); +} diff --git a/test/tint/builtins/gen/var/length/becebf.wgsl b/test/tint/builtins/gen/var/length/becebf.wgsl new file mode 100644 index 0000000000..0eb0b9d2fa --- /dev/null +++ b/test/tint/builtins/gen/var/length/becebf.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn length(vec<4, f32>) -> f32 +fn length_becebf() { + var arg_0 = vec4(); + var res: f32 = length(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + length_becebf(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + length_becebf(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + length_becebf(); +} diff --git a/test/tint/builtins/gen/var/length/becebf.wgsl.expected.glsl b/test/tint/builtins/gen/var/length/becebf.wgsl.expected.glsl new file mode 100644 index 0000000000..a87cbf7abb --- /dev/null +++ b/test/tint/builtins/gen/var/length/becebf.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void length_becebf() { + vec4 arg_0 = vec4(0.0f); + float res = length(arg_0); +} + +vec4 vertex_main() { + length_becebf(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void length_becebf() { + vec4 arg_0 = vec4(0.0f); + float res = length(arg_0); +} + +void fragment_main() { + length_becebf(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void length_becebf() { + vec4 arg_0 = vec4(0.0f); + float res = length(arg_0); +} + +void compute_main() { + length_becebf(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/length/becebf.wgsl.expected.hlsl b/test/tint/builtins/gen/var/length/becebf.wgsl.expected.hlsl new file mode 100644 index 0000000000..e7760dd8e9 --- /dev/null +++ b/test/tint/builtins/gen/var/length/becebf.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void length_becebf() { + float4 arg_0 = (0.0f).xxxx; + float res = length(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + length_becebf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + length_becebf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + length_becebf(); + return; +} diff --git a/test/tint/builtins/gen/var/length/becebf.wgsl.expected.msl b/test/tint/builtins/gen/var/length/becebf.wgsl.expected.msl new file mode 100644 index 0000000000..6909b069f9 --- /dev/null +++ b/test/tint/builtins/gen/var/length/becebf.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void length_becebf() { + float4 arg_0 = float4(0.0f); + float res = length(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + length_becebf(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + length_becebf(); + return; +} + +kernel void compute_main() { + length_becebf(); + return; +} + diff --git a/test/tint/builtins/gen/var/length/becebf.wgsl.expected.spvasm b/test/tint/builtins/gen/var/length/becebf.wgsl.expected.spvasm new file mode 100644 index 0000000000..4162c69dda --- /dev/null +++ b/test/tint/builtins/gen/var/length/becebf.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %length_becebf "length_becebf" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Function_float = OpTypePointer Function %float + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%length_becebf = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %5 + %17 = OpLoad %v4float %arg_0 + %15 = OpExtInst %float %16 Length %17 + OpStore %res %15 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %length_becebf + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %length_becebf + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %length_becebf + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/length/becebf.wgsl.expected.wgsl b/test/tint/builtins/gen/var/length/becebf.wgsl.expected.wgsl new file mode 100644 index 0000000000..c2b2472b69 --- /dev/null +++ b/test/tint/builtins/gen/var/length/becebf.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn length_becebf() { + var arg_0 = vec4(); + var res : f32 = length(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + length_becebf(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + length_becebf(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + length_becebf(); +} diff --git a/test/tint/builtins/gen/var/log/3da25a.wgsl b/test/tint/builtins/gen/var/log/3da25a.wgsl new file mode 100644 index 0000000000..46e2e0e99f --- /dev/null +++ b/test/tint/builtins/gen/var/log/3da25a.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn log(vec<4, f32>) -> vec<4, f32> +fn log_3da25a() { + var arg_0 = vec4(); + var res: vec4 = log(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + log_3da25a(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + log_3da25a(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + log_3da25a(); +} diff --git a/test/tint/builtins/gen/var/log/3da25a.wgsl.expected.glsl b/test/tint/builtins/gen/var/log/3da25a.wgsl.expected.glsl new file mode 100644 index 0000000000..8588b4e837 --- /dev/null +++ b/test/tint/builtins/gen/var/log/3da25a.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void log_3da25a() { + vec4 arg_0 = vec4(0.0f); + vec4 res = log(arg_0); +} + +vec4 vertex_main() { + log_3da25a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void log_3da25a() { + vec4 arg_0 = vec4(0.0f); + vec4 res = log(arg_0); +} + +void fragment_main() { + log_3da25a(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void log_3da25a() { + vec4 arg_0 = vec4(0.0f); + vec4 res = log(arg_0); +} + +void compute_main() { + log_3da25a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/log/3da25a.wgsl.expected.hlsl b/test/tint/builtins/gen/var/log/3da25a.wgsl.expected.hlsl new file mode 100644 index 0000000000..59f09490ce --- /dev/null +++ b/test/tint/builtins/gen/var/log/3da25a.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void log_3da25a() { + float4 arg_0 = (0.0f).xxxx; + float4 res = log(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log_3da25a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log_3da25a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log_3da25a(); + return; +} diff --git a/test/tint/builtins/gen/var/log/3da25a.wgsl.expected.msl b/test/tint/builtins/gen/var/log/3da25a.wgsl.expected.msl new file mode 100644 index 0000000000..f075d853a3 --- /dev/null +++ b/test/tint/builtins/gen/var/log/3da25a.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void log_3da25a() { + float4 arg_0 = float4(0.0f); + float4 res = log(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + log_3da25a(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + log_3da25a(); + return; +} + +kernel void compute_main() { + log_3da25a(); + return; +} + diff --git a/test/tint/builtins/gen/var/log/3da25a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/log/3da25a.wgsl.expected.spvasm new file mode 100644 index 0000000000..083d12a5d2 --- /dev/null +++ b/test/tint/builtins/gen/var/log/3da25a.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %log_3da25a "log_3da25a" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %log_3da25a = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %5 + %17 = OpLoad %v4float %arg_0 + %15 = OpExtInst %v4float %16 Log %17 + OpStore %res %15 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %log_3da25a + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %log_3da25a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %log_3da25a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/log/3da25a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/log/3da25a.wgsl.expected.wgsl new file mode 100644 index 0000000000..c4e07fb7bb --- /dev/null +++ b/test/tint/builtins/gen/var/log/3da25a.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn log_3da25a() { + var arg_0 = vec4(); + var res : vec4 = log(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + log_3da25a(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + log_3da25a(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + log_3da25a(); +} diff --git a/test/tint/builtins/gen/var/log/7114a6.wgsl b/test/tint/builtins/gen/var/log/7114a6.wgsl new file mode 100644 index 0000000000..6acd3f47ca --- /dev/null +++ b/test/tint/builtins/gen/var/log/7114a6.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn log(f32) -> f32 +fn log_7114a6() { + var arg_0 = 1.0; + var res: f32 = log(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + log_7114a6(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + log_7114a6(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + log_7114a6(); +} diff --git a/test/tint/builtins/gen/var/log/7114a6.wgsl.expected.glsl b/test/tint/builtins/gen/var/log/7114a6.wgsl.expected.glsl new file mode 100644 index 0000000000..cac97bfadc --- /dev/null +++ b/test/tint/builtins/gen/var/log/7114a6.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void log_7114a6() { + float arg_0 = 1.0f; + float res = log(arg_0); +} + +vec4 vertex_main() { + log_7114a6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void log_7114a6() { + float arg_0 = 1.0f; + float res = log(arg_0); +} + +void fragment_main() { + log_7114a6(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void log_7114a6() { + float arg_0 = 1.0f; + float res = log(arg_0); +} + +void compute_main() { + log_7114a6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/log/7114a6.wgsl.expected.hlsl b/test/tint/builtins/gen/var/log/7114a6.wgsl.expected.hlsl new file mode 100644 index 0000000000..c908d84b77 --- /dev/null +++ b/test/tint/builtins/gen/var/log/7114a6.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void log_7114a6() { + float arg_0 = 1.0f; + float res = log(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log_7114a6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log_7114a6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log_7114a6(); + return; +} diff --git a/test/tint/builtins/gen/var/log/7114a6.wgsl.expected.msl b/test/tint/builtins/gen/var/log/7114a6.wgsl.expected.msl new file mode 100644 index 0000000000..65aab32acb --- /dev/null +++ b/test/tint/builtins/gen/var/log/7114a6.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void log_7114a6() { + float arg_0 = 1.0f; + float res = log(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + log_7114a6(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + log_7114a6(); + return; +} + +kernel void compute_main() { + log_7114a6(); + return; +} + diff --git a/test/tint/builtins/gen/var/log/7114a6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/log/7114a6.wgsl.expected.spvasm new file mode 100644 index 0000000000..0fab51b979 --- /dev/null +++ b/test/tint/builtins/gen/var/log/7114a6.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %log_7114a6 "log_7114a6" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %20 = OpTypeFunction %v4float + %log_7114a6 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + %18 = OpLoad %float %arg_0 + %16 = OpExtInst %float %17 Log %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %log_7114a6 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %log_7114a6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %log_7114a6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/log/7114a6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/log/7114a6.wgsl.expected.wgsl new file mode 100644 index 0000000000..1c4a1c0326 --- /dev/null +++ b/test/tint/builtins/gen/var/log/7114a6.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn log_7114a6() { + var arg_0 = 1.0; + var res : f32 = log(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + log_7114a6(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + log_7114a6(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + log_7114a6(); +} diff --git a/test/tint/builtins/gen/var/log/b2ce28.wgsl b/test/tint/builtins/gen/var/log/b2ce28.wgsl new file mode 100644 index 0000000000..429c198fae --- /dev/null +++ b/test/tint/builtins/gen/var/log/b2ce28.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn log(vec<2, f32>) -> vec<2, f32> +fn log_b2ce28() { + var arg_0 = vec2(); + var res: vec2 = log(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + log_b2ce28(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + log_b2ce28(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + log_b2ce28(); +} diff --git a/test/tint/builtins/gen/var/log/b2ce28.wgsl.expected.glsl b/test/tint/builtins/gen/var/log/b2ce28.wgsl.expected.glsl new file mode 100644 index 0000000000..b8a85ea7b8 --- /dev/null +++ b/test/tint/builtins/gen/var/log/b2ce28.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void log_b2ce28() { + vec2 arg_0 = vec2(0.0f); + vec2 res = log(arg_0); +} + +vec4 vertex_main() { + log_b2ce28(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void log_b2ce28() { + vec2 arg_0 = vec2(0.0f); + vec2 res = log(arg_0); +} + +void fragment_main() { + log_b2ce28(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void log_b2ce28() { + vec2 arg_0 = vec2(0.0f); + vec2 res = log(arg_0); +} + +void compute_main() { + log_b2ce28(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/log/b2ce28.wgsl.expected.hlsl b/test/tint/builtins/gen/var/log/b2ce28.wgsl.expected.hlsl new file mode 100644 index 0000000000..26a04acde1 --- /dev/null +++ b/test/tint/builtins/gen/var/log/b2ce28.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void log_b2ce28() { + float2 arg_0 = (0.0f).xx; + float2 res = log(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log_b2ce28(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log_b2ce28(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log_b2ce28(); + return; +} diff --git a/test/tint/builtins/gen/var/log/b2ce28.wgsl.expected.msl b/test/tint/builtins/gen/var/log/b2ce28.wgsl.expected.msl new file mode 100644 index 0000000000..919026debd --- /dev/null +++ b/test/tint/builtins/gen/var/log/b2ce28.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void log_b2ce28() { + float2 arg_0 = float2(0.0f); + float2 res = log(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + log_b2ce28(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + log_b2ce28(); + return; +} + +kernel void compute_main() { + log_b2ce28(); + return; +} + diff --git a/test/tint/builtins/gen/var/log/b2ce28.wgsl.expected.spvasm b/test/tint/builtins/gen/var/log/b2ce28.wgsl.expected.spvasm new file mode 100644 index 0000000000..3589004d29 --- /dev/null +++ b/test/tint/builtins/gen/var/log/b2ce28.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %log_b2ce28 "log_b2ce28" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %14 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %log_b2ce28 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %14 + %res = OpVariable %_ptr_Function_v2float Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %v2float %arg_0 + %17 = OpExtInst %v2float %18 Log %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %log_b2ce28 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %log_b2ce28 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %log_b2ce28 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/log/b2ce28.wgsl.expected.wgsl b/test/tint/builtins/gen/var/log/b2ce28.wgsl.expected.wgsl new file mode 100644 index 0000000000..9a3b8f75b2 --- /dev/null +++ b/test/tint/builtins/gen/var/log/b2ce28.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn log_b2ce28() { + var arg_0 = vec2(); + var res : vec2 = log(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + log_b2ce28(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + log_b2ce28(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + log_b2ce28(); +} diff --git a/test/tint/builtins/gen/var/log/f4c570.wgsl b/test/tint/builtins/gen/var/log/f4c570.wgsl new file mode 100644 index 0000000000..825c83349e --- /dev/null +++ b/test/tint/builtins/gen/var/log/f4c570.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn log(vec<3, f32>) -> vec<3, f32> +fn log_f4c570() { + var arg_0 = vec3(); + var res: vec3 = log(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + log_f4c570(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + log_f4c570(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + log_f4c570(); +} diff --git a/test/tint/builtins/gen/var/log/f4c570.wgsl.expected.glsl b/test/tint/builtins/gen/var/log/f4c570.wgsl.expected.glsl new file mode 100644 index 0000000000..e6be403ce7 --- /dev/null +++ b/test/tint/builtins/gen/var/log/f4c570.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void log_f4c570() { + vec3 arg_0 = vec3(0.0f); + vec3 res = log(arg_0); +} + +vec4 vertex_main() { + log_f4c570(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void log_f4c570() { + vec3 arg_0 = vec3(0.0f); + vec3 res = log(arg_0); +} + +void fragment_main() { + log_f4c570(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void log_f4c570() { + vec3 arg_0 = vec3(0.0f); + vec3 res = log(arg_0); +} + +void compute_main() { + log_f4c570(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/log/f4c570.wgsl.expected.hlsl b/test/tint/builtins/gen/var/log/f4c570.wgsl.expected.hlsl new file mode 100644 index 0000000000..27514fe9fa --- /dev/null +++ b/test/tint/builtins/gen/var/log/f4c570.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void log_f4c570() { + float3 arg_0 = (0.0f).xxx; + float3 res = log(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log_f4c570(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log_f4c570(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log_f4c570(); + return; +} diff --git a/test/tint/builtins/gen/var/log/f4c570.wgsl.expected.msl b/test/tint/builtins/gen/var/log/f4c570.wgsl.expected.msl new file mode 100644 index 0000000000..8afbab093d --- /dev/null +++ b/test/tint/builtins/gen/var/log/f4c570.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void log_f4c570() { + float3 arg_0 = float3(0.0f); + float3 res = log(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + log_f4c570(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + log_f4c570(); + return; +} + +kernel void compute_main() { + log_f4c570(); + return; +} + diff --git a/test/tint/builtins/gen/var/log/f4c570.wgsl.expected.spvasm b/test/tint/builtins/gen/var/log/f4c570.wgsl.expected.spvasm new file mode 100644 index 0000000000..3b43543dca --- /dev/null +++ b/test/tint/builtins/gen/var/log/f4c570.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %log_f4c570 "log_f4c570" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %14 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %log_f4c570 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %14 + %res = OpVariable %_ptr_Function_v3float Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %v3float %arg_0 + %17 = OpExtInst %v3float %18 Log %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %log_f4c570 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %log_f4c570 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %log_f4c570 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/log/f4c570.wgsl.expected.wgsl b/test/tint/builtins/gen/var/log/f4c570.wgsl.expected.wgsl new file mode 100644 index 0000000000..a7b9513648 --- /dev/null +++ b/test/tint/builtins/gen/var/log/f4c570.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn log_f4c570() { + var arg_0 = vec3(); + var res : vec3 = log(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + log_f4c570(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + log_f4c570(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + log_f4c570(); +} diff --git a/test/tint/builtins/gen/var/log2/4036ed.wgsl b/test/tint/builtins/gen/var/log2/4036ed.wgsl new file mode 100644 index 0000000000..b002ff5a1f --- /dev/null +++ b/test/tint/builtins/gen/var/log2/4036ed.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn log2(f32) -> f32 +fn log2_4036ed() { + var arg_0 = 1.0; + var res: f32 = log2(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + log2_4036ed(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + log2_4036ed(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + log2_4036ed(); +} diff --git a/test/tint/builtins/gen/var/log2/4036ed.wgsl.expected.glsl b/test/tint/builtins/gen/var/log2/4036ed.wgsl.expected.glsl new file mode 100644 index 0000000000..dbd9a481c2 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/4036ed.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void log2_4036ed() { + float arg_0 = 1.0f; + float res = log2(arg_0); +} + +vec4 vertex_main() { + log2_4036ed(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void log2_4036ed() { + float arg_0 = 1.0f; + float res = log2(arg_0); +} + +void fragment_main() { + log2_4036ed(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void log2_4036ed() { + float arg_0 = 1.0f; + float res = log2(arg_0); +} + +void compute_main() { + log2_4036ed(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/log2/4036ed.wgsl.expected.hlsl b/test/tint/builtins/gen/var/log2/4036ed.wgsl.expected.hlsl new file mode 100644 index 0000000000..bc9a7c4e4e --- /dev/null +++ b/test/tint/builtins/gen/var/log2/4036ed.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void log2_4036ed() { + float arg_0 = 1.0f; + float res = log2(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log2_4036ed(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log2_4036ed(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log2_4036ed(); + return; +} diff --git a/test/tint/builtins/gen/var/log2/4036ed.wgsl.expected.msl b/test/tint/builtins/gen/var/log2/4036ed.wgsl.expected.msl new file mode 100644 index 0000000000..d21766d9d5 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/4036ed.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void log2_4036ed() { + float arg_0 = 1.0f; + float res = log2(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + log2_4036ed(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + log2_4036ed(); + return; +} + +kernel void compute_main() { + log2_4036ed(); + return; +} + diff --git a/test/tint/builtins/gen/var/log2/4036ed.wgsl.expected.spvasm b/test/tint/builtins/gen/var/log2/4036ed.wgsl.expected.spvasm new file mode 100644 index 0000000000..14887a7014 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/4036ed.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %log2_4036ed "log2_4036ed" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %20 = OpTypeFunction %v4float +%log2_4036ed = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + %18 = OpLoad %float %arg_0 + %16 = OpExtInst %float %17 Log2 %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %log2_4036ed + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %log2_4036ed + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %log2_4036ed + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/log2/4036ed.wgsl.expected.wgsl b/test/tint/builtins/gen/var/log2/4036ed.wgsl.expected.wgsl new file mode 100644 index 0000000000..5baca8b6b5 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/4036ed.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn log2_4036ed() { + var arg_0 = 1.0; + var res : f32 = log2(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + log2_4036ed(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + log2_4036ed(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + log2_4036ed(); +} diff --git a/test/tint/builtins/gen/var/log2/902988.wgsl b/test/tint/builtins/gen/var/log2/902988.wgsl new file mode 100644 index 0000000000..a0a4f8eb8a --- /dev/null +++ b/test/tint/builtins/gen/var/log2/902988.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn log2(vec<4, f32>) -> vec<4, f32> +fn log2_902988() { + var arg_0 = vec4(); + var res: vec4 = log2(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + log2_902988(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + log2_902988(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + log2_902988(); +} diff --git a/test/tint/builtins/gen/var/log2/902988.wgsl.expected.glsl b/test/tint/builtins/gen/var/log2/902988.wgsl.expected.glsl new file mode 100644 index 0000000000..32ef3ecc1f --- /dev/null +++ b/test/tint/builtins/gen/var/log2/902988.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void log2_902988() { + vec4 arg_0 = vec4(0.0f); + vec4 res = log2(arg_0); +} + +vec4 vertex_main() { + log2_902988(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void log2_902988() { + vec4 arg_0 = vec4(0.0f); + vec4 res = log2(arg_0); +} + +void fragment_main() { + log2_902988(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void log2_902988() { + vec4 arg_0 = vec4(0.0f); + vec4 res = log2(arg_0); +} + +void compute_main() { + log2_902988(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/log2/902988.wgsl.expected.hlsl b/test/tint/builtins/gen/var/log2/902988.wgsl.expected.hlsl new file mode 100644 index 0000000000..f4564a3262 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/902988.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void log2_902988() { + float4 arg_0 = (0.0f).xxxx; + float4 res = log2(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log2_902988(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log2_902988(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log2_902988(); + return; +} diff --git a/test/tint/builtins/gen/var/log2/902988.wgsl.expected.msl b/test/tint/builtins/gen/var/log2/902988.wgsl.expected.msl new file mode 100644 index 0000000000..b24d5d012c --- /dev/null +++ b/test/tint/builtins/gen/var/log2/902988.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void log2_902988() { + float4 arg_0 = float4(0.0f); + float4 res = log2(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + log2_902988(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + log2_902988(); + return; +} + +kernel void compute_main() { + log2_902988(); + return; +} + diff --git a/test/tint/builtins/gen/var/log2/902988.wgsl.expected.spvasm b/test/tint/builtins/gen/var/log2/902988.wgsl.expected.spvasm new file mode 100644 index 0000000000..6cc4c9baa5 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/902988.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %log2_902988 "log2_902988" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%log2_902988 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %5 + %17 = OpLoad %v4float %arg_0 + %15 = OpExtInst %v4float %16 Log2 %17 + OpStore %res %15 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %log2_902988 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %log2_902988 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %log2_902988 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/log2/902988.wgsl.expected.wgsl b/test/tint/builtins/gen/var/log2/902988.wgsl.expected.wgsl new file mode 100644 index 0000000000..cdc40ad701 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/902988.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn log2_902988() { + var arg_0 = vec4(); + var res : vec4 = log2(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + log2_902988(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + log2_902988(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + log2_902988(); +} diff --git a/test/tint/builtins/gen/var/log2/adb233.wgsl b/test/tint/builtins/gen/var/log2/adb233.wgsl new file mode 100644 index 0000000000..bbf9c83551 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/adb233.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn log2(vec<3, f32>) -> vec<3, f32> +fn log2_adb233() { + var arg_0 = vec3(); + var res: vec3 = log2(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + log2_adb233(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + log2_adb233(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + log2_adb233(); +} diff --git a/test/tint/builtins/gen/var/log2/adb233.wgsl.expected.glsl b/test/tint/builtins/gen/var/log2/adb233.wgsl.expected.glsl new file mode 100644 index 0000000000..e418bf1663 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/adb233.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void log2_adb233() { + vec3 arg_0 = vec3(0.0f); + vec3 res = log2(arg_0); +} + +vec4 vertex_main() { + log2_adb233(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void log2_adb233() { + vec3 arg_0 = vec3(0.0f); + vec3 res = log2(arg_0); +} + +void fragment_main() { + log2_adb233(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void log2_adb233() { + vec3 arg_0 = vec3(0.0f); + vec3 res = log2(arg_0); +} + +void compute_main() { + log2_adb233(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/log2/adb233.wgsl.expected.hlsl b/test/tint/builtins/gen/var/log2/adb233.wgsl.expected.hlsl new file mode 100644 index 0000000000..16c4b43836 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/adb233.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void log2_adb233() { + float3 arg_0 = (0.0f).xxx; + float3 res = log2(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log2_adb233(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log2_adb233(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log2_adb233(); + return; +} diff --git a/test/tint/builtins/gen/var/log2/adb233.wgsl.expected.msl b/test/tint/builtins/gen/var/log2/adb233.wgsl.expected.msl new file mode 100644 index 0000000000..f6e89e1937 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/adb233.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void log2_adb233() { + float3 arg_0 = float3(0.0f); + float3 res = log2(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + log2_adb233(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + log2_adb233(); + return; +} + +kernel void compute_main() { + log2_adb233(); + return; +} + diff --git a/test/tint/builtins/gen/var/log2/adb233.wgsl.expected.spvasm b/test/tint/builtins/gen/var/log2/adb233.wgsl.expected.spvasm new file mode 100644 index 0000000000..7ddd436cbd --- /dev/null +++ b/test/tint/builtins/gen/var/log2/adb233.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %log2_adb233 "log2_adb233" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %14 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%log2_adb233 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %14 + %res = OpVariable %_ptr_Function_v3float Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %v3float %arg_0 + %17 = OpExtInst %v3float %18 Log2 %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %log2_adb233 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %log2_adb233 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %log2_adb233 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/log2/adb233.wgsl.expected.wgsl b/test/tint/builtins/gen/var/log2/adb233.wgsl.expected.wgsl new file mode 100644 index 0000000000..23a4b3f2b7 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/adb233.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn log2_adb233() { + var arg_0 = vec3(); + var res : vec3 = log2(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + log2_adb233(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + log2_adb233(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + log2_adb233(); +} diff --git a/test/tint/builtins/gen/var/log2/aea659.wgsl b/test/tint/builtins/gen/var/log2/aea659.wgsl new file mode 100644 index 0000000000..88d7d76f73 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/aea659.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn log2(vec<2, f32>) -> vec<2, f32> +fn log2_aea659() { + var arg_0 = vec2(); + var res: vec2 = log2(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + log2_aea659(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + log2_aea659(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + log2_aea659(); +} diff --git a/test/tint/builtins/gen/var/log2/aea659.wgsl.expected.glsl b/test/tint/builtins/gen/var/log2/aea659.wgsl.expected.glsl new file mode 100644 index 0000000000..ec15096fca --- /dev/null +++ b/test/tint/builtins/gen/var/log2/aea659.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void log2_aea659() { + vec2 arg_0 = vec2(0.0f); + vec2 res = log2(arg_0); +} + +vec4 vertex_main() { + log2_aea659(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void log2_aea659() { + vec2 arg_0 = vec2(0.0f); + vec2 res = log2(arg_0); +} + +void fragment_main() { + log2_aea659(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void log2_aea659() { + vec2 arg_0 = vec2(0.0f); + vec2 res = log2(arg_0); +} + +void compute_main() { + log2_aea659(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/log2/aea659.wgsl.expected.hlsl b/test/tint/builtins/gen/var/log2/aea659.wgsl.expected.hlsl new file mode 100644 index 0000000000..e24f82a0e1 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/aea659.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void log2_aea659() { + float2 arg_0 = (0.0f).xx; + float2 res = log2(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log2_aea659(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log2_aea659(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log2_aea659(); + return; +} diff --git a/test/tint/builtins/gen/var/log2/aea659.wgsl.expected.msl b/test/tint/builtins/gen/var/log2/aea659.wgsl.expected.msl new file mode 100644 index 0000000000..600c740d3c --- /dev/null +++ b/test/tint/builtins/gen/var/log2/aea659.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void log2_aea659() { + float2 arg_0 = float2(0.0f); + float2 res = log2(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + log2_aea659(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + log2_aea659(); + return; +} + +kernel void compute_main() { + log2_aea659(); + return; +} + diff --git a/test/tint/builtins/gen/var/log2/aea659.wgsl.expected.spvasm b/test/tint/builtins/gen/var/log2/aea659.wgsl.expected.spvasm new file mode 100644 index 0000000000..5ea2f4bde3 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/aea659.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %log2_aea659 "log2_aea659" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %14 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%log2_aea659 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %14 + %res = OpVariable %_ptr_Function_v2float Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %v2float %arg_0 + %17 = OpExtInst %v2float %18 Log2 %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %log2_aea659 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %log2_aea659 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %log2_aea659 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/log2/aea659.wgsl.expected.wgsl b/test/tint/builtins/gen/var/log2/aea659.wgsl.expected.wgsl new file mode 100644 index 0000000000..86a10f113b --- /dev/null +++ b/test/tint/builtins/gen/var/log2/aea659.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn log2_aea659() { + var arg_0 = vec2(); + var res : vec2 = log2(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + log2_aea659(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + log2_aea659(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + log2_aea659(); +} diff --git a/test/tint/builtins/gen/var/max/0c0aae.wgsl b/test/tint/builtins/gen/var/max/0c0aae.wgsl new file mode 100644 index 0000000000..67391ec6cc --- /dev/null +++ b/test/tint/builtins/gen/var/max/0c0aae.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn max(u32, u32) -> u32 +fn max_0c0aae() { + var arg_0 = 1u; + var arg_1 = 1u; + var res: u32 = max(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + max_0c0aae(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + max_0c0aae(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + max_0c0aae(); +} diff --git a/test/tint/builtins/gen/var/max/0c0aae.wgsl.expected.glsl b/test/tint/builtins/gen/var/max/0c0aae.wgsl.expected.glsl new file mode 100644 index 0000000000..de68a146a5 --- /dev/null +++ b/test/tint/builtins/gen/var/max/0c0aae.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void max_0c0aae() { + uint arg_0 = 1u; + uint arg_1 = 1u; + uint res = max(arg_0, arg_1); +} + +vec4 vertex_main() { + max_0c0aae(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void max_0c0aae() { + uint arg_0 = 1u; + uint arg_1 = 1u; + uint res = max(arg_0, arg_1); +} + +void fragment_main() { + max_0c0aae(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void max_0c0aae() { + uint arg_0 = 1u; + uint arg_1 = 1u; + uint res = max(arg_0, arg_1); +} + +void compute_main() { + max_0c0aae(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/max/0c0aae.wgsl.expected.hlsl b/test/tint/builtins/gen/var/max/0c0aae.wgsl.expected.hlsl new file mode 100644 index 0000000000..e7e8dce313 --- /dev/null +++ b/test/tint/builtins/gen/var/max/0c0aae.wgsl.expected.hlsl @@ -0,0 +1,32 @@ +void max_0c0aae() { + uint arg_0 = 1u; + uint arg_1 = 1u; + uint res = max(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_0c0aae(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_0c0aae(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_0c0aae(); + return; +} diff --git a/test/tint/builtins/gen/var/max/0c0aae.wgsl.expected.msl b/test/tint/builtins/gen/var/max/0c0aae.wgsl.expected.msl new file mode 100644 index 0000000000..6a31914d61 --- /dev/null +++ b/test/tint/builtins/gen/var/max/0c0aae.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void max_0c0aae() { + uint arg_0 = 1u; + uint arg_1 = 1u; + uint res = max(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + max_0c0aae(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + max_0c0aae(); + return; +} + +kernel void compute_main() { + max_0c0aae(); + return; +} + diff --git a/test/tint/builtins/gen/var/max/0c0aae.wgsl.expected.spvasm b/test/tint/builtins/gen/var/max/0c0aae.wgsl.expected.spvasm new file mode 100644 index 0000000000..4f9f3b91d1 --- /dev/null +++ b/test/tint/builtins/gen/var/max/0c0aae.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %max_0c0aae "max_0c0aae" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %17 = OpConstantNull %uint + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %max_0c0aae = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_uint Function %17 + %arg_1 = OpVariable %_ptr_Function_uint Function %17 + %res = OpVariable %_ptr_Function_uint Function %17 + OpStore %arg_0 %uint_1 + OpStore %arg_1 %uint_1 + %21 = OpLoad %uint %arg_0 + %22 = OpLoad %uint %arg_1 + %19 = OpExtInst %uint %20 UMax %21 %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %max_0c0aae + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %max_0c0aae + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %max_0c0aae + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/max/0c0aae.wgsl.expected.wgsl b/test/tint/builtins/gen/var/max/0c0aae.wgsl.expected.wgsl new file mode 100644 index 0000000000..562bf679ad --- /dev/null +++ b/test/tint/builtins/gen/var/max/0c0aae.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn max_0c0aae() { + var arg_0 = 1u; + var arg_1 = 1u; + var res : u32 = max(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + max_0c0aae(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + max_0c0aae(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + max_0c0aae(); +} diff --git a/test/tint/builtins/gen/var/max/25eafe.wgsl b/test/tint/builtins/gen/var/max/25eafe.wgsl new file mode 100644 index 0000000000..4d028def11 --- /dev/null +++ b/test/tint/builtins/gen/var/max/25eafe.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn max(vec<3, i32>, vec<3, i32>) -> vec<3, i32> +fn max_25eafe() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var res: vec3 = max(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + max_25eafe(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + max_25eafe(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + max_25eafe(); +} diff --git a/test/tint/builtins/gen/var/max/25eafe.wgsl.expected.glsl b/test/tint/builtins/gen/var/max/25eafe.wgsl.expected.glsl new file mode 100644 index 0000000000..ea6e7fd8ad --- /dev/null +++ b/test/tint/builtins/gen/var/max/25eafe.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void max_25eafe() { + ivec3 arg_0 = ivec3(0); + ivec3 arg_1 = ivec3(0); + ivec3 res = max(arg_0, arg_1); +} + +vec4 vertex_main() { + max_25eafe(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void max_25eafe() { + ivec3 arg_0 = ivec3(0); + ivec3 arg_1 = ivec3(0); + ivec3 res = max(arg_0, arg_1); +} + +void fragment_main() { + max_25eafe(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void max_25eafe() { + ivec3 arg_0 = ivec3(0); + ivec3 arg_1 = ivec3(0); + ivec3 res = max(arg_0, arg_1); +} + +void compute_main() { + max_25eafe(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/max/25eafe.wgsl.expected.hlsl b/test/tint/builtins/gen/var/max/25eafe.wgsl.expected.hlsl new file mode 100644 index 0000000000..77cc993b1f --- /dev/null +++ b/test/tint/builtins/gen/var/max/25eafe.wgsl.expected.hlsl @@ -0,0 +1,32 @@ +void max_25eafe() { + int3 arg_0 = (0).xxx; + int3 arg_1 = (0).xxx; + int3 res = max(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_25eafe(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_25eafe(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_25eafe(); + return; +} diff --git a/test/tint/builtins/gen/var/max/25eafe.wgsl.expected.msl b/test/tint/builtins/gen/var/max/25eafe.wgsl.expected.msl new file mode 100644 index 0000000000..732cc4740d --- /dev/null +++ b/test/tint/builtins/gen/var/max/25eafe.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void max_25eafe() { + int3 arg_0 = int3(0); + int3 arg_1 = int3(0); + int3 res = max(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + max_25eafe(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + max_25eafe(); + return; +} + +kernel void compute_main() { + max_25eafe(); + return; +} + diff --git a/test/tint/builtins/gen/var/max/25eafe.wgsl.expected.spvasm b/test/tint/builtins/gen/var/max/25eafe.wgsl.expected.spvasm new file mode 100644 index 0000000000..9a15372d39 --- /dev/null +++ b/test/tint/builtins/gen/var/max/25eafe.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %max_25eafe "max_25eafe" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %15 = OpConstantNull %v3int +%_ptr_Function_v3int = OpTypePointer Function %v3int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %max_25eafe = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3int Function %15 + %arg_1 = OpVariable %_ptr_Function_v3int Function %15 + %res = OpVariable %_ptr_Function_v3int Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %21 = OpLoad %v3int %arg_0 + %22 = OpLoad %v3int %arg_1 + %19 = OpExtInst %v3int %20 SMax %21 %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %max_25eafe + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %max_25eafe + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %max_25eafe + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/max/25eafe.wgsl.expected.wgsl b/test/tint/builtins/gen/var/max/25eafe.wgsl.expected.wgsl new file mode 100644 index 0000000000..70adbd5f2a --- /dev/null +++ b/test/tint/builtins/gen/var/max/25eafe.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn max_25eafe() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var res : vec3 = max(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + max_25eafe(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + max_25eafe(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + max_25eafe(); +} diff --git a/test/tint/builtins/gen/var/max/320815.wgsl b/test/tint/builtins/gen/var/max/320815.wgsl new file mode 100644 index 0000000000..1b27db66e8 --- /dev/null +++ b/test/tint/builtins/gen/var/max/320815.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn max(vec<2, u32>, vec<2, u32>) -> vec<2, u32> +fn max_320815() { + var arg_0 = vec2(); + var arg_1 = vec2(); + var res: vec2 = max(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + max_320815(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + max_320815(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + max_320815(); +} diff --git a/test/tint/builtins/gen/var/max/320815.wgsl.expected.glsl b/test/tint/builtins/gen/var/max/320815.wgsl.expected.glsl new file mode 100644 index 0000000000..dd24fb4468 --- /dev/null +++ b/test/tint/builtins/gen/var/max/320815.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void max_320815() { + uvec2 arg_0 = uvec2(0u); + uvec2 arg_1 = uvec2(0u); + uvec2 res = max(arg_0, arg_1); +} + +vec4 vertex_main() { + max_320815(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void max_320815() { + uvec2 arg_0 = uvec2(0u); + uvec2 arg_1 = uvec2(0u); + uvec2 res = max(arg_0, arg_1); +} + +void fragment_main() { + max_320815(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void max_320815() { + uvec2 arg_0 = uvec2(0u); + uvec2 arg_1 = uvec2(0u); + uvec2 res = max(arg_0, arg_1); +} + +void compute_main() { + max_320815(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/max/320815.wgsl.expected.hlsl b/test/tint/builtins/gen/var/max/320815.wgsl.expected.hlsl new file mode 100644 index 0000000000..c863bd2fc2 --- /dev/null +++ b/test/tint/builtins/gen/var/max/320815.wgsl.expected.hlsl @@ -0,0 +1,32 @@ +void max_320815() { + uint2 arg_0 = (0u).xx; + uint2 arg_1 = (0u).xx; + uint2 res = max(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_320815(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_320815(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_320815(); + return; +} diff --git a/test/tint/builtins/gen/var/max/320815.wgsl.expected.msl b/test/tint/builtins/gen/var/max/320815.wgsl.expected.msl new file mode 100644 index 0000000000..2022314ace --- /dev/null +++ b/test/tint/builtins/gen/var/max/320815.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void max_320815() { + uint2 arg_0 = uint2(0u); + uint2 arg_1 = uint2(0u); + uint2 res = max(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + max_320815(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + max_320815(); + return; +} + +kernel void compute_main() { + max_320815(); + return; +} + diff --git a/test/tint/builtins/gen/var/max/320815.wgsl.expected.spvasm b/test/tint/builtins/gen/var/max/320815.wgsl.expected.spvasm new file mode 100644 index 0000000000..40356655ba --- /dev/null +++ b/test/tint/builtins/gen/var/max/320815.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %max_320815 "max_320815" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %15 = OpConstantNull %v2uint +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %max_320815 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2uint Function %15 + %arg_1 = OpVariable %_ptr_Function_v2uint Function %15 + %res = OpVariable %_ptr_Function_v2uint Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %21 = OpLoad %v2uint %arg_0 + %22 = OpLoad %v2uint %arg_1 + %19 = OpExtInst %v2uint %20 UMax %21 %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %max_320815 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %max_320815 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %max_320815 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/max/320815.wgsl.expected.wgsl b/test/tint/builtins/gen/var/max/320815.wgsl.expected.wgsl new file mode 100644 index 0000000000..9d47a9eaf5 --- /dev/null +++ b/test/tint/builtins/gen/var/max/320815.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn max_320815() { + var arg_0 = vec2(); + var arg_1 = vec2(); + var res : vec2 = max(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + max_320815(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + max_320815(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + max_320815(); +} diff --git a/test/tint/builtins/gen/var/max/44a39d.wgsl b/test/tint/builtins/gen/var/max/44a39d.wgsl new file mode 100644 index 0000000000..280f40dbd8 --- /dev/null +++ b/test/tint/builtins/gen/var/max/44a39d.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn max(f32, f32) -> f32 +fn max_44a39d() { + var arg_0 = 1.0; + var arg_1 = 1.0; + var res: f32 = max(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + max_44a39d(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + max_44a39d(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + max_44a39d(); +} diff --git a/test/tint/builtins/gen/var/max/44a39d.wgsl.expected.glsl b/test/tint/builtins/gen/var/max/44a39d.wgsl.expected.glsl new file mode 100644 index 0000000000..aff772a7b9 --- /dev/null +++ b/test/tint/builtins/gen/var/max/44a39d.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void max_44a39d() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float res = max(arg_0, arg_1); +} + +vec4 vertex_main() { + max_44a39d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void max_44a39d() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float res = max(arg_0, arg_1); +} + +void fragment_main() { + max_44a39d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void max_44a39d() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float res = max(arg_0, arg_1); +} + +void compute_main() { + max_44a39d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/max/44a39d.wgsl.expected.hlsl b/test/tint/builtins/gen/var/max/44a39d.wgsl.expected.hlsl new file mode 100644 index 0000000000..4435435f63 --- /dev/null +++ b/test/tint/builtins/gen/var/max/44a39d.wgsl.expected.hlsl @@ -0,0 +1,32 @@ +void max_44a39d() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float res = max(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_44a39d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_44a39d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_44a39d(); + return; +} diff --git a/test/tint/builtins/gen/var/max/44a39d.wgsl.expected.msl b/test/tint/builtins/gen/var/max/44a39d.wgsl.expected.msl new file mode 100644 index 0000000000..da0146ba77 --- /dev/null +++ b/test/tint/builtins/gen/var/max/44a39d.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void max_44a39d() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float res = fmax(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + max_44a39d(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + max_44a39d(); + return; +} + +kernel void compute_main() { + max_44a39d(); + return; +} + diff --git a/test/tint/builtins/gen/var/max/44a39d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/max/44a39d.wgsl.expected.spvasm new file mode 100644 index 0000000000..d075c28b87 --- /dev/null +++ b/test/tint/builtins/gen/var/max/44a39d.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %max_44a39d "max_44a39d" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %22 = OpTypeFunction %v4float + %max_44a39d = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %arg_1 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + OpStore %arg_1 %float_1 + %19 = OpLoad %float %arg_0 + %20 = OpLoad %float %arg_1 + %17 = OpExtInst %float %18 NMax %19 %20 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %max_44a39d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %max_44a39d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %max_44a39d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/max/44a39d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/max/44a39d.wgsl.expected.wgsl new file mode 100644 index 0000000000..d7107af778 --- /dev/null +++ b/test/tint/builtins/gen/var/max/44a39d.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn max_44a39d() { + var arg_0 = 1.0; + var arg_1 = 1.0; + var res : f32 = max(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + max_44a39d(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + max_44a39d(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + max_44a39d(); +} diff --git a/test/tint/builtins/gen/var/max/453e04.wgsl b/test/tint/builtins/gen/var/max/453e04.wgsl new file mode 100644 index 0000000000..b8b66301fc --- /dev/null +++ b/test/tint/builtins/gen/var/max/453e04.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn max(vec<4, u32>, vec<4, u32>) -> vec<4, u32> +fn max_453e04() { + var arg_0 = vec4(); + var arg_1 = vec4(); + var res: vec4 = max(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + max_453e04(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + max_453e04(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + max_453e04(); +} diff --git a/test/tint/builtins/gen/var/max/453e04.wgsl.expected.glsl b/test/tint/builtins/gen/var/max/453e04.wgsl.expected.glsl new file mode 100644 index 0000000000..d525546c7b --- /dev/null +++ b/test/tint/builtins/gen/var/max/453e04.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void max_453e04() { + uvec4 arg_0 = uvec4(0u); + uvec4 arg_1 = uvec4(0u); + uvec4 res = max(arg_0, arg_1); +} + +vec4 vertex_main() { + max_453e04(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void max_453e04() { + uvec4 arg_0 = uvec4(0u); + uvec4 arg_1 = uvec4(0u); + uvec4 res = max(arg_0, arg_1); +} + +void fragment_main() { + max_453e04(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void max_453e04() { + uvec4 arg_0 = uvec4(0u); + uvec4 arg_1 = uvec4(0u); + uvec4 res = max(arg_0, arg_1); +} + +void compute_main() { + max_453e04(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/max/453e04.wgsl.expected.hlsl b/test/tint/builtins/gen/var/max/453e04.wgsl.expected.hlsl new file mode 100644 index 0000000000..d8122882e4 --- /dev/null +++ b/test/tint/builtins/gen/var/max/453e04.wgsl.expected.hlsl @@ -0,0 +1,32 @@ +void max_453e04() { + uint4 arg_0 = (0u).xxxx; + uint4 arg_1 = (0u).xxxx; + uint4 res = max(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_453e04(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_453e04(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_453e04(); + return; +} diff --git a/test/tint/builtins/gen/var/max/453e04.wgsl.expected.msl b/test/tint/builtins/gen/var/max/453e04.wgsl.expected.msl new file mode 100644 index 0000000000..a8510d7732 --- /dev/null +++ b/test/tint/builtins/gen/var/max/453e04.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void max_453e04() { + uint4 arg_0 = uint4(0u); + uint4 arg_1 = uint4(0u); + uint4 res = max(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + max_453e04(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + max_453e04(); + return; +} + +kernel void compute_main() { + max_453e04(); + return; +} + diff --git a/test/tint/builtins/gen/var/max/453e04.wgsl.expected.spvasm b/test/tint/builtins/gen/var/max/453e04.wgsl.expected.spvasm new file mode 100644 index 0000000000..caf8737059 --- /dev/null +++ b/test/tint/builtins/gen/var/max/453e04.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %max_453e04 "max_453e04" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + %15 = OpConstantNull %v4uint +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %max_453e04 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4uint Function %15 + %arg_1 = OpVariable %_ptr_Function_v4uint Function %15 + %res = OpVariable %_ptr_Function_v4uint Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %21 = OpLoad %v4uint %arg_0 + %22 = OpLoad %v4uint %arg_1 + %19 = OpExtInst %v4uint %20 UMax %21 %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %max_453e04 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %max_453e04 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %max_453e04 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/max/453e04.wgsl.expected.wgsl b/test/tint/builtins/gen/var/max/453e04.wgsl.expected.wgsl new file mode 100644 index 0000000000..2fd058d45d --- /dev/null +++ b/test/tint/builtins/gen/var/max/453e04.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn max_453e04() { + var arg_0 = vec4(); + var arg_1 = vec4(); + var res : vec4 = max(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + max_453e04(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + max_453e04(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + max_453e04(); +} diff --git a/test/tint/builtins/gen/var/max/462050.wgsl b/test/tint/builtins/gen/var/max/462050.wgsl new file mode 100644 index 0000000000..56bfaa9236 --- /dev/null +++ b/test/tint/builtins/gen/var/max/462050.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn max(vec<2, f32>, vec<2, f32>) -> vec<2, f32> +fn max_462050() { + var arg_0 = vec2(); + var arg_1 = vec2(); + var res: vec2 = max(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + max_462050(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + max_462050(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + max_462050(); +} diff --git a/test/tint/builtins/gen/var/max/462050.wgsl.expected.glsl b/test/tint/builtins/gen/var/max/462050.wgsl.expected.glsl new file mode 100644 index 0000000000..48d1a33aed --- /dev/null +++ b/test/tint/builtins/gen/var/max/462050.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void max_462050() { + vec2 arg_0 = vec2(0.0f); + vec2 arg_1 = vec2(0.0f); + vec2 res = max(arg_0, arg_1); +} + +vec4 vertex_main() { + max_462050(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void max_462050() { + vec2 arg_0 = vec2(0.0f); + vec2 arg_1 = vec2(0.0f); + vec2 res = max(arg_0, arg_1); +} + +void fragment_main() { + max_462050(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void max_462050() { + vec2 arg_0 = vec2(0.0f); + vec2 arg_1 = vec2(0.0f); + vec2 res = max(arg_0, arg_1); +} + +void compute_main() { + max_462050(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/max/462050.wgsl.expected.hlsl b/test/tint/builtins/gen/var/max/462050.wgsl.expected.hlsl new file mode 100644 index 0000000000..132a4b2ce4 --- /dev/null +++ b/test/tint/builtins/gen/var/max/462050.wgsl.expected.hlsl @@ -0,0 +1,32 @@ +void max_462050() { + float2 arg_0 = (0.0f).xx; + float2 arg_1 = (0.0f).xx; + float2 res = max(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_462050(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_462050(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_462050(); + return; +} diff --git a/test/tint/builtins/gen/var/max/462050.wgsl.expected.msl b/test/tint/builtins/gen/var/max/462050.wgsl.expected.msl new file mode 100644 index 0000000000..8aadf35461 --- /dev/null +++ b/test/tint/builtins/gen/var/max/462050.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void max_462050() { + float2 arg_0 = float2(0.0f); + float2 arg_1 = float2(0.0f); + float2 res = fmax(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + max_462050(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + max_462050(); + return; +} + +kernel void compute_main() { + max_462050(); + return; +} + diff --git a/test/tint/builtins/gen/var/max/462050.wgsl.expected.spvasm b/test/tint/builtins/gen/var/max/462050.wgsl.expected.spvasm new file mode 100644 index 0000000000..3b0facf6ba --- /dev/null +++ b/test/tint/builtins/gen/var/max/462050.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %max_462050 "max_462050" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %14 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %max_462050 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %14 + %arg_1 = OpVariable %_ptr_Function_v2float Function %14 + %res = OpVariable %_ptr_Function_v2float Function %14 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + %20 = OpLoad %v2float %arg_0 + %21 = OpLoad %v2float %arg_1 + %18 = OpExtInst %v2float %19 NMax %20 %21 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %max_462050 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %max_462050 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %max_462050 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/max/462050.wgsl.expected.wgsl b/test/tint/builtins/gen/var/max/462050.wgsl.expected.wgsl new file mode 100644 index 0000000000..1a7c608f26 --- /dev/null +++ b/test/tint/builtins/gen/var/max/462050.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn max_462050() { + var arg_0 = vec2(); + var arg_1 = vec2(); + var res : vec2 = max(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + max_462050(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + max_462050(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + max_462050(); +} diff --git a/test/tint/builtins/gen/var/max/4883ac.wgsl b/test/tint/builtins/gen/var/max/4883ac.wgsl new file mode 100644 index 0000000000..2ba5c05d3b --- /dev/null +++ b/test/tint/builtins/gen/var/max/4883ac.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn max(vec<3, f32>, vec<3, f32>) -> vec<3, f32> +fn max_4883ac() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var res: vec3 = max(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + max_4883ac(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + max_4883ac(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + max_4883ac(); +} diff --git a/test/tint/builtins/gen/var/max/4883ac.wgsl.expected.glsl b/test/tint/builtins/gen/var/max/4883ac.wgsl.expected.glsl new file mode 100644 index 0000000000..79b7607da4 --- /dev/null +++ b/test/tint/builtins/gen/var/max/4883ac.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void max_4883ac() { + vec3 arg_0 = vec3(0.0f); + vec3 arg_1 = vec3(0.0f); + vec3 res = max(arg_0, arg_1); +} + +vec4 vertex_main() { + max_4883ac(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void max_4883ac() { + vec3 arg_0 = vec3(0.0f); + vec3 arg_1 = vec3(0.0f); + vec3 res = max(arg_0, arg_1); +} + +void fragment_main() { + max_4883ac(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void max_4883ac() { + vec3 arg_0 = vec3(0.0f); + vec3 arg_1 = vec3(0.0f); + vec3 res = max(arg_0, arg_1); +} + +void compute_main() { + max_4883ac(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/max/4883ac.wgsl.expected.hlsl b/test/tint/builtins/gen/var/max/4883ac.wgsl.expected.hlsl new file mode 100644 index 0000000000..8c577a935e --- /dev/null +++ b/test/tint/builtins/gen/var/max/4883ac.wgsl.expected.hlsl @@ -0,0 +1,32 @@ +void max_4883ac() { + float3 arg_0 = (0.0f).xxx; + float3 arg_1 = (0.0f).xxx; + float3 res = max(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_4883ac(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_4883ac(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_4883ac(); + return; +} diff --git a/test/tint/builtins/gen/var/max/4883ac.wgsl.expected.msl b/test/tint/builtins/gen/var/max/4883ac.wgsl.expected.msl new file mode 100644 index 0000000000..49ccb2a152 --- /dev/null +++ b/test/tint/builtins/gen/var/max/4883ac.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void max_4883ac() { + float3 arg_0 = float3(0.0f); + float3 arg_1 = float3(0.0f); + float3 res = fmax(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + max_4883ac(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + max_4883ac(); + return; +} + +kernel void compute_main() { + max_4883ac(); + return; +} + diff --git a/test/tint/builtins/gen/var/max/4883ac.wgsl.expected.spvasm b/test/tint/builtins/gen/var/max/4883ac.wgsl.expected.spvasm new file mode 100644 index 0000000000..4767d182b5 --- /dev/null +++ b/test/tint/builtins/gen/var/max/4883ac.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %max_4883ac "max_4883ac" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %14 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %max_4883ac = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %14 + %arg_1 = OpVariable %_ptr_Function_v3float Function %14 + %res = OpVariable %_ptr_Function_v3float Function %14 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + %20 = OpLoad %v3float %arg_0 + %21 = OpLoad %v3float %arg_1 + %18 = OpExtInst %v3float %19 NMax %20 %21 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %max_4883ac + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %max_4883ac + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %max_4883ac + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/max/4883ac.wgsl.expected.wgsl b/test/tint/builtins/gen/var/max/4883ac.wgsl.expected.wgsl new file mode 100644 index 0000000000..2e155447b0 --- /dev/null +++ b/test/tint/builtins/gen/var/max/4883ac.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn max_4883ac() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var res : vec3 = max(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + max_4883ac(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + max_4883ac(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + max_4883ac(); +} diff --git a/test/tint/builtins/gen/var/max/85e6bc.wgsl b/test/tint/builtins/gen/var/max/85e6bc.wgsl new file mode 100644 index 0000000000..0692e99fc3 --- /dev/null +++ b/test/tint/builtins/gen/var/max/85e6bc.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn max(vec<4, i32>, vec<4, i32>) -> vec<4, i32> +fn max_85e6bc() { + var arg_0 = vec4(); + var arg_1 = vec4(); + var res: vec4 = max(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + max_85e6bc(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + max_85e6bc(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + max_85e6bc(); +} diff --git a/test/tint/builtins/gen/var/max/85e6bc.wgsl.expected.glsl b/test/tint/builtins/gen/var/max/85e6bc.wgsl.expected.glsl new file mode 100644 index 0000000000..e447eab73e --- /dev/null +++ b/test/tint/builtins/gen/var/max/85e6bc.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void max_85e6bc() { + ivec4 arg_0 = ivec4(0); + ivec4 arg_1 = ivec4(0); + ivec4 res = max(arg_0, arg_1); +} + +vec4 vertex_main() { + max_85e6bc(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void max_85e6bc() { + ivec4 arg_0 = ivec4(0); + ivec4 arg_1 = ivec4(0); + ivec4 res = max(arg_0, arg_1); +} + +void fragment_main() { + max_85e6bc(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void max_85e6bc() { + ivec4 arg_0 = ivec4(0); + ivec4 arg_1 = ivec4(0); + ivec4 res = max(arg_0, arg_1); +} + +void compute_main() { + max_85e6bc(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/max/85e6bc.wgsl.expected.hlsl b/test/tint/builtins/gen/var/max/85e6bc.wgsl.expected.hlsl new file mode 100644 index 0000000000..403878646e --- /dev/null +++ b/test/tint/builtins/gen/var/max/85e6bc.wgsl.expected.hlsl @@ -0,0 +1,32 @@ +void max_85e6bc() { + int4 arg_0 = (0).xxxx; + int4 arg_1 = (0).xxxx; + int4 res = max(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_85e6bc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_85e6bc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_85e6bc(); + return; +} diff --git a/test/tint/builtins/gen/var/max/85e6bc.wgsl.expected.msl b/test/tint/builtins/gen/var/max/85e6bc.wgsl.expected.msl new file mode 100644 index 0000000000..3b73bf7935 --- /dev/null +++ b/test/tint/builtins/gen/var/max/85e6bc.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void max_85e6bc() { + int4 arg_0 = int4(0); + int4 arg_1 = int4(0); + int4 res = max(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + max_85e6bc(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + max_85e6bc(); + return; +} + +kernel void compute_main() { + max_85e6bc(); + return; +} + diff --git a/test/tint/builtins/gen/var/max/85e6bc.wgsl.expected.spvasm b/test/tint/builtins/gen/var/max/85e6bc.wgsl.expected.spvasm new file mode 100644 index 0000000000..8c468ce29a --- /dev/null +++ b/test/tint/builtins/gen/var/max/85e6bc.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %max_85e6bc "max_85e6bc" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %15 = OpConstantNull %v4int +%_ptr_Function_v4int = OpTypePointer Function %v4int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %max_85e6bc = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4int Function %15 + %arg_1 = OpVariable %_ptr_Function_v4int Function %15 + %res = OpVariable %_ptr_Function_v4int Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %21 = OpLoad %v4int %arg_0 + %22 = OpLoad %v4int %arg_1 + %19 = OpExtInst %v4int %20 SMax %21 %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %max_85e6bc + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %max_85e6bc + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %max_85e6bc + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/max/85e6bc.wgsl.expected.wgsl b/test/tint/builtins/gen/var/max/85e6bc.wgsl.expected.wgsl new file mode 100644 index 0000000000..8d76787db1 --- /dev/null +++ b/test/tint/builtins/gen/var/max/85e6bc.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn max_85e6bc() { + var arg_0 = vec4(); + var arg_1 = vec4(); + var res : vec4 = max(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + max_85e6bc(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + max_85e6bc(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + max_85e6bc(); +} diff --git a/test/tint/builtins/gen/var/max/a93419.wgsl b/test/tint/builtins/gen/var/max/a93419.wgsl new file mode 100644 index 0000000000..3a08c18fb5 --- /dev/null +++ b/test/tint/builtins/gen/var/max/a93419.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn max(vec<4, f32>, vec<4, f32>) -> vec<4, f32> +fn max_a93419() { + var arg_0 = vec4(); + var arg_1 = vec4(); + var res: vec4 = max(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + max_a93419(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + max_a93419(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + max_a93419(); +} diff --git a/test/tint/builtins/gen/var/max/a93419.wgsl.expected.glsl b/test/tint/builtins/gen/var/max/a93419.wgsl.expected.glsl new file mode 100644 index 0000000000..61bfbbfca0 --- /dev/null +++ b/test/tint/builtins/gen/var/max/a93419.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void max_a93419() { + vec4 arg_0 = vec4(0.0f); + vec4 arg_1 = vec4(0.0f); + vec4 res = max(arg_0, arg_1); +} + +vec4 vertex_main() { + max_a93419(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void max_a93419() { + vec4 arg_0 = vec4(0.0f); + vec4 arg_1 = vec4(0.0f); + vec4 res = max(arg_0, arg_1); +} + +void fragment_main() { + max_a93419(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void max_a93419() { + vec4 arg_0 = vec4(0.0f); + vec4 arg_1 = vec4(0.0f); + vec4 res = max(arg_0, arg_1); +} + +void compute_main() { + max_a93419(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/max/a93419.wgsl.expected.hlsl b/test/tint/builtins/gen/var/max/a93419.wgsl.expected.hlsl new file mode 100644 index 0000000000..6997426f1c --- /dev/null +++ b/test/tint/builtins/gen/var/max/a93419.wgsl.expected.hlsl @@ -0,0 +1,32 @@ +void max_a93419() { + float4 arg_0 = (0.0f).xxxx; + float4 arg_1 = (0.0f).xxxx; + float4 res = max(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_a93419(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_a93419(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_a93419(); + return; +} diff --git a/test/tint/builtins/gen/var/max/a93419.wgsl.expected.msl b/test/tint/builtins/gen/var/max/a93419.wgsl.expected.msl new file mode 100644 index 0000000000..71b826d754 --- /dev/null +++ b/test/tint/builtins/gen/var/max/a93419.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void max_a93419() { + float4 arg_0 = float4(0.0f); + float4 arg_1 = float4(0.0f); + float4 res = fmax(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + max_a93419(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + max_a93419(); + return; +} + +kernel void compute_main() { + max_a93419(); + return; +} + diff --git a/test/tint/builtins/gen/var/max/a93419.wgsl.expected.spvasm b/test/tint/builtins/gen/var/max/a93419.wgsl.expected.spvasm new file mode 100644 index 0000000000..0258486a4d --- /dev/null +++ b/test/tint/builtins/gen/var/max/a93419.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %max_a93419 "max_a93419" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %max_a93419 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %arg_1 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %5 + OpStore %arg_1 %5 + %18 = OpLoad %v4float %arg_0 + %19 = OpLoad %v4float %arg_1 + %16 = OpExtInst %v4float %17 NMax %18 %19 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %max_a93419 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %max_a93419 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %max_a93419 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/max/a93419.wgsl.expected.wgsl b/test/tint/builtins/gen/var/max/a93419.wgsl.expected.wgsl new file mode 100644 index 0000000000..0e3d12d778 --- /dev/null +++ b/test/tint/builtins/gen/var/max/a93419.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn max_a93419() { + var arg_0 = vec4(); + var arg_1 = vec4(); + var res : vec4 = max(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + max_a93419(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + max_a93419(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + max_a93419(); +} diff --git a/test/tint/builtins/gen/var/max/b1b73a.wgsl b/test/tint/builtins/gen/var/max/b1b73a.wgsl new file mode 100644 index 0000000000..b60e810578 --- /dev/null +++ b/test/tint/builtins/gen/var/max/b1b73a.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn max(vec<3, u32>, vec<3, u32>) -> vec<3, u32> +fn max_b1b73a() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var res: vec3 = max(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + max_b1b73a(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + max_b1b73a(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + max_b1b73a(); +} diff --git a/test/tint/builtins/gen/var/max/b1b73a.wgsl.expected.glsl b/test/tint/builtins/gen/var/max/b1b73a.wgsl.expected.glsl new file mode 100644 index 0000000000..e472bceda1 --- /dev/null +++ b/test/tint/builtins/gen/var/max/b1b73a.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void max_b1b73a() { + uvec3 arg_0 = uvec3(0u); + uvec3 arg_1 = uvec3(0u); + uvec3 res = max(arg_0, arg_1); +} + +vec4 vertex_main() { + max_b1b73a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void max_b1b73a() { + uvec3 arg_0 = uvec3(0u); + uvec3 arg_1 = uvec3(0u); + uvec3 res = max(arg_0, arg_1); +} + +void fragment_main() { + max_b1b73a(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void max_b1b73a() { + uvec3 arg_0 = uvec3(0u); + uvec3 arg_1 = uvec3(0u); + uvec3 res = max(arg_0, arg_1); +} + +void compute_main() { + max_b1b73a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/max/b1b73a.wgsl.expected.hlsl b/test/tint/builtins/gen/var/max/b1b73a.wgsl.expected.hlsl new file mode 100644 index 0000000000..58925abcbc --- /dev/null +++ b/test/tint/builtins/gen/var/max/b1b73a.wgsl.expected.hlsl @@ -0,0 +1,32 @@ +void max_b1b73a() { + uint3 arg_0 = (0u).xxx; + uint3 arg_1 = (0u).xxx; + uint3 res = max(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_b1b73a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_b1b73a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_b1b73a(); + return; +} diff --git a/test/tint/builtins/gen/var/max/b1b73a.wgsl.expected.msl b/test/tint/builtins/gen/var/max/b1b73a.wgsl.expected.msl new file mode 100644 index 0000000000..d115f99813 --- /dev/null +++ b/test/tint/builtins/gen/var/max/b1b73a.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void max_b1b73a() { + uint3 arg_0 = uint3(0u); + uint3 arg_1 = uint3(0u); + uint3 res = max(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + max_b1b73a(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + max_b1b73a(); + return; +} + +kernel void compute_main() { + max_b1b73a(); + return; +} + diff --git a/test/tint/builtins/gen/var/max/b1b73a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/max/b1b73a.wgsl.expected.spvasm new file mode 100644 index 0000000000..3d94408e07 --- /dev/null +++ b/test/tint/builtins/gen/var/max/b1b73a.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %max_b1b73a "max_b1b73a" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %15 = OpConstantNull %v3uint +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %max_b1b73a = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3uint Function %15 + %arg_1 = OpVariable %_ptr_Function_v3uint Function %15 + %res = OpVariable %_ptr_Function_v3uint Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %21 = OpLoad %v3uint %arg_0 + %22 = OpLoad %v3uint %arg_1 + %19 = OpExtInst %v3uint %20 UMax %21 %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %max_b1b73a + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %max_b1b73a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %max_b1b73a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/max/b1b73a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/max/b1b73a.wgsl.expected.wgsl new file mode 100644 index 0000000000..affed5fa8c --- /dev/null +++ b/test/tint/builtins/gen/var/max/b1b73a.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn max_b1b73a() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var res : vec3 = max(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + max_b1b73a(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + max_b1b73a(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + max_b1b73a(); +} diff --git a/test/tint/builtins/gen/var/max/ce7c30.wgsl b/test/tint/builtins/gen/var/max/ce7c30.wgsl new file mode 100644 index 0000000000..3bfa94bc75 --- /dev/null +++ b/test/tint/builtins/gen/var/max/ce7c30.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn max(i32, i32) -> i32 +fn max_ce7c30() { + var arg_0 = 1; + var arg_1 = 1; + var res: i32 = max(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + max_ce7c30(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + max_ce7c30(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + max_ce7c30(); +} diff --git a/test/tint/builtins/gen/var/max/ce7c30.wgsl.expected.glsl b/test/tint/builtins/gen/var/max/ce7c30.wgsl.expected.glsl new file mode 100644 index 0000000000..fde5bcffb4 --- /dev/null +++ b/test/tint/builtins/gen/var/max/ce7c30.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void max_ce7c30() { + int arg_0 = 1; + int arg_1 = 1; + int res = max(arg_0, arg_1); +} + +vec4 vertex_main() { + max_ce7c30(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void max_ce7c30() { + int arg_0 = 1; + int arg_1 = 1; + int res = max(arg_0, arg_1); +} + +void fragment_main() { + max_ce7c30(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void max_ce7c30() { + int arg_0 = 1; + int arg_1 = 1; + int res = max(arg_0, arg_1); +} + +void compute_main() { + max_ce7c30(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/max/ce7c30.wgsl.expected.hlsl b/test/tint/builtins/gen/var/max/ce7c30.wgsl.expected.hlsl new file mode 100644 index 0000000000..532d8ac2b6 --- /dev/null +++ b/test/tint/builtins/gen/var/max/ce7c30.wgsl.expected.hlsl @@ -0,0 +1,32 @@ +void max_ce7c30() { + int arg_0 = 1; + int arg_1 = 1; + int res = max(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_ce7c30(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_ce7c30(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_ce7c30(); + return; +} diff --git a/test/tint/builtins/gen/var/max/ce7c30.wgsl.expected.msl b/test/tint/builtins/gen/var/max/ce7c30.wgsl.expected.msl new file mode 100644 index 0000000000..1f01f8a0d7 --- /dev/null +++ b/test/tint/builtins/gen/var/max/ce7c30.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void max_ce7c30() { + int arg_0 = 1; + int arg_1 = 1; + int res = max(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + max_ce7c30(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + max_ce7c30(); + return; +} + +kernel void compute_main() { + max_ce7c30(); + return; +} + diff --git a/test/tint/builtins/gen/var/max/ce7c30.wgsl.expected.spvasm b/test/tint/builtins/gen/var/max/ce7c30.wgsl.expected.spvasm new file mode 100644 index 0000000000..faeb02c767 --- /dev/null +++ b/test/tint/builtins/gen/var/max/ce7c30.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %max_ce7c30 "max_ce7c30" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %17 = OpConstantNull %int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %max_ce7c30 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_int Function %17 + %arg_1 = OpVariable %_ptr_Function_int Function %17 + %res = OpVariable %_ptr_Function_int Function %17 + OpStore %arg_0 %int_1 + OpStore %arg_1 %int_1 + %21 = OpLoad %int %arg_0 + %22 = OpLoad %int %arg_1 + %19 = OpExtInst %int %20 SMax %21 %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %max_ce7c30 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %max_ce7c30 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %max_ce7c30 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/max/ce7c30.wgsl.expected.wgsl b/test/tint/builtins/gen/var/max/ce7c30.wgsl.expected.wgsl new file mode 100644 index 0000000000..389f57c8fe --- /dev/null +++ b/test/tint/builtins/gen/var/max/ce7c30.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn max_ce7c30() { + var arg_0 = 1; + var arg_1 = 1; + var res : i32 = max(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + max_ce7c30(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + max_ce7c30(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + max_ce7c30(); +} diff --git a/test/tint/builtins/gen/var/max/e8192f.wgsl b/test/tint/builtins/gen/var/max/e8192f.wgsl new file mode 100644 index 0000000000..e492084bc1 --- /dev/null +++ b/test/tint/builtins/gen/var/max/e8192f.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn max(vec<2, i32>, vec<2, i32>) -> vec<2, i32> +fn max_e8192f() { + var arg_0 = vec2(); + var arg_1 = vec2(); + var res: vec2 = max(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + max_e8192f(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + max_e8192f(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + max_e8192f(); +} diff --git a/test/tint/builtins/gen/var/max/e8192f.wgsl.expected.glsl b/test/tint/builtins/gen/var/max/e8192f.wgsl.expected.glsl new file mode 100644 index 0000000000..dd429a3c8e --- /dev/null +++ b/test/tint/builtins/gen/var/max/e8192f.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void max_e8192f() { + ivec2 arg_0 = ivec2(0); + ivec2 arg_1 = ivec2(0); + ivec2 res = max(arg_0, arg_1); +} + +vec4 vertex_main() { + max_e8192f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void max_e8192f() { + ivec2 arg_0 = ivec2(0); + ivec2 arg_1 = ivec2(0); + ivec2 res = max(arg_0, arg_1); +} + +void fragment_main() { + max_e8192f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void max_e8192f() { + ivec2 arg_0 = ivec2(0); + ivec2 arg_1 = ivec2(0); + ivec2 res = max(arg_0, arg_1); +} + +void compute_main() { + max_e8192f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/max/e8192f.wgsl.expected.hlsl b/test/tint/builtins/gen/var/max/e8192f.wgsl.expected.hlsl new file mode 100644 index 0000000000..aced4a2944 --- /dev/null +++ b/test/tint/builtins/gen/var/max/e8192f.wgsl.expected.hlsl @@ -0,0 +1,32 @@ +void max_e8192f() { + int2 arg_0 = (0).xx; + int2 arg_1 = (0).xx; + int2 res = max(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_e8192f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_e8192f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_e8192f(); + return; +} diff --git a/test/tint/builtins/gen/var/max/e8192f.wgsl.expected.msl b/test/tint/builtins/gen/var/max/e8192f.wgsl.expected.msl new file mode 100644 index 0000000000..19f2872751 --- /dev/null +++ b/test/tint/builtins/gen/var/max/e8192f.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void max_e8192f() { + int2 arg_0 = int2(0); + int2 arg_1 = int2(0); + int2 res = max(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + max_e8192f(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + max_e8192f(); + return; +} + +kernel void compute_main() { + max_e8192f(); + return; +} + diff --git a/test/tint/builtins/gen/var/max/e8192f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/max/e8192f.wgsl.expected.spvasm new file mode 100644 index 0000000000..4e09cf0978 --- /dev/null +++ b/test/tint/builtins/gen/var/max/e8192f.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %max_e8192f "max_e8192f" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %15 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %max_e8192f = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2int Function %15 + %arg_1 = OpVariable %_ptr_Function_v2int Function %15 + %res = OpVariable %_ptr_Function_v2int Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %21 = OpLoad %v2int %arg_0 + %22 = OpLoad %v2int %arg_1 + %19 = OpExtInst %v2int %20 SMax %21 %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %max_e8192f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %max_e8192f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %max_e8192f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/max/e8192f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/max/e8192f.wgsl.expected.wgsl new file mode 100644 index 0000000000..d7e94bbfcc --- /dev/null +++ b/test/tint/builtins/gen/var/max/e8192f.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn max_e8192f() { + var arg_0 = vec2(); + var arg_1 = vec2(); + var res : vec2 = max(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + max_e8192f(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + max_e8192f(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + max_e8192f(); +} diff --git a/test/tint/builtins/gen/var/min/03c7e3.wgsl b/test/tint/builtins/gen/var/min/03c7e3.wgsl new file mode 100644 index 0000000000..c6584bd7b9 --- /dev/null +++ b/test/tint/builtins/gen/var/min/03c7e3.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn min(vec<2, i32>, vec<2, i32>) -> vec<2, i32> +fn min_03c7e3() { + var arg_0 = vec2(); + var arg_1 = vec2(); + var res: vec2 = min(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + min_03c7e3(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + min_03c7e3(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + min_03c7e3(); +} diff --git a/test/tint/builtins/gen/var/min/03c7e3.wgsl.expected.glsl b/test/tint/builtins/gen/var/min/03c7e3.wgsl.expected.glsl new file mode 100644 index 0000000000..f4069454b9 --- /dev/null +++ b/test/tint/builtins/gen/var/min/03c7e3.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void min_03c7e3() { + ivec2 arg_0 = ivec2(0); + ivec2 arg_1 = ivec2(0); + ivec2 res = min(arg_0, arg_1); +} + +vec4 vertex_main() { + min_03c7e3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void min_03c7e3() { + ivec2 arg_0 = ivec2(0); + ivec2 arg_1 = ivec2(0); + ivec2 res = min(arg_0, arg_1); +} + +void fragment_main() { + min_03c7e3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void min_03c7e3() { + ivec2 arg_0 = ivec2(0); + ivec2 arg_1 = ivec2(0); + ivec2 res = min(arg_0, arg_1); +} + +void compute_main() { + min_03c7e3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/min/03c7e3.wgsl.expected.hlsl b/test/tint/builtins/gen/var/min/03c7e3.wgsl.expected.hlsl new file mode 100644 index 0000000000..af0f2479a8 --- /dev/null +++ b/test/tint/builtins/gen/var/min/03c7e3.wgsl.expected.hlsl @@ -0,0 +1,32 @@ +void min_03c7e3() { + int2 arg_0 = (0).xx; + int2 arg_1 = (0).xx; + int2 res = min(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_03c7e3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_03c7e3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_03c7e3(); + return; +} diff --git a/test/tint/builtins/gen/var/min/03c7e3.wgsl.expected.msl b/test/tint/builtins/gen/var/min/03c7e3.wgsl.expected.msl new file mode 100644 index 0000000000..b86dc3e611 --- /dev/null +++ b/test/tint/builtins/gen/var/min/03c7e3.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void min_03c7e3() { + int2 arg_0 = int2(0); + int2 arg_1 = int2(0); + int2 res = min(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + min_03c7e3(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + min_03c7e3(); + return; +} + +kernel void compute_main() { + min_03c7e3(); + return; +} + diff --git a/test/tint/builtins/gen/var/min/03c7e3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/min/03c7e3.wgsl.expected.spvasm new file mode 100644 index 0000000000..ff14eae7b7 --- /dev/null +++ b/test/tint/builtins/gen/var/min/03c7e3.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %min_03c7e3 "min_03c7e3" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %15 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %min_03c7e3 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2int Function %15 + %arg_1 = OpVariable %_ptr_Function_v2int Function %15 + %res = OpVariable %_ptr_Function_v2int Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %21 = OpLoad %v2int %arg_0 + %22 = OpLoad %v2int %arg_1 + %19 = OpExtInst %v2int %20 SMin %21 %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %min_03c7e3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %min_03c7e3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %min_03c7e3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/min/03c7e3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/min/03c7e3.wgsl.expected.wgsl new file mode 100644 index 0000000000..c266d214e0 --- /dev/null +++ b/test/tint/builtins/gen/var/min/03c7e3.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn min_03c7e3() { + var arg_0 = vec2(); + var arg_1 = vec2(); + var res : vec2 = min(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + min_03c7e3(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + min_03c7e3(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + min_03c7e3(); +} diff --git a/test/tint/builtins/gen/var/min/0dc614.wgsl b/test/tint/builtins/gen/var/min/0dc614.wgsl new file mode 100644 index 0000000000..15bd5210c4 --- /dev/null +++ b/test/tint/builtins/gen/var/min/0dc614.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn min(vec<4, u32>, vec<4, u32>) -> vec<4, u32> +fn min_0dc614() { + var arg_0 = vec4(); + var arg_1 = vec4(); + var res: vec4 = min(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + min_0dc614(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + min_0dc614(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + min_0dc614(); +} diff --git a/test/tint/builtins/gen/var/min/0dc614.wgsl.expected.glsl b/test/tint/builtins/gen/var/min/0dc614.wgsl.expected.glsl new file mode 100644 index 0000000000..e865f038ff --- /dev/null +++ b/test/tint/builtins/gen/var/min/0dc614.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void min_0dc614() { + uvec4 arg_0 = uvec4(0u); + uvec4 arg_1 = uvec4(0u); + uvec4 res = min(arg_0, arg_1); +} + +vec4 vertex_main() { + min_0dc614(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void min_0dc614() { + uvec4 arg_0 = uvec4(0u); + uvec4 arg_1 = uvec4(0u); + uvec4 res = min(arg_0, arg_1); +} + +void fragment_main() { + min_0dc614(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void min_0dc614() { + uvec4 arg_0 = uvec4(0u); + uvec4 arg_1 = uvec4(0u); + uvec4 res = min(arg_0, arg_1); +} + +void compute_main() { + min_0dc614(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/min/0dc614.wgsl.expected.hlsl b/test/tint/builtins/gen/var/min/0dc614.wgsl.expected.hlsl new file mode 100644 index 0000000000..57486febcd --- /dev/null +++ b/test/tint/builtins/gen/var/min/0dc614.wgsl.expected.hlsl @@ -0,0 +1,32 @@ +void min_0dc614() { + uint4 arg_0 = (0u).xxxx; + uint4 arg_1 = (0u).xxxx; + uint4 res = min(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_0dc614(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_0dc614(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_0dc614(); + return; +} diff --git a/test/tint/builtins/gen/var/min/0dc614.wgsl.expected.msl b/test/tint/builtins/gen/var/min/0dc614.wgsl.expected.msl new file mode 100644 index 0000000000..2e45112373 --- /dev/null +++ b/test/tint/builtins/gen/var/min/0dc614.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void min_0dc614() { + uint4 arg_0 = uint4(0u); + uint4 arg_1 = uint4(0u); + uint4 res = min(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + min_0dc614(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + min_0dc614(); + return; +} + +kernel void compute_main() { + min_0dc614(); + return; +} + diff --git a/test/tint/builtins/gen/var/min/0dc614.wgsl.expected.spvasm b/test/tint/builtins/gen/var/min/0dc614.wgsl.expected.spvasm new file mode 100644 index 0000000000..3b569aa315 --- /dev/null +++ b/test/tint/builtins/gen/var/min/0dc614.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %min_0dc614 "min_0dc614" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + %15 = OpConstantNull %v4uint +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %min_0dc614 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4uint Function %15 + %arg_1 = OpVariable %_ptr_Function_v4uint Function %15 + %res = OpVariable %_ptr_Function_v4uint Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %21 = OpLoad %v4uint %arg_0 + %22 = OpLoad %v4uint %arg_1 + %19 = OpExtInst %v4uint %20 UMin %21 %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %min_0dc614 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %min_0dc614 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %min_0dc614 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/min/0dc614.wgsl.expected.wgsl b/test/tint/builtins/gen/var/min/0dc614.wgsl.expected.wgsl new file mode 100644 index 0000000000..6468740a4e --- /dev/null +++ b/test/tint/builtins/gen/var/min/0dc614.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn min_0dc614() { + var arg_0 = vec4(); + var arg_1 = vec4(); + var res : vec4 = min(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + min_0dc614(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + min_0dc614(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + min_0dc614(); +} diff --git a/test/tint/builtins/gen/var/min/3941e1.wgsl b/test/tint/builtins/gen/var/min/3941e1.wgsl new file mode 100644 index 0000000000..6ffcdef50a --- /dev/null +++ b/test/tint/builtins/gen/var/min/3941e1.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn min(vec<4, i32>, vec<4, i32>) -> vec<4, i32> +fn min_3941e1() { + var arg_0 = vec4(); + var arg_1 = vec4(); + var res: vec4 = min(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + min_3941e1(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + min_3941e1(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + min_3941e1(); +} diff --git a/test/tint/builtins/gen/var/min/3941e1.wgsl.expected.glsl b/test/tint/builtins/gen/var/min/3941e1.wgsl.expected.glsl new file mode 100644 index 0000000000..9bc41431fb --- /dev/null +++ b/test/tint/builtins/gen/var/min/3941e1.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void min_3941e1() { + ivec4 arg_0 = ivec4(0); + ivec4 arg_1 = ivec4(0); + ivec4 res = min(arg_0, arg_1); +} + +vec4 vertex_main() { + min_3941e1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void min_3941e1() { + ivec4 arg_0 = ivec4(0); + ivec4 arg_1 = ivec4(0); + ivec4 res = min(arg_0, arg_1); +} + +void fragment_main() { + min_3941e1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void min_3941e1() { + ivec4 arg_0 = ivec4(0); + ivec4 arg_1 = ivec4(0); + ivec4 res = min(arg_0, arg_1); +} + +void compute_main() { + min_3941e1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/min/3941e1.wgsl.expected.hlsl b/test/tint/builtins/gen/var/min/3941e1.wgsl.expected.hlsl new file mode 100644 index 0000000000..d071ce7601 --- /dev/null +++ b/test/tint/builtins/gen/var/min/3941e1.wgsl.expected.hlsl @@ -0,0 +1,32 @@ +void min_3941e1() { + int4 arg_0 = (0).xxxx; + int4 arg_1 = (0).xxxx; + int4 res = min(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_3941e1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_3941e1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_3941e1(); + return; +} diff --git a/test/tint/builtins/gen/var/min/3941e1.wgsl.expected.msl b/test/tint/builtins/gen/var/min/3941e1.wgsl.expected.msl new file mode 100644 index 0000000000..5bb0be9591 --- /dev/null +++ b/test/tint/builtins/gen/var/min/3941e1.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void min_3941e1() { + int4 arg_0 = int4(0); + int4 arg_1 = int4(0); + int4 res = min(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + min_3941e1(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + min_3941e1(); + return; +} + +kernel void compute_main() { + min_3941e1(); + return; +} + diff --git a/test/tint/builtins/gen/var/min/3941e1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/min/3941e1.wgsl.expected.spvasm new file mode 100644 index 0000000000..aa77352411 --- /dev/null +++ b/test/tint/builtins/gen/var/min/3941e1.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %min_3941e1 "min_3941e1" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %15 = OpConstantNull %v4int +%_ptr_Function_v4int = OpTypePointer Function %v4int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %min_3941e1 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4int Function %15 + %arg_1 = OpVariable %_ptr_Function_v4int Function %15 + %res = OpVariable %_ptr_Function_v4int Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %21 = OpLoad %v4int %arg_0 + %22 = OpLoad %v4int %arg_1 + %19 = OpExtInst %v4int %20 SMin %21 %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %min_3941e1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %min_3941e1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %min_3941e1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/min/3941e1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/min/3941e1.wgsl.expected.wgsl new file mode 100644 index 0000000000..e4f18a3881 --- /dev/null +++ b/test/tint/builtins/gen/var/min/3941e1.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn min_3941e1() { + var arg_0 = vec4(); + var arg_1 = vec4(); + var res : vec4 = min(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + min_3941e1(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + min_3941e1(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + min_3941e1(); +} diff --git a/test/tint/builtins/gen/var/min/46c5d3.wgsl b/test/tint/builtins/gen/var/min/46c5d3.wgsl new file mode 100644 index 0000000000..391138e90d --- /dev/null +++ b/test/tint/builtins/gen/var/min/46c5d3.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn min(u32, u32) -> u32 +fn min_46c5d3() { + var arg_0 = 1u; + var arg_1 = 1u; + var res: u32 = min(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + min_46c5d3(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + min_46c5d3(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + min_46c5d3(); +} diff --git a/test/tint/builtins/gen/var/min/46c5d3.wgsl.expected.glsl b/test/tint/builtins/gen/var/min/46c5d3.wgsl.expected.glsl new file mode 100644 index 0000000000..d2cce51fc7 --- /dev/null +++ b/test/tint/builtins/gen/var/min/46c5d3.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void min_46c5d3() { + uint arg_0 = 1u; + uint arg_1 = 1u; + uint res = min(arg_0, arg_1); +} + +vec4 vertex_main() { + min_46c5d3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void min_46c5d3() { + uint arg_0 = 1u; + uint arg_1 = 1u; + uint res = min(arg_0, arg_1); +} + +void fragment_main() { + min_46c5d3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void min_46c5d3() { + uint arg_0 = 1u; + uint arg_1 = 1u; + uint res = min(arg_0, arg_1); +} + +void compute_main() { + min_46c5d3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/min/46c5d3.wgsl.expected.hlsl b/test/tint/builtins/gen/var/min/46c5d3.wgsl.expected.hlsl new file mode 100644 index 0000000000..68dfb8ecc4 --- /dev/null +++ b/test/tint/builtins/gen/var/min/46c5d3.wgsl.expected.hlsl @@ -0,0 +1,32 @@ +void min_46c5d3() { + uint arg_0 = 1u; + uint arg_1 = 1u; + uint res = min(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_46c5d3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_46c5d3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_46c5d3(); + return; +} diff --git a/test/tint/builtins/gen/var/min/46c5d3.wgsl.expected.msl b/test/tint/builtins/gen/var/min/46c5d3.wgsl.expected.msl new file mode 100644 index 0000000000..a66228b9b4 --- /dev/null +++ b/test/tint/builtins/gen/var/min/46c5d3.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void min_46c5d3() { + uint arg_0 = 1u; + uint arg_1 = 1u; + uint res = min(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + min_46c5d3(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + min_46c5d3(); + return; +} + +kernel void compute_main() { + min_46c5d3(); + return; +} + diff --git a/test/tint/builtins/gen/var/min/46c5d3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/min/46c5d3.wgsl.expected.spvasm new file mode 100644 index 0000000000..f68a728287 --- /dev/null +++ b/test/tint/builtins/gen/var/min/46c5d3.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %min_46c5d3 "min_46c5d3" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %17 = OpConstantNull %uint + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %min_46c5d3 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_uint Function %17 + %arg_1 = OpVariable %_ptr_Function_uint Function %17 + %res = OpVariable %_ptr_Function_uint Function %17 + OpStore %arg_0 %uint_1 + OpStore %arg_1 %uint_1 + %21 = OpLoad %uint %arg_0 + %22 = OpLoad %uint %arg_1 + %19 = OpExtInst %uint %20 UMin %21 %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %min_46c5d3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %min_46c5d3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %min_46c5d3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/min/46c5d3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/min/46c5d3.wgsl.expected.wgsl new file mode 100644 index 0000000000..82edb4bcf1 --- /dev/null +++ b/test/tint/builtins/gen/var/min/46c5d3.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn min_46c5d3() { + var arg_0 = 1u; + var arg_1 = 1u; + var res : u32 = min(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + min_46c5d3(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + min_46c5d3(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + min_46c5d3(); +} diff --git a/test/tint/builtins/gen/var/min/82b28f.wgsl b/test/tint/builtins/gen/var/min/82b28f.wgsl new file mode 100644 index 0000000000..6ccb4e106a --- /dev/null +++ b/test/tint/builtins/gen/var/min/82b28f.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn min(vec<2, u32>, vec<2, u32>) -> vec<2, u32> +fn min_82b28f() { + var arg_0 = vec2(); + var arg_1 = vec2(); + var res: vec2 = min(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + min_82b28f(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + min_82b28f(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + min_82b28f(); +} diff --git a/test/tint/builtins/gen/var/min/82b28f.wgsl.expected.glsl b/test/tint/builtins/gen/var/min/82b28f.wgsl.expected.glsl new file mode 100644 index 0000000000..2ba2c0efb1 --- /dev/null +++ b/test/tint/builtins/gen/var/min/82b28f.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void min_82b28f() { + uvec2 arg_0 = uvec2(0u); + uvec2 arg_1 = uvec2(0u); + uvec2 res = min(arg_0, arg_1); +} + +vec4 vertex_main() { + min_82b28f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void min_82b28f() { + uvec2 arg_0 = uvec2(0u); + uvec2 arg_1 = uvec2(0u); + uvec2 res = min(arg_0, arg_1); +} + +void fragment_main() { + min_82b28f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void min_82b28f() { + uvec2 arg_0 = uvec2(0u); + uvec2 arg_1 = uvec2(0u); + uvec2 res = min(arg_0, arg_1); +} + +void compute_main() { + min_82b28f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/min/82b28f.wgsl.expected.hlsl b/test/tint/builtins/gen/var/min/82b28f.wgsl.expected.hlsl new file mode 100644 index 0000000000..b1f5804465 --- /dev/null +++ b/test/tint/builtins/gen/var/min/82b28f.wgsl.expected.hlsl @@ -0,0 +1,32 @@ +void min_82b28f() { + uint2 arg_0 = (0u).xx; + uint2 arg_1 = (0u).xx; + uint2 res = min(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_82b28f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_82b28f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_82b28f(); + return; +} diff --git a/test/tint/builtins/gen/var/min/82b28f.wgsl.expected.msl b/test/tint/builtins/gen/var/min/82b28f.wgsl.expected.msl new file mode 100644 index 0000000000..ff78060a1b --- /dev/null +++ b/test/tint/builtins/gen/var/min/82b28f.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void min_82b28f() { + uint2 arg_0 = uint2(0u); + uint2 arg_1 = uint2(0u); + uint2 res = min(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + min_82b28f(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + min_82b28f(); + return; +} + +kernel void compute_main() { + min_82b28f(); + return; +} + diff --git a/test/tint/builtins/gen/var/min/82b28f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/min/82b28f.wgsl.expected.spvasm new file mode 100644 index 0000000000..ced5331677 --- /dev/null +++ b/test/tint/builtins/gen/var/min/82b28f.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %min_82b28f "min_82b28f" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %15 = OpConstantNull %v2uint +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %min_82b28f = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2uint Function %15 + %arg_1 = OpVariable %_ptr_Function_v2uint Function %15 + %res = OpVariable %_ptr_Function_v2uint Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %21 = OpLoad %v2uint %arg_0 + %22 = OpLoad %v2uint %arg_1 + %19 = OpExtInst %v2uint %20 UMin %21 %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %min_82b28f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %min_82b28f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %min_82b28f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/min/82b28f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/min/82b28f.wgsl.expected.wgsl new file mode 100644 index 0000000000..934bd52bb2 --- /dev/null +++ b/test/tint/builtins/gen/var/min/82b28f.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn min_82b28f() { + var arg_0 = vec2(); + var arg_1 = vec2(); + var res : vec2 = min(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + min_82b28f(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + min_82b28f(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + min_82b28f(); +} diff --git a/test/tint/builtins/gen/var/min/93cfc4.wgsl b/test/tint/builtins/gen/var/min/93cfc4.wgsl new file mode 100644 index 0000000000..1fe53e8f1f --- /dev/null +++ b/test/tint/builtins/gen/var/min/93cfc4.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn min(vec<3, f32>, vec<3, f32>) -> vec<3, f32> +fn min_93cfc4() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var res: vec3 = min(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + min_93cfc4(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + min_93cfc4(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + min_93cfc4(); +} diff --git a/test/tint/builtins/gen/var/min/93cfc4.wgsl.expected.glsl b/test/tint/builtins/gen/var/min/93cfc4.wgsl.expected.glsl new file mode 100644 index 0000000000..1e455067fa --- /dev/null +++ b/test/tint/builtins/gen/var/min/93cfc4.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void min_93cfc4() { + vec3 arg_0 = vec3(0.0f); + vec3 arg_1 = vec3(0.0f); + vec3 res = min(arg_0, arg_1); +} + +vec4 vertex_main() { + min_93cfc4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void min_93cfc4() { + vec3 arg_0 = vec3(0.0f); + vec3 arg_1 = vec3(0.0f); + vec3 res = min(arg_0, arg_1); +} + +void fragment_main() { + min_93cfc4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void min_93cfc4() { + vec3 arg_0 = vec3(0.0f); + vec3 arg_1 = vec3(0.0f); + vec3 res = min(arg_0, arg_1); +} + +void compute_main() { + min_93cfc4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/min/93cfc4.wgsl.expected.hlsl b/test/tint/builtins/gen/var/min/93cfc4.wgsl.expected.hlsl new file mode 100644 index 0000000000..12c56fa61e --- /dev/null +++ b/test/tint/builtins/gen/var/min/93cfc4.wgsl.expected.hlsl @@ -0,0 +1,32 @@ +void min_93cfc4() { + float3 arg_0 = (0.0f).xxx; + float3 arg_1 = (0.0f).xxx; + float3 res = min(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_93cfc4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_93cfc4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_93cfc4(); + return; +} diff --git a/test/tint/builtins/gen/var/min/93cfc4.wgsl.expected.msl b/test/tint/builtins/gen/var/min/93cfc4.wgsl.expected.msl new file mode 100644 index 0000000000..4e7ad8d4ec --- /dev/null +++ b/test/tint/builtins/gen/var/min/93cfc4.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void min_93cfc4() { + float3 arg_0 = float3(0.0f); + float3 arg_1 = float3(0.0f); + float3 res = fmin(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + min_93cfc4(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + min_93cfc4(); + return; +} + +kernel void compute_main() { + min_93cfc4(); + return; +} + diff --git a/test/tint/builtins/gen/var/min/93cfc4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/min/93cfc4.wgsl.expected.spvasm new file mode 100644 index 0000000000..01dc20f752 --- /dev/null +++ b/test/tint/builtins/gen/var/min/93cfc4.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %min_93cfc4 "min_93cfc4" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %14 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %min_93cfc4 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %14 + %arg_1 = OpVariable %_ptr_Function_v3float Function %14 + %res = OpVariable %_ptr_Function_v3float Function %14 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + %20 = OpLoad %v3float %arg_0 + %21 = OpLoad %v3float %arg_1 + %18 = OpExtInst %v3float %19 NMin %20 %21 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %min_93cfc4 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %min_93cfc4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %min_93cfc4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/min/93cfc4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/min/93cfc4.wgsl.expected.wgsl new file mode 100644 index 0000000000..db17519e5d --- /dev/null +++ b/test/tint/builtins/gen/var/min/93cfc4.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn min_93cfc4() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var res : vec3 = min(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + min_93cfc4(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + min_93cfc4(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + min_93cfc4(); +} diff --git a/test/tint/builtins/gen/var/min/a45171.wgsl b/test/tint/builtins/gen/var/min/a45171.wgsl new file mode 100644 index 0000000000..8992507701 --- /dev/null +++ b/test/tint/builtins/gen/var/min/a45171.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn min(vec<3, i32>, vec<3, i32>) -> vec<3, i32> +fn min_a45171() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var res: vec3 = min(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + min_a45171(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + min_a45171(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + min_a45171(); +} diff --git a/test/tint/builtins/gen/var/min/a45171.wgsl.expected.glsl b/test/tint/builtins/gen/var/min/a45171.wgsl.expected.glsl new file mode 100644 index 0000000000..9045bae4e0 --- /dev/null +++ b/test/tint/builtins/gen/var/min/a45171.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void min_a45171() { + ivec3 arg_0 = ivec3(0); + ivec3 arg_1 = ivec3(0); + ivec3 res = min(arg_0, arg_1); +} + +vec4 vertex_main() { + min_a45171(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void min_a45171() { + ivec3 arg_0 = ivec3(0); + ivec3 arg_1 = ivec3(0); + ivec3 res = min(arg_0, arg_1); +} + +void fragment_main() { + min_a45171(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void min_a45171() { + ivec3 arg_0 = ivec3(0); + ivec3 arg_1 = ivec3(0); + ivec3 res = min(arg_0, arg_1); +} + +void compute_main() { + min_a45171(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/min/a45171.wgsl.expected.hlsl b/test/tint/builtins/gen/var/min/a45171.wgsl.expected.hlsl new file mode 100644 index 0000000000..4e2b89ba2c --- /dev/null +++ b/test/tint/builtins/gen/var/min/a45171.wgsl.expected.hlsl @@ -0,0 +1,32 @@ +void min_a45171() { + int3 arg_0 = (0).xxx; + int3 arg_1 = (0).xxx; + int3 res = min(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_a45171(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_a45171(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_a45171(); + return; +} diff --git a/test/tint/builtins/gen/var/min/a45171.wgsl.expected.msl b/test/tint/builtins/gen/var/min/a45171.wgsl.expected.msl new file mode 100644 index 0000000000..6bcbd9b36e --- /dev/null +++ b/test/tint/builtins/gen/var/min/a45171.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void min_a45171() { + int3 arg_0 = int3(0); + int3 arg_1 = int3(0); + int3 res = min(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + min_a45171(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + min_a45171(); + return; +} + +kernel void compute_main() { + min_a45171(); + return; +} + diff --git a/test/tint/builtins/gen/var/min/a45171.wgsl.expected.spvasm b/test/tint/builtins/gen/var/min/a45171.wgsl.expected.spvasm new file mode 100644 index 0000000000..7f6aa2e1d2 --- /dev/null +++ b/test/tint/builtins/gen/var/min/a45171.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %min_a45171 "min_a45171" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %15 = OpConstantNull %v3int +%_ptr_Function_v3int = OpTypePointer Function %v3int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %min_a45171 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3int Function %15 + %arg_1 = OpVariable %_ptr_Function_v3int Function %15 + %res = OpVariable %_ptr_Function_v3int Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %21 = OpLoad %v3int %arg_0 + %22 = OpLoad %v3int %arg_1 + %19 = OpExtInst %v3int %20 SMin %21 %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %min_a45171 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %min_a45171 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %min_a45171 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/min/a45171.wgsl.expected.wgsl b/test/tint/builtins/gen/var/min/a45171.wgsl.expected.wgsl new file mode 100644 index 0000000000..80051cb516 --- /dev/null +++ b/test/tint/builtins/gen/var/min/a45171.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn min_a45171() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var res : vec3 = min(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + min_a45171(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + min_a45171(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + min_a45171(); +} diff --git a/test/tint/builtins/gen/var/min/aa28ad.wgsl b/test/tint/builtins/gen/var/min/aa28ad.wgsl new file mode 100644 index 0000000000..2b56279d8d --- /dev/null +++ b/test/tint/builtins/gen/var/min/aa28ad.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn min(vec<2, f32>, vec<2, f32>) -> vec<2, f32> +fn min_aa28ad() { + var arg_0 = vec2(); + var arg_1 = vec2(); + var res: vec2 = min(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + min_aa28ad(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + min_aa28ad(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + min_aa28ad(); +} diff --git a/test/tint/builtins/gen/var/min/aa28ad.wgsl.expected.glsl b/test/tint/builtins/gen/var/min/aa28ad.wgsl.expected.glsl new file mode 100644 index 0000000000..a266b483e2 --- /dev/null +++ b/test/tint/builtins/gen/var/min/aa28ad.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void min_aa28ad() { + vec2 arg_0 = vec2(0.0f); + vec2 arg_1 = vec2(0.0f); + vec2 res = min(arg_0, arg_1); +} + +vec4 vertex_main() { + min_aa28ad(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void min_aa28ad() { + vec2 arg_0 = vec2(0.0f); + vec2 arg_1 = vec2(0.0f); + vec2 res = min(arg_0, arg_1); +} + +void fragment_main() { + min_aa28ad(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void min_aa28ad() { + vec2 arg_0 = vec2(0.0f); + vec2 arg_1 = vec2(0.0f); + vec2 res = min(arg_0, arg_1); +} + +void compute_main() { + min_aa28ad(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/min/aa28ad.wgsl.expected.hlsl b/test/tint/builtins/gen/var/min/aa28ad.wgsl.expected.hlsl new file mode 100644 index 0000000000..1284c64fee --- /dev/null +++ b/test/tint/builtins/gen/var/min/aa28ad.wgsl.expected.hlsl @@ -0,0 +1,32 @@ +void min_aa28ad() { + float2 arg_0 = (0.0f).xx; + float2 arg_1 = (0.0f).xx; + float2 res = min(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_aa28ad(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_aa28ad(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_aa28ad(); + return; +} diff --git a/test/tint/builtins/gen/var/min/aa28ad.wgsl.expected.msl b/test/tint/builtins/gen/var/min/aa28ad.wgsl.expected.msl new file mode 100644 index 0000000000..a0bade43e2 --- /dev/null +++ b/test/tint/builtins/gen/var/min/aa28ad.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void min_aa28ad() { + float2 arg_0 = float2(0.0f); + float2 arg_1 = float2(0.0f); + float2 res = fmin(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + min_aa28ad(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + min_aa28ad(); + return; +} + +kernel void compute_main() { + min_aa28ad(); + return; +} + diff --git a/test/tint/builtins/gen/var/min/aa28ad.wgsl.expected.spvasm b/test/tint/builtins/gen/var/min/aa28ad.wgsl.expected.spvasm new file mode 100644 index 0000000000..6cdb88c309 --- /dev/null +++ b/test/tint/builtins/gen/var/min/aa28ad.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %min_aa28ad "min_aa28ad" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %14 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %min_aa28ad = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %14 + %arg_1 = OpVariable %_ptr_Function_v2float Function %14 + %res = OpVariable %_ptr_Function_v2float Function %14 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + %20 = OpLoad %v2float %arg_0 + %21 = OpLoad %v2float %arg_1 + %18 = OpExtInst %v2float %19 NMin %20 %21 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %min_aa28ad + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %min_aa28ad + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %min_aa28ad + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/min/aa28ad.wgsl.expected.wgsl b/test/tint/builtins/gen/var/min/aa28ad.wgsl.expected.wgsl new file mode 100644 index 0000000000..f14fb39c69 --- /dev/null +++ b/test/tint/builtins/gen/var/min/aa28ad.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn min_aa28ad() { + var arg_0 = vec2(); + var arg_1 = vec2(); + var res : vec2 = min(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + min_aa28ad(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + min_aa28ad(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + min_aa28ad(); +} diff --git a/test/tint/builtins/gen/var/min/af326d.wgsl b/test/tint/builtins/gen/var/min/af326d.wgsl new file mode 100644 index 0000000000..f1bab38ef2 --- /dev/null +++ b/test/tint/builtins/gen/var/min/af326d.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn min(f32, f32) -> f32 +fn min_af326d() { + var arg_0 = 1.0; + var arg_1 = 1.0; + var res: f32 = min(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + min_af326d(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + min_af326d(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + min_af326d(); +} diff --git a/test/tint/builtins/gen/var/min/af326d.wgsl.expected.glsl b/test/tint/builtins/gen/var/min/af326d.wgsl.expected.glsl new file mode 100644 index 0000000000..070d859e74 --- /dev/null +++ b/test/tint/builtins/gen/var/min/af326d.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void min_af326d() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float res = min(arg_0, arg_1); +} + +vec4 vertex_main() { + min_af326d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void min_af326d() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float res = min(arg_0, arg_1); +} + +void fragment_main() { + min_af326d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void min_af326d() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float res = min(arg_0, arg_1); +} + +void compute_main() { + min_af326d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/min/af326d.wgsl.expected.hlsl b/test/tint/builtins/gen/var/min/af326d.wgsl.expected.hlsl new file mode 100644 index 0000000000..ea481e531a --- /dev/null +++ b/test/tint/builtins/gen/var/min/af326d.wgsl.expected.hlsl @@ -0,0 +1,32 @@ +void min_af326d() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float res = min(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_af326d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_af326d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_af326d(); + return; +} diff --git a/test/tint/builtins/gen/var/min/af326d.wgsl.expected.msl b/test/tint/builtins/gen/var/min/af326d.wgsl.expected.msl new file mode 100644 index 0000000000..f7b47f6131 --- /dev/null +++ b/test/tint/builtins/gen/var/min/af326d.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void min_af326d() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float res = fmin(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + min_af326d(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + min_af326d(); + return; +} + +kernel void compute_main() { + min_af326d(); + return; +} + diff --git a/test/tint/builtins/gen/var/min/af326d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/min/af326d.wgsl.expected.spvasm new file mode 100644 index 0000000000..70b60fe235 --- /dev/null +++ b/test/tint/builtins/gen/var/min/af326d.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %min_af326d "min_af326d" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %22 = OpTypeFunction %v4float + %min_af326d = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %arg_1 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + OpStore %arg_1 %float_1 + %19 = OpLoad %float %arg_0 + %20 = OpLoad %float %arg_1 + %17 = OpExtInst %float %18 NMin %19 %20 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %min_af326d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %min_af326d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %min_af326d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/min/af326d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/min/af326d.wgsl.expected.wgsl new file mode 100644 index 0000000000..dfc7c47d82 --- /dev/null +++ b/test/tint/builtins/gen/var/min/af326d.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn min_af326d() { + var arg_0 = 1.0; + var arg_1 = 1.0; + var res : f32 = min(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + min_af326d(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + min_af326d(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + min_af326d(); +} diff --git a/test/tint/builtins/gen/var/min/c70bb7.wgsl b/test/tint/builtins/gen/var/min/c70bb7.wgsl new file mode 100644 index 0000000000..55582fcc7e --- /dev/null +++ b/test/tint/builtins/gen/var/min/c70bb7.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn min(vec<3, u32>, vec<3, u32>) -> vec<3, u32> +fn min_c70bb7() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var res: vec3 = min(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + min_c70bb7(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + min_c70bb7(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + min_c70bb7(); +} diff --git a/test/tint/builtins/gen/var/min/c70bb7.wgsl.expected.glsl b/test/tint/builtins/gen/var/min/c70bb7.wgsl.expected.glsl new file mode 100644 index 0000000000..b8c99f5217 --- /dev/null +++ b/test/tint/builtins/gen/var/min/c70bb7.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void min_c70bb7() { + uvec3 arg_0 = uvec3(0u); + uvec3 arg_1 = uvec3(0u); + uvec3 res = min(arg_0, arg_1); +} + +vec4 vertex_main() { + min_c70bb7(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void min_c70bb7() { + uvec3 arg_0 = uvec3(0u); + uvec3 arg_1 = uvec3(0u); + uvec3 res = min(arg_0, arg_1); +} + +void fragment_main() { + min_c70bb7(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void min_c70bb7() { + uvec3 arg_0 = uvec3(0u); + uvec3 arg_1 = uvec3(0u); + uvec3 res = min(arg_0, arg_1); +} + +void compute_main() { + min_c70bb7(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/min/c70bb7.wgsl.expected.hlsl b/test/tint/builtins/gen/var/min/c70bb7.wgsl.expected.hlsl new file mode 100644 index 0000000000..b5e461e9ad --- /dev/null +++ b/test/tint/builtins/gen/var/min/c70bb7.wgsl.expected.hlsl @@ -0,0 +1,32 @@ +void min_c70bb7() { + uint3 arg_0 = (0u).xxx; + uint3 arg_1 = (0u).xxx; + uint3 res = min(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_c70bb7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_c70bb7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_c70bb7(); + return; +} diff --git a/test/tint/builtins/gen/var/min/c70bb7.wgsl.expected.msl b/test/tint/builtins/gen/var/min/c70bb7.wgsl.expected.msl new file mode 100644 index 0000000000..3f131b44fd --- /dev/null +++ b/test/tint/builtins/gen/var/min/c70bb7.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void min_c70bb7() { + uint3 arg_0 = uint3(0u); + uint3 arg_1 = uint3(0u); + uint3 res = min(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + min_c70bb7(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + min_c70bb7(); + return; +} + +kernel void compute_main() { + min_c70bb7(); + return; +} + diff --git a/test/tint/builtins/gen/var/min/c70bb7.wgsl.expected.spvasm b/test/tint/builtins/gen/var/min/c70bb7.wgsl.expected.spvasm new file mode 100644 index 0000000000..5a8530ad73 --- /dev/null +++ b/test/tint/builtins/gen/var/min/c70bb7.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %min_c70bb7 "min_c70bb7" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %15 = OpConstantNull %v3uint +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %min_c70bb7 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3uint Function %15 + %arg_1 = OpVariable %_ptr_Function_v3uint Function %15 + %res = OpVariable %_ptr_Function_v3uint Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %21 = OpLoad %v3uint %arg_0 + %22 = OpLoad %v3uint %arg_1 + %19 = OpExtInst %v3uint %20 UMin %21 %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %min_c70bb7 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %min_c70bb7 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %min_c70bb7 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/min/c70bb7.wgsl.expected.wgsl b/test/tint/builtins/gen/var/min/c70bb7.wgsl.expected.wgsl new file mode 100644 index 0000000000..485ba0ca34 --- /dev/null +++ b/test/tint/builtins/gen/var/min/c70bb7.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn min_c70bb7() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var res : vec3 = min(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + min_c70bb7(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + min_c70bb7(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + min_c70bb7(); +} diff --git a/test/tint/builtins/gen/var/min/c73147.wgsl b/test/tint/builtins/gen/var/min/c73147.wgsl new file mode 100644 index 0000000000..cf7c0fbd6b --- /dev/null +++ b/test/tint/builtins/gen/var/min/c73147.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn min(i32, i32) -> i32 +fn min_c73147() { + var arg_0 = 1; + var arg_1 = 1; + var res: i32 = min(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + min_c73147(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + min_c73147(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + min_c73147(); +} diff --git a/test/tint/builtins/gen/var/min/c73147.wgsl.expected.glsl b/test/tint/builtins/gen/var/min/c73147.wgsl.expected.glsl new file mode 100644 index 0000000000..0cf036e493 --- /dev/null +++ b/test/tint/builtins/gen/var/min/c73147.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void min_c73147() { + int arg_0 = 1; + int arg_1 = 1; + int res = min(arg_0, arg_1); +} + +vec4 vertex_main() { + min_c73147(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void min_c73147() { + int arg_0 = 1; + int arg_1 = 1; + int res = min(arg_0, arg_1); +} + +void fragment_main() { + min_c73147(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void min_c73147() { + int arg_0 = 1; + int arg_1 = 1; + int res = min(arg_0, arg_1); +} + +void compute_main() { + min_c73147(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/min/c73147.wgsl.expected.hlsl b/test/tint/builtins/gen/var/min/c73147.wgsl.expected.hlsl new file mode 100644 index 0000000000..a50a55d1e8 --- /dev/null +++ b/test/tint/builtins/gen/var/min/c73147.wgsl.expected.hlsl @@ -0,0 +1,32 @@ +void min_c73147() { + int arg_0 = 1; + int arg_1 = 1; + int res = min(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_c73147(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_c73147(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_c73147(); + return; +} diff --git a/test/tint/builtins/gen/var/min/c73147.wgsl.expected.msl b/test/tint/builtins/gen/var/min/c73147.wgsl.expected.msl new file mode 100644 index 0000000000..22a72c9130 --- /dev/null +++ b/test/tint/builtins/gen/var/min/c73147.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void min_c73147() { + int arg_0 = 1; + int arg_1 = 1; + int res = min(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + min_c73147(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + min_c73147(); + return; +} + +kernel void compute_main() { + min_c73147(); + return; +} + diff --git a/test/tint/builtins/gen/var/min/c73147.wgsl.expected.spvasm b/test/tint/builtins/gen/var/min/c73147.wgsl.expected.spvasm new file mode 100644 index 0000000000..51ce10471e --- /dev/null +++ b/test/tint/builtins/gen/var/min/c73147.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %min_c73147 "min_c73147" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %17 = OpConstantNull %int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %min_c73147 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_int Function %17 + %arg_1 = OpVariable %_ptr_Function_int Function %17 + %res = OpVariable %_ptr_Function_int Function %17 + OpStore %arg_0 %int_1 + OpStore %arg_1 %int_1 + %21 = OpLoad %int %arg_0 + %22 = OpLoad %int %arg_1 + %19 = OpExtInst %int %20 SMin %21 %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %min_c73147 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %min_c73147 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %min_c73147 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/min/c73147.wgsl.expected.wgsl b/test/tint/builtins/gen/var/min/c73147.wgsl.expected.wgsl new file mode 100644 index 0000000000..8653636b8c --- /dev/null +++ b/test/tint/builtins/gen/var/min/c73147.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn min_c73147() { + var arg_0 = 1; + var arg_1 = 1; + var res : i32 = min(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + min_c73147(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + min_c73147(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + min_c73147(); +} diff --git a/test/tint/builtins/gen/var/min/c76fa6.wgsl b/test/tint/builtins/gen/var/min/c76fa6.wgsl new file mode 100644 index 0000000000..0665ca9f73 --- /dev/null +++ b/test/tint/builtins/gen/var/min/c76fa6.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn min(vec<4, f32>, vec<4, f32>) -> vec<4, f32> +fn min_c76fa6() { + var arg_0 = vec4(); + var arg_1 = vec4(); + var res: vec4 = min(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + min_c76fa6(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + min_c76fa6(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + min_c76fa6(); +} diff --git a/test/tint/builtins/gen/var/min/c76fa6.wgsl.expected.glsl b/test/tint/builtins/gen/var/min/c76fa6.wgsl.expected.glsl new file mode 100644 index 0000000000..c8f3d5a69e --- /dev/null +++ b/test/tint/builtins/gen/var/min/c76fa6.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void min_c76fa6() { + vec4 arg_0 = vec4(0.0f); + vec4 arg_1 = vec4(0.0f); + vec4 res = min(arg_0, arg_1); +} + +vec4 vertex_main() { + min_c76fa6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void min_c76fa6() { + vec4 arg_0 = vec4(0.0f); + vec4 arg_1 = vec4(0.0f); + vec4 res = min(arg_0, arg_1); +} + +void fragment_main() { + min_c76fa6(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void min_c76fa6() { + vec4 arg_0 = vec4(0.0f); + vec4 arg_1 = vec4(0.0f); + vec4 res = min(arg_0, arg_1); +} + +void compute_main() { + min_c76fa6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/min/c76fa6.wgsl.expected.hlsl b/test/tint/builtins/gen/var/min/c76fa6.wgsl.expected.hlsl new file mode 100644 index 0000000000..c29c09d1ee --- /dev/null +++ b/test/tint/builtins/gen/var/min/c76fa6.wgsl.expected.hlsl @@ -0,0 +1,32 @@ +void min_c76fa6() { + float4 arg_0 = (0.0f).xxxx; + float4 arg_1 = (0.0f).xxxx; + float4 res = min(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_c76fa6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_c76fa6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_c76fa6(); + return; +} diff --git a/test/tint/builtins/gen/var/min/c76fa6.wgsl.expected.msl b/test/tint/builtins/gen/var/min/c76fa6.wgsl.expected.msl new file mode 100644 index 0000000000..698234e7c7 --- /dev/null +++ b/test/tint/builtins/gen/var/min/c76fa6.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void min_c76fa6() { + float4 arg_0 = float4(0.0f); + float4 arg_1 = float4(0.0f); + float4 res = fmin(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + min_c76fa6(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + min_c76fa6(); + return; +} + +kernel void compute_main() { + min_c76fa6(); + return; +} + diff --git a/test/tint/builtins/gen/var/min/c76fa6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/min/c76fa6.wgsl.expected.spvasm new file mode 100644 index 0000000000..a818f80302 --- /dev/null +++ b/test/tint/builtins/gen/var/min/c76fa6.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %min_c76fa6 "min_c76fa6" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %min_c76fa6 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %arg_1 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %5 + OpStore %arg_1 %5 + %18 = OpLoad %v4float %arg_0 + %19 = OpLoad %v4float %arg_1 + %16 = OpExtInst %v4float %17 NMin %18 %19 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %min_c76fa6 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %min_c76fa6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %min_c76fa6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/min/c76fa6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/min/c76fa6.wgsl.expected.wgsl new file mode 100644 index 0000000000..2ef79b46dc --- /dev/null +++ b/test/tint/builtins/gen/var/min/c76fa6.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn min_c76fa6() { + var arg_0 = vec4(); + var arg_1 = vec4(); + var res : vec4 = min(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + min_c76fa6(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + min_c76fa6(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + min_c76fa6(); +} diff --git a/test/tint/builtins/gen/var/mix/0c8c33.wgsl b/test/tint/builtins/gen/var/mix/0c8c33.wgsl new file mode 100644 index 0000000000..173a2df445 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/0c8c33.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn mix(vec<3, f32>, vec<3, f32>, vec<3, f32>) -> vec<3, f32> +fn mix_0c8c33() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var arg_2 = vec3(); + var res: vec3 = mix(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + mix_0c8c33(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + mix_0c8c33(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + mix_0c8c33(); +} diff --git a/test/tint/builtins/gen/var/mix/0c8c33.wgsl.expected.glsl b/test/tint/builtins/gen/var/mix/0c8c33.wgsl.expected.glsl new file mode 100644 index 0000000000..46331a8e2b --- /dev/null +++ b/test/tint/builtins/gen/var/mix/0c8c33.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void mix_0c8c33() { + vec3 arg_0 = vec3(0.0f); + vec3 arg_1 = vec3(0.0f); + vec3 arg_2 = vec3(0.0f); + vec3 res = mix(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + mix_0c8c33(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void mix_0c8c33() { + vec3 arg_0 = vec3(0.0f); + vec3 arg_1 = vec3(0.0f); + vec3 arg_2 = vec3(0.0f); + vec3 res = mix(arg_0, arg_1, arg_2); +} + +void fragment_main() { + mix_0c8c33(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void mix_0c8c33() { + vec3 arg_0 = vec3(0.0f); + vec3 arg_1 = vec3(0.0f); + vec3 arg_2 = vec3(0.0f); + vec3 res = mix(arg_0, arg_1, arg_2); +} + +void compute_main() { + mix_0c8c33(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/mix/0c8c33.wgsl.expected.hlsl b/test/tint/builtins/gen/var/mix/0c8c33.wgsl.expected.hlsl new file mode 100644 index 0000000000..ff0238b6a6 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/0c8c33.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +void mix_0c8c33() { + float3 arg_0 = (0.0f).xxx; + float3 arg_1 = (0.0f).xxx; + float3 arg_2 = (0.0f).xxx; + float3 res = lerp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_0c8c33(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_0c8c33(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_0c8c33(); + return; +} diff --git a/test/tint/builtins/gen/var/mix/0c8c33.wgsl.expected.msl b/test/tint/builtins/gen/var/mix/0c8c33.wgsl.expected.msl new file mode 100644 index 0000000000..0fe7746dec --- /dev/null +++ b/test/tint/builtins/gen/var/mix/0c8c33.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void mix_0c8c33() { + float3 arg_0 = float3(0.0f); + float3 arg_1 = float3(0.0f); + float3 arg_2 = float3(0.0f); + float3 res = mix(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + mix_0c8c33(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + mix_0c8c33(); + return; +} + +kernel void compute_main() { + mix_0c8c33(); + return; +} + diff --git a/test/tint/builtins/gen/var/mix/0c8c33.wgsl.expected.spvasm b/test/tint/builtins/gen/var/mix/0c8c33.wgsl.expected.spvasm new file mode 100644 index 0000000000..d741ebda8b --- /dev/null +++ b/test/tint/builtins/gen/var/mix/0c8c33.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %mix_0c8c33 "mix_0c8c33" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %14 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %mix_0c8c33 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %14 + %arg_1 = OpVariable %_ptr_Function_v3float Function %14 + %arg_2 = OpVariable %_ptr_Function_v3float Function %14 + %res = OpVariable %_ptr_Function_v3float Function %14 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + OpStore %arg_2 %14 + %21 = OpLoad %v3float %arg_0 + %22 = OpLoad %v3float %arg_1 + %23 = OpLoad %v3float %arg_2 + %19 = OpExtInst %v3float %20 FMix %21 %22 %23 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %mix_0c8c33 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %mix_0c8c33 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %mix_0c8c33 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/mix/0c8c33.wgsl.expected.wgsl b/test/tint/builtins/gen/var/mix/0c8c33.wgsl.expected.wgsl new file mode 100644 index 0000000000..feae76a73f --- /dev/null +++ b/test/tint/builtins/gen/var/mix/0c8c33.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn mix_0c8c33() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var arg_2 = vec3(); + var res : vec3 = mix(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + mix_0c8c33(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + mix_0c8c33(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + mix_0c8c33(); +} diff --git a/test/tint/builtins/gen/var/mix/1faeb1.wgsl b/test/tint/builtins/gen/var/mix/1faeb1.wgsl new file mode 100644 index 0000000000..65b8108df5 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/1faeb1.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn mix(vec<4, f32>, vec<4, f32>, f32) -> vec<4, f32> +fn mix_1faeb1() { + var arg_0 = vec4(); + var arg_1 = vec4(); + var arg_2 = 1.0; + var res: vec4 = mix(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + mix_1faeb1(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + mix_1faeb1(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + mix_1faeb1(); +} diff --git a/test/tint/builtins/gen/var/mix/1faeb1.wgsl.expected.glsl b/test/tint/builtins/gen/var/mix/1faeb1.wgsl.expected.glsl new file mode 100644 index 0000000000..1d79c6adfa --- /dev/null +++ b/test/tint/builtins/gen/var/mix/1faeb1.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void mix_1faeb1() { + vec4 arg_0 = vec4(0.0f); + vec4 arg_1 = vec4(0.0f); + float arg_2 = 1.0f; + vec4 res = mix(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + mix_1faeb1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void mix_1faeb1() { + vec4 arg_0 = vec4(0.0f); + vec4 arg_1 = vec4(0.0f); + float arg_2 = 1.0f; + vec4 res = mix(arg_0, arg_1, arg_2); +} + +void fragment_main() { + mix_1faeb1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void mix_1faeb1() { + vec4 arg_0 = vec4(0.0f); + vec4 arg_1 = vec4(0.0f); + float arg_2 = 1.0f; + vec4 res = mix(arg_0, arg_1, arg_2); +} + +void compute_main() { + mix_1faeb1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/mix/1faeb1.wgsl.expected.hlsl b/test/tint/builtins/gen/var/mix/1faeb1.wgsl.expected.hlsl new file mode 100644 index 0000000000..8be22c588e --- /dev/null +++ b/test/tint/builtins/gen/var/mix/1faeb1.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +void mix_1faeb1() { + float4 arg_0 = (0.0f).xxxx; + float4 arg_1 = (0.0f).xxxx; + float arg_2 = 1.0f; + float4 res = lerp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_1faeb1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_1faeb1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_1faeb1(); + return; +} diff --git a/test/tint/builtins/gen/var/mix/1faeb1.wgsl.expected.msl b/test/tint/builtins/gen/var/mix/1faeb1.wgsl.expected.msl new file mode 100644 index 0000000000..a2eb9bad40 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/1faeb1.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void mix_1faeb1() { + float4 arg_0 = float4(0.0f); + float4 arg_1 = float4(0.0f); + float arg_2 = 1.0f; + float4 res = mix(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + mix_1faeb1(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + mix_1faeb1(); + return; +} + +kernel void compute_main() { + mix_1faeb1(); + return; +} + diff --git a/test/tint/builtins/gen/var/mix/1faeb1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/mix/1faeb1.wgsl.expected.spvasm new file mode 100644 index 0000000000..5cfd296a2d --- /dev/null +++ b/test/tint/builtins/gen/var/mix/1faeb1.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %mix_1faeb1 "mix_1faeb1" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %27 = OpTypeFunction %v4float + %mix_1faeb1 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %arg_1 = OpVariable %_ptr_Function_v4float Function %5 + %arg_2 = OpVariable %_ptr_Function_float Function %8 + %24 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %5 + OpStore %arg_1 %5 + OpStore %arg_2 %float_1 + %21 = OpLoad %v4float %arg_0 + %22 = OpLoad %v4float %arg_1 + %23 = OpLoad %float %arg_2 + %25 = OpCompositeConstruct %v4float %23 %23 %23 %23 + %19 = OpExtInst %v4float %20 FMix %21 %22 %25 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %mix_1faeb1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %mix_1faeb1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %mix_1faeb1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/mix/1faeb1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/mix/1faeb1.wgsl.expected.wgsl new file mode 100644 index 0000000000..3d73596118 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/1faeb1.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn mix_1faeb1() { + var arg_0 = vec4(); + var arg_1 = vec4(); + var arg_2 = 1.0; + var res : vec4 = mix(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + mix_1faeb1(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + mix_1faeb1(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + mix_1faeb1(); +} diff --git a/test/tint/builtins/gen/var/mix/2fadab.wgsl b/test/tint/builtins/gen/var/mix/2fadab.wgsl new file mode 100644 index 0000000000..e7ace41bac --- /dev/null +++ b/test/tint/builtins/gen/var/mix/2fadab.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn mix(vec<2, f32>, vec<2, f32>, f32) -> vec<2, f32> +fn mix_2fadab() { + var arg_0 = vec2(); + var arg_1 = vec2(); + var arg_2 = 1.0; + var res: vec2 = mix(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + mix_2fadab(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + mix_2fadab(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + mix_2fadab(); +} diff --git a/test/tint/builtins/gen/var/mix/2fadab.wgsl.expected.glsl b/test/tint/builtins/gen/var/mix/2fadab.wgsl.expected.glsl new file mode 100644 index 0000000000..7e580edff7 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/2fadab.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void mix_2fadab() { + vec2 arg_0 = vec2(0.0f); + vec2 arg_1 = vec2(0.0f); + float arg_2 = 1.0f; + vec2 res = mix(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + mix_2fadab(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void mix_2fadab() { + vec2 arg_0 = vec2(0.0f); + vec2 arg_1 = vec2(0.0f); + float arg_2 = 1.0f; + vec2 res = mix(arg_0, arg_1, arg_2); +} + +void fragment_main() { + mix_2fadab(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void mix_2fadab() { + vec2 arg_0 = vec2(0.0f); + vec2 arg_1 = vec2(0.0f); + float arg_2 = 1.0f; + vec2 res = mix(arg_0, arg_1, arg_2); +} + +void compute_main() { + mix_2fadab(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/mix/2fadab.wgsl.expected.hlsl b/test/tint/builtins/gen/var/mix/2fadab.wgsl.expected.hlsl new file mode 100644 index 0000000000..ae442e03a5 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/2fadab.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +void mix_2fadab() { + float2 arg_0 = (0.0f).xx; + float2 arg_1 = (0.0f).xx; + float arg_2 = 1.0f; + float2 res = lerp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_2fadab(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_2fadab(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_2fadab(); + return; +} diff --git a/test/tint/builtins/gen/var/mix/2fadab.wgsl.expected.msl b/test/tint/builtins/gen/var/mix/2fadab.wgsl.expected.msl new file mode 100644 index 0000000000..8f55a01e15 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/2fadab.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void mix_2fadab() { + float2 arg_0 = float2(0.0f); + float2 arg_1 = float2(0.0f); + float arg_2 = 1.0f; + float2 res = mix(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + mix_2fadab(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + mix_2fadab(); + return; +} + +kernel void compute_main() { + mix_2fadab(); + return; +} + diff --git a/test/tint/builtins/gen/var/mix/2fadab.wgsl.expected.spvasm b/test/tint/builtins/gen/var/mix/2fadab.wgsl.expected.spvasm new file mode 100644 index 0000000000..f5cb0c6e7d --- /dev/null +++ b/test/tint/builtins/gen/var/mix/2fadab.wgsl.expected.spvasm @@ -0,0 +1,82 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 42 +; Schema: 0 + OpCapability Shader + %22 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %mix_2fadab "mix_2fadab" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %14 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %29 = OpTypeFunction %v4float + %mix_2fadab = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %14 + %arg_1 = OpVariable %_ptr_Function_v2float Function %14 + %arg_2 = OpVariable %_ptr_Function_float Function %8 + %26 = OpVariable %_ptr_Function_v2float Function %14 + %res = OpVariable %_ptr_Function_v2float Function %14 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + OpStore %arg_2 %float_1 + %23 = OpLoad %v2float %arg_0 + %24 = OpLoad %v2float %arg_1 + %25 = OpLoad %float %arg_2 + %27 = OpCompositeConstruct %v2float %25 %25 + %21 = OpExtInst %v2float %22 FMix %23 %24 %27 + OpStore %res %21 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %29 + %31 = OpLabel + %32 = OpFunctionCall %void %mix_2fadab + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %35 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %mix_2fadab + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %40 = OpLabel + %41 = OpFunctionCall %void %mix_2fadab + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/mix/2fadab.wgsl.expected.wgsl b/test/tint/builtins/gen/var/mix/2fadab.wgsl.expected.wgsl new file mode 100644 index 0000000000..8f1d4f2f92 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/2fadab.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn mix_2fadab() { + var arg_0 = vec2(); + var arg_1 = vec2(); + var arg_2 = 1.0; + var res : vec2 = mix(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + mix_2fadab(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + mix_2fadab(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + mix_2fadab(); +} diff --git a/test/tint/builtins/gen/var/mix/315264.wgsl b/test/tint/builtins/gen/var/mix/315264.wgsl new file mode 100644 index 0000000000..c396c01a6d --- /dev/null +++ b/test/tint/builtins/gen/var/mix/315264.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn mix(vec<3, f32>, vec<3, f32>, f32) -> vec<3, f32> +fn mix_315264() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var arg_2 = 1.0; + var res: vec3 = mix(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + mix_315264(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + mix_315264(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + mix_315264(); +} diff --git a/test/tint/builtins/gen/var/mix/315264.wgsl.expected.glsl b/test/tint/builtins/gen/var/mix/315264.wgsl.expected.glsl new file mode 100644 index 0000000000..5e3fea1309 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/315264.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void mix_315264() { + vec3 arg_0 = vec3(0.0f); + vec3 arg_1 = vec3(0.0f); + float arg_2 = 1.0f; + vec3 res = mix(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + mix_315264(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void mix_315264() { + vec3 arg_0 = vec3(0.0f); + vec3 arg_1 = vec3(0.0f); + float arg_2 = 1.0f; + vec3 res = mix(arg_0, arg_1, arg_2); +} + +void fragment_main() { + mix_315264(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void mix_315264() { + vec3 arg_0 = vec3(0.0f); + vec3 arg_1 = vec3(0.0f); + float arg_2 = 1.0f; + vec3 res = mix(arg_0, arg_1, arg_2); +} + +void compute_main() { + mix_315264(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/mix/315264.wgsl.expected.hlsl b/test/tint/builtins/gen/var/mix/315264.wgsl.expected.hlsl new file mode 100644 index 0000000000..d9674f4a1e --- /dev/null +++ b/test/tint/builtins/gen/var/mix/315264.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +void mix_315264() { + float3 arg_0 = (0.0f).xxx; + float3 arg_1 = (0.0f).xxx; + float arg_2 = 1.0f; + float3 res = lerp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_315264(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_315264(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_315264(); + return; +} diff --git a/test/tint/builtins/gen/var/mix/315264.wgsl.expected.msl b/test/tint/builtins/gen/var/mix/315264.wgsl.expected.msl new file mode 100644 index 0000000000..59819cc216 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/315264.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void mix_315264() { + float3 arg_0 = float3(0.0f); + float3 arg_1 = float3(0.0f); + float arg_2 = 1.0f; + float3 res = mix(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + mix_315264(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + mix_315264(); + return; +} + +kernel void compute_main() { + mix_315264(); + return; +} + diff --git a/test/tint/builtins/gen/var/mix/315264.wgsl.expected.spvasm b/test/tint/builtins/gen/var/mix/315264.wgsl.expected.spvasm new file mode 100644 index 0000000000..d5f96cec4f --- /dev/null +++ b/test/tint/builtins/gen/var/mix/315264.wgsl.expected.spvasm @@ -0,0 +1,82 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 42 +; Schema: 0 + OpCapability Shader + %22 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %mix_315264 "mix_315264" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %14 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %29 = OpTypeFunction %v4float + %mix_315264 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %14 + %arg_1 = OpVariable %_ptr_Function_v3float Function %14 + %arg_2 = OpVariable %_ptr_Function_float Function %8 + %26 = OpVariable %_ptr_Function_v3float Function %14 + %res = OpVariable %_ptr_Function_v3float Function %14 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + OpStore %arg_2 %float_1 + %23 = OpLoad %v3float %arg_0 + %24 = OpLoad %v3float %arg_1 + %25 = OpLoad %float %arg_2 + %27 = OpCompositeConstruct %v3float %25 %25 %25 + %21 = OpExtInst %v3float %22 FMix %23 %24 %27 + OpStore %res %21 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %29 + %31 = OpLabel + %32 = OpFunctionCall %void %mix_315264 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %35 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %mix_315264 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %40 = OpLabel + %41 = OpFunctionCall %void %mix_315264 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/mix/315264.wgsl.expected.wgsl b/test/tint/builtins/gen/var/mix/315264.wgsl.expected.wgsl new file mode 100644 index 0000000000..e4f84302ff --- /dev/null +++ b/test/tint/builtins/gen/var/mix/315264.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn mix_315264() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var arg_2 = 1.0; + var res : vec3 = mix(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + mix_315264(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + mix_315264(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + mix_315264(); +} diff --git a/test/tint/builtins/gen/var/mix/4f0b5e.wgsl b/test/tint/builtins/gen/var/mix/4f0b5e.wgsl new file mode 100644 index 0000000000..4e823a140f --- /dev/null +++ b/test/tint/builtins/gen/var/mix/4f0b5e.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn mix(f32, f32, f32) -> f32 +fn mix_4f0b5e() { + var arg_0 = 1.0; + var arg_1 = 1.0; + var arg_2 = 1.0; + var res: f32 = mix(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + mix_4f0b5e(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + mix_4f0b5e(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + mix_4f0b5e(); +} diff --git a/test/tint/builtins/gen/var/mix/4f0b5e.wgsl.expected.glsl b/test/tint/builtins/gen/var/mix/4f0b5e.wgsl.expected.glsl new file mode 100644 index 0000000000..4c40badba7 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/4f0b5e.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void mix_4f0b5e() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float arg_2 = 1.0f; + float res = mix(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + mix_4f0b5e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void mix_4f0b5e() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float arg_2 = 1.0f; + float res = mix(arg_0, arg_1, arg_2); +} + +void fragment_main() { + mix_4f0b5e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void mix_4f0b5e() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float arg_2 = 1.0f; + float res = mix(arg_0, arg_1, arg_2); +} + +void compute_main() { + mix_4f0b5e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/mix/4f0b5e.wgsl.expected.hlsl b/test/tint/builtins/gen/var/mix/4f0b5e.wgsl.expected.hlsl new file mode 100644 index 0000000000..3ddc02b2d0 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/4f0b5e.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +void mix_4f0b5e() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float arg_2 = 1.0f; + float res = lerp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_4f0b5e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_4f0b5e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_4f0b5e(); + return; +} diff --git a/test/tint/builtins/gen/var/mix/4f0b5e.wgsl.expected.msl b/test/tint/builtins/gen/var/mix/4f0b5e.wgsl.expected.msl new file mode 100644 index 0000000000..55238da03e --- /dev/null +++ b/test/tint/builtins/gen/var/mix/4f0b5e.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void mix_4f0b5e() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float arg_2 = 1.0f; + float res = mix(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + mix_4f0b5e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + mix_4f0b5e(); + return; +} + +kernel void compute_main() { + mix_4f0b5e(); + return; +} + diff --git a/test/tint/builtins/gen/var/mix/4f0b5e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/mix/4f0b5e.wgsl.expected.spvasm new file mode 100644 index 0000000000..a307df332e --- /dev/null +++ b/test/tint/builtins/gen/var/mix/4f0b5e.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %mix_4f0b5e "mix_4f0b5e" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %24 = OpTypeFunction %v4float + %mix_4f0b5e = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %arg_1 = OpVariable %_ptr_Function_float Function %8 + %arg_2 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + OpStore %arg_1 %float_1 + OpStore %arg_2 %float_1 + %20 = OpLoad %float %arg_0 + %21 = OpLoad %float %arg_1 + %22 = OpLoad %float %arg_2 + %18 = OpExtInst %float %19 FMix %20 %21 %22 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %mix_4f0b5e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %mix_4f0b5e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %mix_4f0b5e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/mix/4f0b5e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/mix/4f0b5e.wgsl.expected.wgsl new file mode 100644 index 0000000000..295f6efc43 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/4f0b5e.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn mix_4f0b5e() { + var arg_0 = 1.0; + var arg_1 = 1.0; + var arg_2 = 1.0; + var res : f32 = mix(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + mix_4f0b5e(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + mix_4f0b5e(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + mix_4f0b5e(); +} diff --git a/test/tint/builtins/gen/var/mix/6f8adc.wgsl b/test/tint/builtins/gen/var/mix/6f8adc.wgsl new file mode 100644 index 0000000000..e730990778 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/6f8adc.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn mix(vec<2, f32>, vec<2, f32>, vec<2, f32>) -> vec<2, f32> +fn mix_6f8adc() { + var arg_0 = vec2(); + var arg_1 = vec2(); + var arg_2 = vec2(); + var res: vec2 = mix(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + mix_6f8adc(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + mix_6f8adc(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + mix_6f8adc(); +} diff --git a/test/tint/builtins/gen/var/mix/6f8adc.wgsl.expected.glsl b/test/tint/builtins/gen/var/mix/6f8adc.wgsl.expected.glsl new file mode 100644 index 0000000000..a9e601d162 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/6f8adc.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void mix_6f8adc() { + vec2 arg_0 = vec2(0.0f); + vec2 arg_1 = vec2(0.0f); + vec2 arg_2 = vec2(0.0f); + vec2 res = mix(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + mix_6f8adc(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void mix_6f8adc() { + vec2 arg_0 = vec2(0.0f); + vec2 arg_1 = vec2(0.0f); + vec2 arg_2 = vec2(0.0f); + vec2 res = mix(arg_0, arg_1, arg_2); +} + +void fragment_main() { + mix_6f8adc(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void mix_6f8adc() { + vec2 arg_0 = vec2(0.0f); + vec2 arg_1 = vec2(0.0f); + vec2 arg_2 = vec2(0.0f); + vec2 res = mix(arg_0, arg_1, arg_2); +} + +void compute_main() { + mix_6f8adc(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/mix/6f8adc.wgsl.expected.hlsl b/test/tint/builtins/gen/var/mix/6f8adc.wgsl.expected.hlsl new file mode 100644 index 0000000000..cdfac7bc76 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/6f8adc.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +void mix_6f8adc() { + float2 arg_0 = (0.0f).xx; + float2 arg_1 = (0.0f).xx; + float2 arg_2 = (0.0f).xx; + float2 res = lerp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_6f8adc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_6f8adc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_6f8adc(); + return; +} diff --git a/test/tint/builtins/gen/var/mix/6f8adc.wgsl.expected.msl b/test/tint/builtins/gen/var/mix/6f8adc.wgsl.expected.msl new file mode 100644 index 0000000000..8f3cf6ff52 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/6f8adc.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void mix_6f8adc() { + float2 arg_0 = float2(0.0f); + float2 arg_1 = float2(0.0f); + float2 arg_2 = float2(0.0f); + float2 res = mix(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + mix_6f8adc(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + mix_6f8adc(); + return; +} + +kernel void compute_main() { + mix_6f8adc(); + return; +} + diff --git a/test/tint/builtins/gen/var/mix/6f8adc.wgsl.expected.spvasm b/test/tint/builtins/gen/var/mix/6f8adc.wgsl.expected.spvasm new file mode 100644 index 0000000000..2d989aa6a3 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/6f8adc.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %mix_6f8adc "mix_6f8adc" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %14 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %mix_6f8adc = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %14 + %arg_1 = OpVariable %_ptr_Function_v2float Function %14 + %arg_2 = OpVariable %_ptr_Function_v2float Function %14 + %res = OpVariable %_ptr_Function_v2float Function %14 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + OpStore %arg_2 %14 + %21 = OpLoad %v2float %arg_0 + %22 = OpLoad %v2float %arg_1 + %23 = OpLoad %v2float %arg_2 + %19 = OpExtInst %v2float %20 FMix %21 %22 %23 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %mix_6f8adc + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %mix_6f8adc + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %mix_6f8adc + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/mix/6f8adc.wgsl.expected.wgsl b/test/tint/builtins/gen/var/mix/6f8adc.wgsl.expected.wgsl new file mode 100644 index 0000000000..f29095a2eb --- /dev/null +++ b/test/tint/builtins/gen/var/mix/6f8adc.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn mix_6f8adc() { + var arg_0 = vec2(); + var arg_1 = vec2(); + var arg_2 = vec2(); + var res : vec2 = mix(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + mix_6f8adc(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + mix_6f8adc(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + mix_6f8adc(); +} diff --git a/test/tint/builtins/gen/var/mix/c37ede.wgsl b/test/tint/builtins/gen/var/mix/c37ede.wgsl new file mode 100644 index 0000000000..2f0259390e --- /dev/null +++ b/test/tint/builtins/gen/var/mix/c37ede.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn mix(vec<4, f32>, vec<4, f32>, vec<4, f32>) -> vec<4, f32> +fn mix_c37ede() { + var arg_0 = vec4(); + var arg_1 = vec4(); + var arg_2 = vec4(); + var res: vec4 = mix(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + mix_c37ede(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + mix_c37ede(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + mix_c37ede(); +} diff --git a/test/tint/builtins/gen/var/mix/c37ede.wgsl.expected.glsl b/test/tint/builtins/gen/var/mix/c37ede.wgsl.expected.glsl new file mode 100644 index 0000000000..eee9b05658 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/c37ede.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void mix_c37ede() { + vec4 arg_0 = vec4(0.0f); + vec4 arg_1 = vec4(0.0f); + vec4 arg_2 = vec4(0.0f); + vec4 res = mix(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + mix_c37ede(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void mix_c37ede() { + vec4 arg_0 = vec4(0.0f); + vec4 arg_1 = vec4(0.0f); + vec4 arg_2 = vec4(0.0f); + vec4 res = mix(arg_0, arg_1, arg_2); +} + +void fragment_main() { + mix_c37ede(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void mix_c37ede() { + vec4 arg_0 = vec4(0.0f); + vec4 arg_1 = vec4(0.0f); + vec4 arg_2 = vec4(0.0f); + vec4 res = mix(arg_0, arg_1, arg_2); +} + +void compute_main() { + mix_c37ede(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/mix/c37ede.wgsl.expected.hlsl b/test/tint/builtins/gen/var/mix/c37ede.wgsl.expected.hlsl new file mode 100644 index 0000000000..2ec722c26e --- /dev/null +++ b/test/tint/builtins/gen/var/mix/c37ede.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +void mix_c37ede() { + float4 arg_0 = (0.0f).xxxx; + float4 arg_1 = (0.0f).xxxx; + float4 arg_2 = (0.0f).xxxx; + float4 res = lerp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_c37ede(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_c37ede(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_c37ede(); + return; +} diff --git a/test/tint/builtins/gen/var/mix/c37ede.wgsl.expected.msl b/test/tint/builtins/gen/var/mix/c37ede.wgsl.expected.msl new file mode 100644 index 0000000000..6ee771e0f7 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/c37ede.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void mix_c37ede() { + float4 arg_0 = float4(0.0f); + float4 arg_1 = float4(0.0f); + float4 arg_2 = float4(0.0f); + float4 res = mix(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + mix_c37ede(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + mix_c37ede(); + return; +} + +kernel void compute_main() { + mix_c37ede(); + return; +} + diff --git a/test/tint/builtins/gen/var/mix/c37ede.wgsl.expected.spvasm b/test/tint/builtins/gen/var/mix/c37ede.wgsl.expected.spvasm new file mode 100644 index 0000000000..cca18b4dde --- /dev/null +++ b/test/tint/builtins/gen/var/mix/c37ede.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %mix_c37ede "mix_c37ede" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %mix_c37ede = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %arg_1 = OpVariable %_ptr_Function_v4float Function %5 + %arg_2 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %5 + OpStore %arg_1 %5 + OpStore %arg_2 %5 + %19 = OpLoad %v4float %arg_0 + %20 = OpLoad %v4float %arg_1 + %21 = OpLoad %v4float %arg_2 + %17 = OpExtInst %v4float %18 FMix %19 %20 %21 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %mix_c37ede + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %mix_c37ede + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %mix_c37ede + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/mix/c37ede.wgsl.expected.wgsl b/test/tint/builtins/gen/var/mix/c37ede.wgsl.expected.wgsl new file mode 100644 index 0000000000..ed1e7a3c8f --- /dev/null +++ b/test/tint/builtins/gen/var/mix/c37ede.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn mix_c37ede() { + var arg_0 = vec4(); + var arg_1 = vec4(); + var arg_2 = vec4(); + var res : vec4 = mix(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + mix_c37ede(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + mix_c37ede(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + mix_c37ede(); +} diff --git a/test/tint/builtins/gen/var/modf/180fed.wgsl b/test/tint/builtins/gen/var/modf/180fed.wgsl new file mode 100644 index 0000000000..aaf3f55376 --- /dev/null +++ b/test/tint/builtins/gen/var/modf/180fed.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn modf(f32) -> __modf_result +fn modf_180fed() { + var arg_0 = 1.0; + var res = modf(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + modf_180fed(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + modf_180fed(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + modf_180fed(); +} diff --git a/test/tint/builtins/gen/var/modf/180fed.wgsl.expected.glsl b/test/tint/builtins/gen/var/modf/180fed.wgsl.expected.glsl new file mode 100644 index 0000000000..c3d2897a49 --- /dev/null +++ b/test/tint/builtins/gen/var/modf/180fed.wgsl.expected.glsl @@ -0,0 +1,88 @@ +#version 310 es + +struct modf_result { + float fract; + float whole; +}; + +modf_result tint_modf(float param_0) { + modf_result result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_180fed() { + float arg_0 = 1.0f; + modf_result res = tint_modf(arg_0); +} + +vec4 vertex_main() { + modf_180fed(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +struct modf_result { + float fract; + float whole; +}; + +modf_result tint_modf(float param_0) { + modf_result result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_180fed() { + float arg_0 = 1.0f; + modf_result res = tint_modf(arg_0); +} + +void fragment_main() { + modf_180fed(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct modf_result { + float fract; + float whole; +}; + +modf_result tint_modf(float param_0) { + modf_result result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_180fed() { + float arg_0 = 1.0f; + modf_result res = tint_modf(arg_0); +} + +void compute_main() { + modf_180fed(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/modf/180fed.wgsl.expected.hlsl b/test/tint/builtins/gen/var/modf/180fed.wgsl.expected.hlsl new file mode 100644 index 0000000000..9e7075214a --- /dev/null +++ b/test/tint/builtins/gen/var/modf/180fed.wgsl.expected.hlsl @@ -0,0 +1,42 @@ +struct modf_result { + float fract; + float whole; +}; +modf_result tint_modf(float param_0) { + float whole; + float fract = modf(param_0, whole); + modf_result result = {fract, whole}; + return result; +} + +void modf_180fed() { + float arg_0 = 1.0f; + modf_result res = tint_modf(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + modf_180fed(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + modf_180fed(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + modf_180fed(); + return; +} diff --git a/test/tint/builtins/gen/var/modf/180fed.wgsl.expected.msl b/test/tint/builtins/gen/var/modf/180fed.wgsl.expected.msl new file mode 100644 index 0000000000..2dc20e6059 --- /dev/null +++ b/test/tint/builtins/gen/var/modf/180fed.wgsl.expected.msl @@ -0,0 +1,45 @@ +#include + +using namespace metal; + +struct modf_result { + float fract; + float whole; +}; +modf_result tint_modf(float param_0) { + float whole; + float fract = modf(param_0, whole); + return {fract, whole}; +} + +void modf_180fed() { + float arg_0 = 1.0f; + modf_result res = tint_modf(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + modf_180fed(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + modf_180fed(); + return; +} + +kernel void compute_main() { + modf_180fed(); + return; +} + diff --git a/test/tint/builtins/gen/var/modf/180fed.wgsl.expected.spvasm b/test/tint/builtins/gen/var/modf/180fed.wgsl.expected.spvasm new file mode 100644 index 0000000000..67e2e30541 --- /dev/null +++ b/test/tint/builtins/gen/var/modf/180fed.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %modf_180fed "modf_180fed" + OpName %arg_0 "arg_0" + OpName %__modf_result "__modf_result" + OpMemberName %__modf_result 0 "fract" + OpMemberName %__modf_result 1 "whole" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpMemberDecorate %__modf_result 0 Offset 0 + OpMemberDecorate %__modf_result 1 Offset 4 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float +%__modf_result = OpTypeStruct %float %float +%_ptr_Function___modf_result = OpTypePointer Function %__modf_result + %22 = OpConstantNull %__modf_result + %23 = OpTypeFunction %v4float +%modf_180fed = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function___modf_result Function %22 + OpStore %arg_0 %float_1 + %19 = OpLoad %float %arg_0 + %16 = OpExtInst %__modf_result %18 ModfStruct %19 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %modf_180fed + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %modf_180fed + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %modf_180fed + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/modf/180fed.wgsl.expected.wgsl b/test/tint/builtins/gen/var/modf/180fed.wgsl.expected.wgsl new file mode 100644 index 0000000000..e62aa595de --- /dev/null +++ b/test/tint/builtins/gen/var/modf/180fed.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn modf_180fed() { + var arg_0 = 1.0; + var res = modf(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + modf_180fed(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + modf_180fed(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + modf_180fed(); +} diff --git a/test/tint/builtins/gen/var/modf/9b75f7.wgsl b/test/tint/builtins/gen/var/modf/9b75f7.wgsl new file mode 100644 index 0000000000..335331a88e --- /dev/null +++ b/test/tint/builtins/gen/var/modf/9b75f7.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn modf(vec<3, f32>) -> __modf_result_vec<3> +fn modf_9b75f7() { + var arg_0 = vec3(); + var res = modf(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + modf_9b75f7(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + modf_9b75f7(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + modf_9b75f7(); +} diff --git a/test/tint/builtins/gen/var/modf/9b75f7.wgsl.expected.glsl b/test/tint/builtins/gen/var/modf/9b75f7.wgsl.expected.glsl new file mode 100644 index 0000000000..3ad1da37b8 --- /dev/null +++ b/test/tint/builtins/gen/var/modf/9b75f7.wgsl.expected.glsl @@ -0,0 +1,88 @@ +#version 310 es + +struct modf_result_vec3 { + vec3 fract; + vec3 whole; +}; + +modf_result_vec3 tint_modf(vec3 param_0) { + modf_result_vec3 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_9b75f7() { + vec3 arg_0 = vec3(0.0f); + modf_result_vec3 res = tint_modf(arg_0); +} + +vec4 vertex_main() { + modf_9b75f7(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +struct modf_result_vec3 { + vec3 fract; + vec3 whole; +}; + +modf_result_vec3 tint_modf(vec3 param_0) { + modf_result_vec3 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_9b75f7() { + vec3 arg_0 = vec3(0.0f); + modf_result_vec3 res = tint_modf(arg_0); +} + +void fragment_main() { + modf_9b75f7(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct modf_result_vec3 { + vec3 fract; + vec3 whole; +}; + +modf_result_vec3 tint_modf(vec3 param_0) { + modf_result_vec3 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_9b75f7() { + vec3 arg_0 = vec3(0.0f); + modf_result_vec3 res = tint_modf(arg_0); +} + +void compute_main() { + modf_9b75f7(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/modf/9b75f7.wgsl.expected.hlsl b/test/tint/builtins/gen/var/modf/9b75f7.wgsl.expected.hlsl new file mode 100644 index 0000000000..4eacd2ce9e --- /dev/null +++ b/test/tint/builtins/gen/var/modf/9b75f7.wgsl.expected.hlsl @@ -0,0 +1,42 @@ +struct modf_result_vec3 { + float3 fract; + float3 whole; +}; +modf_result_vec3 tint_modf(float3 param_0) { + float3 whole; + float3 fract = modf(param_0, whole); + modf_result_vec3 result = {fract, whole}; + return result; +} + +void modf_9b75f7() { + float3 arg_0 = (0.0f).xxx; + modf_result_vec3 res = tint_modf(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + modf_9b75f7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + modf_9b75f7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + modf_9b75f7(); + return; +} diff --git a/test/tint/builtins/gen/var/modf/9b75f7.wgsl.expected.msl b/test/tint/builtins/gen/var/modf/9b75f7.wgsl.expected.msl new file mode 100644 index 0000000000..704fdd5ee9 --- /dev/null +++ b/test/tint/builtins/gen/var/modf/9b75f7.wgsl.expected.msl @@ -0,0 +1,45 @@ +#include + +using namespace metal; + +struct modf_result_vec3 { + float3 fract; + float3 whole; +}; +modf_result_vec3 tint_modf(float3 param_0) { + float3 whole; + float3 fract = modf(param_0, whole); + return {fract, whole}; +} + +void modf_9b75f7() { + float3 arg_0 = float3(0.0f); + modf_result_vec3 res = tint_modf(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + modf_9b75f7(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + modf_9b75f7(); + return; +} + +kernel void compute_main() { + modf_9b75f7(); + return; +} + diff --git a/test/tint/builtins/gen/var/modf/9b75f7.wgsl.expected.spvasm b/test/tint/builtins/gen/var/modf/9b75f7.wgsl.expected.spvasm new file mode 100644 index 0000000000..23f76f32bf --- /dev/null +++ b/test/tint/builtins/gen/var/modf/9b75f7.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %modf_9b75f7 "modf_9b75f7" + OpName %arg_0 "arg_0" + OpName %__modf_result_vec3 "__modf_result_vec3" + OpMemberName %__modf_result_vec3 0 "fract" + OpMemberName %__modf_result_vec3 1 "whole" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpMemberDecorate %__modf_result_vec3 0 Offset 0 + OpMemberDecorate %__modf_result_vec3 1 Offset 16 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %14 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float +%__modf_result_vec3 = OpTypeStruct %v3float %v3float +%_ptr_Function___modf_result_vec3 = OpTypePointer Function %__modf_result_vec3 + %23 = OpConstantNull %__modf_result_vec3 + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%modf_9b75f7 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %14 + %res = OpVariable %_ptr_Function___modf_result_vec3 Function %23 + OpStore %arg_0 %14 + %20 = OpLoad %v3float %arg_0 + %17 = OpExtInst %__modf_result_vec3 %19 ModfStruct %20 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %modf_9b75f7 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %modf_9b75f7 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %modf_9b75f7 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/modf/9b75f7.wgsl.expected.wgsl b/test/tint/builtins/gen/var/modf/9b75f7.wgsl.expected.wgsl new file mode 100644 index 0000000000..ce3b3d9511 --- /dev/null +++ b/test/tint/builtins/gen/var/modf/9b75f7.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn modf_9b75f7() { + var arg_0 = vec3(); + var res = modf(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + modf_9b75f7(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + modf_9b75f7(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + modf_9b75f7(); +} diff --git a/test/tint/builtins/gen/var/modf/ec2dbc.wgsl b/test/tint/builtins/gen/var/modf/ec2dbc.wgsl new file mode 100644 index 0000000000..bd2a298447 --- /dev/null +++ b/test/tint/builtins/gen/var/modf/ec2dbc.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn modf(vec<4, f32>) -> __modf_result_vec<4> +fn modf_ec2dbc() { + var arg_0 = vec4(); + var res = modf(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + modf_ec2dbc(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + modf_ec2dbc(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + modf_ec2dbc(); +} diff --git a/test/tint/builtins/gen/var/modf/ec2dbc.wgsl.expected.glsl b/test/tint/builtins/gen/var/modf/ec2dbc.wgsl.expected.glsl new file mode 100644 index 0000000000..70f8ad6f77 --- /dev/null +++ b/test/tint/builtins/gen/var/modf/ec2dbc.wgsl.expected.glsl @@ -0,0 +1,88 @@ +#version 310 es + +struct modf_result_vec4 { + vec4 fract; + vec4 whole; +}; + +modf_result_vec4 tint_modf(vec4 param_0) { + modf_result_vec4 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_ec2dbc() { + vec4 arg_0 = vec4(0.0f); + modf_result_vec4 res = tint_modf(arg_0); +} + +vec4 vertex_main() { + modf_ec2dbc(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +struct modf_result_vec4 { + vec4 fract; + vec4 whole; +}; + +modf_result_vec4 tint_modf(vec4 param_0) { + modf_result_vec4 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_ec2dbc() { + vec4 arg_0 = vec4(0.0f); + modf_result_vec4 res = tint_modf(arg_0); +} + +void fragment_main() { + modf_ec2dbc(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct modf_result_vec4 { + vec4 fract; + vec4 whole; +}; + +modf_result_vec4 tint_modf(vec4 param_0) { + modf_result_vec4 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_ec2dbc() { + vec4 arg_0 = vec4(0.0f); + modf_result_vec4 res = tint_modf(arg_0); +} + +void compute_main() { + modf_ec2dbc(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/modf/ec2dbc.wgsl.expected.hlsl b/test/tint/builtins/gen/var/modf/ec2dbc.wgsl.expected.hlsl new file mode 100644 index 0000000000..fa4c2033cc --- /dev/null +++ b/test/tint/builtins/gen/var/modf/ec2dbc.wgsl.expected.hlsl @@ -0,0 +1,42 @@ +struct modf_result_vec4 { + float4 fract; + float4 whole; +}; +modf_result_vec4 tint_modf(float4 param_0) { + float4 whole; + float4 fract = modf(param_0, whole); + modf_result_vec4 result = {fract, whole}; + return result; +} + +void modf_ec2dbc() { + float4 arg_0 = (0.0f).xxxx; + modf_result_vec4 res = tint_modf(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + modf_ec2dbc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + modf_ec2dbc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + modf_ec2dbc(); + return; +} diff --git a/test/tint/builtins/gen/var/modf/ec2dbc.wgsl.expected.msl b/test/tint/builtins/gen/var/modf/ec2dbc.wgsl.expected.msl new file mode 100644 index 0000000000..ee835c7e16 --- /dev/null +++ b/test/tint/builtins/gen/var/modf/ec2dbc.wgsl.expected.msl @@ -0,0 +1,45 @@ +#include + +using namespace metal; + +struct modf_result_vec4 { + float4 fract; + float4 whole; +}; +modf_result_vec4 tint_modf(float4 param_0) { + float4 whole; + float4 fract = modf(param_0, whole); + return {fract, whole}; +} + +void modf_ec2dbc() { + float4 arg_0 = float4(0.0f); + modf_result_vec4 res = tint_modf(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + modf_ec2dbc(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + modf_ec2dbc(); + return; +} + +kernel void compute_main() { + modf_ec2dbc(); + return; +} + diff --git a/test/tint/builtins/gen/var/modf/ec2dbc.wgsl.expected.spvasm b/test/tint/builtins/gen/var/modf/ec2dbc.wgsl.expected.spvasm new file mode 100644 index 0000000000..e29d1764ef --- /dev/null +++ b/test/tint/builtins/gen/var/modf/ec2dbc.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %modf_ec2dbc "modf_ec2dbc" + OpName %arg_0 "arg_0" + OpName %__modf_result_vec4 "__modf_result_vec4" + OpMemberName %__modf_result_vec4 0 "fract" + OpMemberName %__modf_result_vec4 1 "whole" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpMemberDecorate %__modf_result_vec4 0 Offset 0 + OpMemberDecorate %__modf_result_vec4 1 Offset 16 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float +%__modf_result_vec4 = OpTypeStruct %v4float %v4float +%_ptr_Function___modf_result_vec4 = OpTypePointer Function %__modf_result_vec4 + %21 = OpConstantNull %__modf_result_vec4 + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%modf_ec2dbc = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function___modf_result_vec4 Function %21 + OpStore %arg_0 %5 + %18 = OpLoad %v4float %arg_0 + %15 = OpExtInst %__modf_result_vec4 %17 ModfStruct %18 + OpStore %res %15 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %modf_ec2dbc + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %modf_ec2dbc + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %modf_ec2dbc + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/modf/ec2dbc.wgsl.expected.wgsl b/test/tint/builtins/gen/var/modf/ec2dbc.wgsl.expected.wgsl new file mode 100644 index 0000000000..47cd800b1e --- /dev/null +++ b/test/tint/builtins/gen/var/modf/ec2dbc.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn modf_ec2dbc() { + var arg_0 = vec4(); + var res = modf(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + modf_ec2dbc(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + modf_ec2dbc(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + modf_ec2dbc(); +} diff --git a/test/tint/builtins/gen/var/modf/f5f20d.wgsl b/test/tint/builtins/gen/var/modf/f5f20d.wgsl new file mode 100644 index 0000000000..7111dbab17 --- /dev/null +++ b/test/tint/builtins/gen/var/modf/f5f20d.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn modf(vec<2, f32>) -> __modf_result_vec<2> +fn modf_f5f20d() { + var arg_0 = vec2(); + var res = modf(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + modf_f5f20d(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + modf_f5f20d(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + modf_f5f20d(); +} diff --git a/test/tint/builtins/gen/var/modf/f5f20d.wgsl.expected.glsl b/test/tint/builtins/gen/var/modf/f5f20d.wgsl.expected.glsl new file mode 100644 index 0000000000..9cff88042b --- /dev/null +++ b/test/tint/builtins/gen/var/modf/f5f20d.wgsl.expected.glsl @@ -0,0 +1,88 @@ +#version 310 es + +struct modf_result_vec2 { + vec2 fract; + vec2 whole; +}; + +modf_result_vec2 tint_modf(vec2 param_0) { + modf_result_vec2 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_f5f20d() { + vec2 arg_0 = vec2(0.0f); + modf_result_vec2 res = tint_modf(arg_0); +} + +vec4 vertex_main() { + modf_f5f20d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +struct modf_result_vec2 { + vec2 fract; + vec2 whole; +}; + +modf_result_vec2 tint_modf(vec2 param_0) { + modf_result_vec2 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_f5f20d() { + vec2 arg_0 = vec2(0.0f); + modf_result_vec2 res = tint_modf(arg_0); +} + +void fragment_main() { + modf_f5f20d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct modf_result_vec2 { + vec2 fract; + vec2 whole; +}; + +modf_result_vec2 tint_modf(vec2 param_0) { + modf_result_vec2 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_f5f20d() { + vec2 arg_0 = vec2(0.0f); + modf_result_vec2 res = tint_modf(arg_0); +} + +void compute_main() { + modf_f5f20d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/modf/f5f20d.wgsl.expected.hlsl b/test/tint/builtins/gen/var/modf/f5f20d.wgsl.expected.hlsl new file mode 100644 index 0000000000..0827e24ed2 --- /dev/null +++ b/test/tint/builtins/gen/var/modf/f5f20d.wgsl.expected.hlsl @@ -0,0 +1,42 @@ +struct modf_result_vec2 { + float2 fract; + float2 whole; +}; +modf_result_vec2 tint_modf(float2 param_0) { + float2 whole; + float2 fract = modf(param_0, whole); + modf_result_vec2 result = {fract, whole}; + return result; +} + +void modf_f5f20d() { + float2 arg_0 = (0.0f).xx; + modf_result_vec2 res = tint_modf(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + modf_f5f20d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + modf_f5f20d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + modf_f5f20d(); + return; +} diff --git a/test/tint/builtins/gen/var/modf/f5f20d.wgsl.expected.msl b/test/tint/builtins/gen/var/modf/f5f20d.wgsl.expected.msl new file mode 100644 index 0000000000..104caf85c7 --- /dev/null +++ b/test/tint/builtins/gen/var/modf/f5f20d.wgsl.expected.msl @@ -0,0 +1,45 @@ +#include + +using namespace metal; + +struct modf_result_vec2 { + float2 fract; + float2 whole; +}; +modf_result_vec2 tint_modf(float2 param_0) { + float2 whole; + float2 fract = modf(param_0, whole); + return {fract, whole}; +} + +void modf_f5f20d() { + float2 arg_0 = float2(0.0f); + modf_result_vec2 res = tint_modf(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + modf_f5f20d(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + modf_f5f20d(); + return; +} + +kernel void compute_main() { + modf_f5f20d(); + return; +} + diff --git a/test/tint/builtins/gen/var/modf/f5f20d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/modf/f5f20d.wgsl.expected.spvasm new file mode 100644 index 0000000000..474fcedd67 --- /dev/null +++ b/test/tint/builtins/gen/var/modf/f5f20d.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %modf_f5f20d "modf_f5f20d" + OpName %arg_0 "arg_0" + OpName %__modf_result_vec2 "__modf_result_vec2" + OpMemberName %__modf_result_vec2 0 "fract" + OpMemberName %__modf_result_vec2 1 "whole" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpMemberDecorate %__modf_result_vec2 0 Offset 0 + OpMemberDecorate %__modf_result_vec2 1 Offset 8 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %14 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float +%__modf_result_vec2 = OpTypeStruct %v2float %v2float +%_ptr_Function___modf_result_vec2 = OpTypePointer Function %__modf_result_vec2 + %23 = OpConstantNull %__modf_result_vec2 + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%modf_f5f20d = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %14 + %res = OpVariable %_ptr_Function___modf_result_vec2 Function %23 + OpStore %arg_0 %14 + %20 = OpLoad %v2float %arg_0 + %17 = OpExtInst %__modf_result_vec2 %19 ModfStruct %20 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %modf_f5f20d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %modf_f5f20d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %modf_f5f20d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/modf/f5f20d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/modf/f5f20d.wgsl.expected.wgsl new file mode 100644 index 0000000000..b31bbf2599 --- /dev/null +++ b/test/tint/builtins/gen/var/modf/f5f20d.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn modf_f5f20d() { + var arg_0 = vec2(); + var res = modf(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + modf_f5f20d(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + modf_f5f20d(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + modf_f5f20d(); +} diff --git a/test/tint/builtins/gen/var/normalize/64d8c0.wgsl b/test/tint/builtins/gen/var/normalize/64d8c0.wgsl new file mode 100644 index 0000000000..a4b5e1d17b --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/64d8c0.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn normalize(vec<3, f32>) -> vec<3, f32> +fn normalize_64d8c0() { + var arg_0 = vec3(); + var res: vec3 = normalize(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + normalize_64d8c0(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + normalize_64d8c0(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + normalize_64d8c0(); +} diff --git a/test/tint/builtins/gen/var/normalize/64d8c0.wgsl.expected.glsl b/test/tint/builtins/gen/var/normalize/64d8c0.wgsl.expected.glsl new file mode 100644 index 0000000000..3ec8eacaef --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/64d8c0.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void normalize_64d8c0() { + vec3 arg_0 = vec3(0.0f); + vec3 res = normalize(arg_0); +} + +vec4 vertex_main() { + normalize_64d8c0(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void normalize_64d8c0() { + vec3 arg_0 = vec3(0.0f); + vec3 res = normalize(arg_0); +} + +void fragment_main() { + normalize_64d8c0(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void normalize_64d8c0() { + vec3 arg_0 = vec3(0.0f); + vec3 res = normalize(arg_0); +} + +void compute_main() { + normalize_64d8c0(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/normalize/64d8c0.wgsl.expected.hlsl b/test/tint/builtins/gen/var/normalize/64d8c0.wgsl.expected.hlsl new file mode 100644 index 0000000000..973bdd54a3 --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/64d8c0.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void normalize_64d8c0() { + float3 arg_0 = (0.0f).xxx; + float3 res = normalize(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + normalize_64d8c0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + normalize_64d8c0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + normalize_64d8c0(); + return; +} diff --git a/test/tint/builtins/gen/var/normalize/64d8c0.wgsl.expected.msl b/test/tint/builtins/gen/var/normalize/64d8c0.wgsl.expected.msl new file mode 100644 index 0000000000..c29bdaacdc --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/64d8c0.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void normalize_64d8c0() { + float3 arg_0 = float3(0.0f); + float3 res = normalize(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + normalize_64d8c0(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + normalize_64d8c0(); + return; +} + +kernel void compute_main() { + normalize_64d8c0(); + return; +} + diff --git a/test/tint/builtins/gen/var/normalize/64d8c0.wgsl.expected.spvasm b/test/tint/builtins/gen/var/normalize/64d8c0.wgsl.expected.spvasm new file mode 100644 index 0000000000..5f6e51d2b4 --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/64d8c0.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %normalize_64d8c0 "normalize_64d8c0" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %14 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%normalize_64d8c0 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %14 + %res = OpVariable %_ptr_Function_v3float Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %v3float %arg_0 + %17 = OpExtInst %v3float %18 Normalize %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %normalize_64d8c0 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %normalize_64d8c0 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %normalize_64d8c0 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/normalize/64d8c0.wgsl.expected.wgsl b/test/tint/builtins/gen/var/normalize/64d8c0.wgsl.expected.wgsl new file mode 100644 index 0000000000..189ccda03a --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/64d8c0.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn normalize_64d8c0() { + var arg_0 = vec3(); + var res : vec3 = normalize(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + normalize_64d8c0(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + normalize_64d8c0(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + normalize_64d8c0(); +} diff --git a/test/tint/builtins/gen/var/normalize/9a0aab.wgsl b/test/tint/builtins/gen/var/normalize/9a0aab.wgsl new file mode 100644 index 0000000000..af2958021f --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/9a0aab.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn normalize(vec<4, f32>) -> vec<4, f32> +fn normalize_9a0aab() { + var arg_0 = vec4(); + var res: vec4 = normalize(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + normalize_9a0aab(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + normalize_9a0aab(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + normalize_9a0aab(); +} diff --git a/test/tint/builtins/gen/var/normalize/9a0aab.wgsl.expected.glsl b/test/tint/builtins/gen/var/normalize/9a0aab.wgsl.expected.glsl new file mode 100644 index 0000000000..1fd1f91222 --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/9a0aab.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void normalize_9a0aab() { + vec4 arg_0 = vec4(0.0f); + vec4 res = normalize(arg_0); +} + +vec4 vertex_main() { + normalize_9a0aab(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void normalize_9a0aab() { + vec4 arg_0 = vec4(0.0f); + vec4 res = normalize(arg_0); +} + +void fragment_main() { + normalize_9a0aab(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void normalize_9a0aab() { + vec4 arg_0 = vec4(0.0f); + vec4 res = normalize(arg_0); +} + +void compute_main() { + normalize_9a0aab(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/normalize/9a0aab.wgsl.expected.hlsl b/test/tint/builtins/gen/var/normalize/9a0aab.wgsl.expected.hlsl new file mode 100644 index 0000000000..080baf1fbb --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/9a0aab.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void normalize_9a0aab() { + float4 arg_0 = (0.0f).xxxx; + float4 res = normalize(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + normalize_9a0aab(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + normalize_9a0aab(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + normalize_9a0aab(); + return; +} diff --git a/test/tint/builtins/gen/var/normalize/9a0aab.wgsl.expected.msl b/test/tint/builtins/gen/var/normalize/9a0aab.wgsl.expected.msl new file mode 100644 index 0000000000..7a42fc081e --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/9a0aab.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void normalize_9a0aab() { + float4 arg_0 = float4(0.0f); + float4 res = normalize(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + normalize_9a0aab(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + normalize_9a0aab(); + return; +} + +kernel void compute_main() { + normalize_9a0aab(); + return; +} + diff --git a/test/tint/builtins/gen/var/normalize/9a0aab.wgsl.expected.spvasm b/test/tint/builtins/gen/var/normalize/9a0aab.wgsl.expected.spvasm new file mode 100644 index 0000000000..1711dc4c6d --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/9a0aab.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %normalize_9a0aab "normalize_9a0aab" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%normalize_9a0aab = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %5 + %17 = OpLoad %v4float %arg_0 + %15 = OpExtInst %v4float %16 Normalize %17 + OpStore %res %15 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %normalize_9a0aab + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %normalize_9a0aab + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %normalize_9a0aab + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/normalize/9a0aab.wgsl.expected.wgsl b/test/tint/builtins/gen/var/normalize/9a0aab.wgsl.expected.wgsl new file mode 100644 index 0000000000..3e8d2c5e42 --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/9a0aab.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn normalize_9a0aab() { + var arg_0 = vec4(); + var res : vec4 = normalize(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + normalize_9a0aab(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + normalize_9a0aab(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + normalize_9a0aab(); +} diff --git a/test/tint/builtins/gen/var/normalize/fc2ef1.wgsl b/test/tint/builtins/gen/var/normalize/fc2ef1.wgsl new file mode 100644 index 0000000000..018f4379ff --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/fc2ef1.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn normalize(vec<2, f32>) -> vec<2, f32> +fn normalize_fc2ef1() { + var arg_0 = vec2(); + var res: vec2 = normalize(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + normalize_fc2ef1(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + normalize_fc2ef1(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + normalize_fc2ef1(); +} diff --git a/test/tint/builtins/gen/var/normalize/fc2ef1.wgsl.expected.glsl b/test/tint/builtins/gen/var/normalize/fc2ef1.wgsl.expected.glsl new file mode 100644 index 0000000000..a4726ccf02 --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/fc2ef1.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void normalize_fc2ef1() { + vec2 arg_0 = vec2(0.0f); + vec2 res = normalize(arg_0); +} + +vec4 vertex_main() { + normalize_fc2ef1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void normalize_fc2ef1() { + vec2 arg_0 = vec2(0.0f); + vec2 res = normalize(arg_0); +} + +void fragment_main() { + normalize_fc2ef1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void normalize_fc2ef1() { + vec2 arg_0 = vec2(0.0f); + vec2 res = normalize(arg_0); +} + +void compute_main() { + normalize_fc2ef1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/normalize/fc2ef1.wgsl.expected.hlsl b/test/tint/builtins/gen/var/normalize/fc2ef1.wgsl.expected.hlsl new file mode 100644 index 0000000000..6ec72e1818 --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/fc2ef1.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void normalize_fc2ef1() { + float2 arg_0 = (0.0f).xx; + float2 res = normalize(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + normalize_fc2ef1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + normalize_fc2ef1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + normalize_fc2ef1(); + return; +} diff --git a/test/tint/builtins/gen/var/normalize/fc2ef1.wgsl.expected.msl b/test/tint/builtins/gen/var/normalize/fc2ef1.wgsl.expected.msl new file mode 100644 index 0000000000..88ebab80a2 --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/fc2ef1.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void normalize_fc2ef1() { + float2 arg_0 = float2(0.0f); + float2 res = normalize(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + normalize_fc2ef1(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + normalize_fc2ef1(); + return; +} + +kernel void compute_main() { + normalize_fc2ef1(); + return; +} + diff --git a/test/tint/builtins/gen/var/normalize/fc2ef1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/normalize/fc2ef1.wgsl.expected.spvasm new file mode 100644 index 0000000000..bed8056ca9 --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/fc2ef1.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %normalize_fc2ef1 "normalize_fc2ef1" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %14 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%normalize_fc2ef1 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %14 + %res = OpVariable %_ptr_Function_v2float Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %v2float %arg_0 + %17 = OpExtInst %v2float %18 Normalize %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %normalize_fc2ef1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %normalize_fc2ef1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %normalize_fc2ef1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/normalize/fc2ef1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/normalize/fc2ef1.wgsl.expected.wgsl new file mode 100644 index 0000000000..ccaf220eb3 --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/fc2ef1.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn normalize_fc2ef1() { + var arg_0 = vec2(); + var res : vec2 = normalize(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + normalize_fc2ef1(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + normalize_fc2ef1(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + normalize_fc2ef1(); +} diff --git a/test/tint/builtins/gen/var/pack2x16float/0e97b3.wgsl b/test/tint/builtins/gen/var/pack2x16float/0e97b3.wgsl new file mode 100644 index 0000000000..7d379ed025 --- /dev/null +++ b/test/tint/builtins/gen/var/pack2x16float/0e97b3.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn pack2x16float(vec2) -> u32 +fn pack2x16float_0e97b3() { + var arg_0 = vec2(); + var res: u32 = pack2x16float(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + pack2x16float_0e97b3(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + pack2x16float_0e97b3(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + pack2x16float_0e97b3(); +} diff --git a/test/tint/builtins/gen/var/pack2x16float/0e97b3.wgsl.expected.glsl b/test/tint/builtins/gen/var/pack2x16float/0e97b3.wgsl.expected.glsl new file mode 100644 index 0000000000..ccefb26ee8 --- /dev/null +++ b/test/tint/builtins/gen/var/pack2x16float/0e97b3.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void pack2x16float_0e97b3() { + vec2 arg_0 = vec2(0.0f); + uint res = packHalf2x16(arg_0); +} + +vec4 vertex_main() { + pack2x16float_0e97b3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void pack2x16float_0e97b3() { + vec2 arg_0 = vec2(0.0f); + uint res = packHalf2x16(arg_0); +} + +void fragment_main() { + pack2x16float_0e97b3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void pack2x16float_0e97b3() { + vec2 arg_0 = vec2(0.0f); + uint res = packHalf2x16(arg_0); +} + +void compute_main() { + pack2x16float_0e97b3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/pack2x16float/0e97b3.wgsl.expected.hlsl b/test/tint/builtins/gen/var/pack2x16float/0e97b3.wgsl.expected.hlsl new file mode 100644 index 0000000000..649e6f1da2 --- /dev/null +++ b/test/tint/builtins/gen/var/pack2x16float/0e97b3.wgsl.expected.hlsl @@ -0,0 +1,36 @@ +uint tint_pack2x16float(float2 param_0) { + uint2 i = f32tof16(param_0); + return i.x | (i.y << 16); +} + +void pack2x16float_0e97b3() { + float2 arg_0 = (0.0f).xx; + uint res = tint_pack2x16float(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pack2x16float_0e97b3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pack2x16float_0e97b3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pack2x16float_0e97b3(); + return; +} diff --git a/test/tint/builtins/gen/var/pack2x16float/0e97b3.wgsl.expected.msl b/test/tint/builtins/gen/var/pack2x16float/0e97b3.wgsl.expected.msl new file mode 100644 index 0000000000..d72649aad6 --- /dev/null +++ b/test/tint/builtins/gen/var/pack2x16float/0e97b3.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void pack2x16float_0e97b3() { + float2 arg_0 = float2(0.0f); + uint res = as_type(half2(arg_0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + pack2x16float_0e97b3(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + pack2x16float_0e97b3(); + return; +} + +kernel void compute_main() { + pack2x16float_0e97b3(); + return; +} + diff --git a/test/tint/builtins/gen/var/pack2x16float/0e97b3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/pack2x16float/0e97b3.wgsl.expected.spvasm new file mode 100644 index 0000000000..7855476f93 --- /dev/null +++ b/test/tint/builtins/gen/var/pack2x16float/0e97b3.wgsl.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %pack2x16float_0e97b3 "pack2x16float_0e97b3" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %14 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %23 = OpConstantNull %uint + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%pack2x16float_0e97b3 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %14 + %res = OpVariable %_ptr_Function_uint Function %23 + OpStore %arg_0 %14 + %20 = OpLoad %v2float %arg_0 + %17 = OpExtInst %uint %19 PackHalf2x16 %20 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %pack2x16float_0e97b3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %pack2x16float_0e97b3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %pack2x16float_0e97b3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/pack2x16float/0e97b3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/pack2x16float/0e97b3.wgsl.expected.wgsl new file mode 100644 index 0000000000..faab29ae19 --- /dev/null +++ b/test/tint/builtins/gen/var/pack2x16float/0e97b3.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn pack2x16float_0e97b3() { + var arg_0 = vec2(); + var res : u32 = pack2x16float(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + pack2x16float_0e97b3(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + pack2x16float_0e97b3(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + pack2x16float_0e97b3(); +} diff --git a/test/tint/builtins/gen/var/pack2x16snorm/6c169b.wgsl b/test/tint/builtins/gen/var/pack2x16snorm/6c169b.wgsl new file mode 100644 index 0000000000..4bba23eedd --- /dev/null +++ b/test/tint/builtins/gen/var/pack2x16snorm/6c169b.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn pack2x16snorm(vec2) -> u32 +fn pack2x16snorm_6c169b() { + var arg_0 = vec2(); + var res: u32 = pack2x16snorm(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + pack2x16snorm_6c169b(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + pack2x16snorm_6c169b(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + pack2x16snorm_6c169b(); +} diff --git a/test/tint/builtins/gen/var/pack2x16snorm/6c169b.wgsl.expected.glsl b/test/tint/builtins/gen/var/pack2x16snorm/6c169b.wgsl.expected.glsl new file mode 100644 index 0000000000..06e70da875 --- /dev/null +++ b/test/tint/builtins/gen/var/pack2x16snorm/6c169b.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void pack2x16snorm_6c169b() { + vec2 arg_0 = vec2(0.0f); + uint res = packSnorm2x16(arg_0); +} + +vec4 vertex_main() { + pack2x16snorm_6c169b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void pack2x16snorm_6c169b() { + vec2 arg_0 = vec2(0.0f); + uint res = packSnorm2x16(arg_0); +} + +void fragment_main() { + pack2x16snorm_6c169b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void pack2x16snorm_6c169b() { + vec2 arg_0 = vec2(0.0f); + uint res = packSnorm2x16(arg_0); +} + +void compute_main() { + pack2x16snorm_6c169b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/pack2x16snorm/6c169b.wgsl.expected.hlsl b/test/tint/builtins/gen/var/pack2x16snorm/6c169b.wgsl.expected.hlsl new file mode 100644 index 0000000000..c9a6e51087 --- /dev/null +++ b/test/tint/builtins/gen/var/pack2x16snorm/6c169b.wgsl.expected.hlsl @@ -0,0 +1,36 @@ +uint tint_pack2x16snorm(float2 param_0) { + int2 i = int2(round(clamp(param_0, -1.0, 1.0) * 32767.0)) & 0xffff; + return asuint(i.x | i.y << 16); +} + +void pack2x16snorm_6c169b() { + float2 arg_0 = (0.0f).xx; + uint res = tint_pack2x16snorm(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pack2x16snorm_6c169b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pack2x16snorm_6c169b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pack2x16snorm_6c169b(); + return; +} diff --git a/test/tint/builtins/gen/var/pack2x16snorm/6c169b.wgsl.expected.msl b/test/tint/builtins/gen/var/pack2x16snorm/6c169b.wgsl.expected.msl new file mode 100644 index 0000000000..64c72cf753 --- /dev/null +++ b/test/tint/builtins/gen/var/pack2x16snorm/6c169b.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void pack2x16snorm_6c169b() { + float2 arg_0 = float2(0.0f); + uint res = pack_float_to_snorm2x16(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + pack2x16snorm_6c169b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + pack2x16snorm_6c169b(); + return; +} + +kernel void compute_main() { + pack2x16snorm_6c169b(); + return; +} + diff --git a/test/tint/builtins/gen/var/pack2x16snorm/6c169b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/pack2x16snorm/6c169b.wgsl.expected.spvasm new file mode 100644 index 0000000000..daad82d957 --- /dev/null +++ b/test/tint/builtins/gen/var/pack2x16snorm/6c169b.wgsl.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %pack2x16snorm_6c169b "pack2x16snorm_6c169b" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %14 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %23 = OpConstantNull %uint + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%pack2x16snorm_6c169b = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %14 + %res = OpVariable %_ptr_Function_uint Function %23 + OpStore %arg_0 %14 + %20 = OpLoad %v2float %arg_0 + %17 = OpExtInst %uint %19 PackSnorm2x16 %20 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %pack2x16snorm_6c169b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %pack2x16snorm_6c169b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %pack2x16snorm_6c169b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/pack2x16snorm/6c169b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/pack2x16snorm/6c169b.wgsl.expected.wgsl new file mode 100644 index 0000000000..c3e4cd4ac2 --- /dev/null +++ b/test/tint/builtins/gen/var/pack2x16snorm/6c169b.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn pack2x16snorm_6c169b() { + var arg_0 = vec2(); + var res : u32 = pack2x16snorm(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + pack2x16snorm_6c169b(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + pack2x16snorm_6c169b(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + pack2x16snorm_6c169b(); +} diff --git a/test/tint/builtins/gen/var/pack2x16unorm/0f08e4.wgsl b/test/tint/builtins/gen/var/pack2x16unorm/0f08e4.wgsl new file mode 100644 index 0000000000..e00776cfde --- /dev/null +++ b/test/tint/builtins/gen/var/pack2x16unorm/0f08e4.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn pack2x16unorm(vec2) -> u32 +fn pack2x16unorm_0f08e4() { + var arg_0 = vec2(); + var res: u32 = pack2x16unorm(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + pack2x16unorm_0f08e4(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + pack2x16unorm_0f08e4(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + pack2x16unorm_0f08e4(); +} diff --git a/test/tint/builtins/gen/var/pack2x16unorm/0f08e4.wgsl.expected.glsl b/test/tint/builtins/gen/var/pack2x16unorm/0f08e4.wgsl.expected.glsl new file mode 100644 index 0000000000..374bacf713 --- /dev/null +++ b/test/tint/builtins/gen/var/pack2x16unorm/0f08e4.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void pack2x16unorm_0f08e4() { + vec2 arg_0 = vec2(0.0f); + uint res = packUnorm2x16(arg_0); +} + +vec4 vertex_main() { + pack2x16unorm_0f08e4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void pack2x16unorm_0f08e4() { + vec2 arg_0 = vec2(0.0f); + uint res = packUnorm2x16(arg_0); +} + +void fragment_main() { + pack2x16unorm_0f08e4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void pack2x16unorm_0f08e4() { + vec2 arg_0 = vec2(0.0f); + uint res = packUnorm2x16(arg_0); +} + +void compute_main() { + pack2x16unorm_0f08e4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/pack2x16unorm/0f08e4.wgsl.expected.hlsl b/test/tint/builtins/gen/var/pack2x16unorm/0f08e4.wgsl.expected.hlsl new file mode 100644 index 0000000000..3f37f6abc9 --- /dev/null +++ b/test/tint/builtins/gen/var/pack2x16unorm/0f08e4.wgsl.expected.hlsl @@ -0,0 +1,36 @@ +uint tint_pack2x16unorm(float2 param_0) { + uint2 i = uint2(round(clamp(param_0, 0.0, 1.0) * 65535.0)); + return (i.x | i.y << 16); +} + +void pack2x16unorm_0f08e4() { + float2 arg_0 = (0.0f).xx; + uint res = tint_pack2x16unorm(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pack2x16unorm_0f08e4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pack2x16unorm_0f08e4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pack2x16unorm_0f08e4(); + return; +} diff --git a/test/tint/builtins/gen/var/pack2x16unorm/0f08e4.wgsl.expected.msl b/test/tint/builtins/gen/var/pack2x16unorm/0f08e4.wgsl.expected.msl new file mode 100644 index 0000000000..5433a6d655 --- /dev/null +++ b/test/tint/builtins/gen/var/pack2x16unorm/0f08e4.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void pack2x16unorm_0f08e4() { + float2 arg_0 = float2(0.0f); + uint res = pack_float_to_unorm2x16(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + pack2x16unorm_0f08e4(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + pack2x16unorm_0f08e4(); + return; +} + +kernel void compute_main() { + pack2x16unorm_0f08e4(); + return; +} + diff --git a/test/tint/builtins/gen/var/pack2x16unorm/0f08e4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/pack2x16unorm/0f08e4.wgsl.expected.spvasm new file mode 100644 index 0000000000..6fd23d6d00 --- /dev/null +++ b/test/tint/builtins/gen/var/pack2x16unorm/0f08e4.wgsl.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %pack2x16unorm_0f08e4 "pack2x16unorm_0f08e4" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %14 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %23 = OpConstantNull %uint + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%pack2x16unorm_0f08e4 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %14 + %res = OpVariable %_ptr_Function_uint Function %23 + OpStore %arg_0 %14 + %20 = OpLoad %v2float %arg_0 + %17 = OpExtInst %uint %19 PackUnorm2x16 %20 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %pack2x16unorm_0f08e4 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %pack2x16unorm_0f08e4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %pack2x16unorm_0f08e4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/pack2x16unorm/0f08e4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/pack2x16unorm/0f08e4.wgsl.expected.wgsl new file mode 100644 index 0000000000..eb131fc529 --- /dev/null +++ b/test/tint/builtins/gen/var/pack2x16unorm/0f08e4.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn pack2x16unorm_0f08e4() { + var arg_0 = vec2(); + var res : u32 = pack2x16unorm(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + pack2x16unorm_0f08e4(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + pack2x16unorm_0f08e4(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + pack2x16unorm_0f08e4(); +} diff --git a/test/tint/builtins/gen/var/pack4x8snorm/4d22e7.wgsl b/test/tint/builtins/gen/var/pack4x8snorm/4d22e7.wgsl new file mode 100644 index 0000000000..f027dfd546 --- /dev/null +++ b/test/tint/builtins/gen/var/pack4x8snorm/4d22e7.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn pack4x8snorm(vec4) -> u32 +fn pack4x8snorm_4d22e7() { + var arg_0 = vec4(); + var res: u32 = pack4x8snorm(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + pack4x8snorm_4d22e7(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + pack4x8snorm_4d22e7(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + pack4x8snorm_4d22e7(); +} diff --git a/test/tint/builtins/gen/var/pack4x8snorm/4d22e7.wgsl.expected.glsl b/test/tint/builtins/gen/var/pack4x8snorm/4d22e7.wgsl.expected.glsl new file mode 100644 index 0000000000..d7f64834eb --- /dev/null +++ b/test/tint/builtins/gen/var/pack4x8snorm/4d22e7.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void pack4x8snorm_4d22e7() { + vec4 arg_0 = vec4(0.0f); + uint res = packSnorm4x8(arg_0); +} + +vec4 vertex_main() { + pack4x8snorm_4d22e7(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void pack4x8snorm_4d22e7() { + vec4 arg_0 = vec4(0.0f); + uint res = packSnorm4x8(arg_0); +} + +void fragment_main() { + pack4x8snorm_4d22e7(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void pack4x8snorm_4d22e7() { + vec4 arg_0 = vec4(0.0f); + uint res = packSnorm4x8(arg_0); +} + +void compute_main() { + pack4x8snorm_4d22e7(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/pack4x8snorm/4d22e7.wgsl.expected.hlsl b/test/tint/builtins/gen/var/pack4x8snorm/4d22e7.wgsl.expected.hlsl new file mode 100644 index 0000000000..bdf414bfc2 --- /dev/null +++ b/test/tint/builtins/gen/var/pack4x8snorm/4d22e7.wgsl.expected.hlsl @@ -0,0 +1,36 @@ +uint tint_pack4x8snorm(float4 param_0) { + int4 i = int4(round(clamp(param_0, -1.0, 1.0) * 127.0)) & 0xff; + return asuint(i.x | i.y << 8 | i.z << 16 | i.w << 24); +} + +void pack4x8snorm_4d22e7() { + float4 arg_0 = (0.0f).xxxx; + uint res = tint_pack4x8snorm(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pack4x8snorm_4d22e7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pack4x8snorm_4d22e7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pack4x8snorm_4d22e7(); + return; +} diff --git a/test/tint/builtins/gen/var/pack4x8snorm/4d22e7.wgsl.expected.msl b/test/tint/builtins/gen/var/pack4x8snorm/4d22e7.wgsl.expected.msl new file mode 100644 index 0000000000..5463f994bf --- /dev/null +++ b/test/tint/builtins/gen/var/pack4x8snorm/4d22e7.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void pack4x8snorm_4d22e7() { + float4 arg_0 = float4(0.0f); + uint res = pack_float_to_snorm4x8(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + pack4x8snorm_4d22e7(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + pack4x8snorm_4d22e7(); + return; +} + +kernel void compute_main() { + pack4x8snorm_4d22e7(); + return; +} + diff --git a/test/tint/builtins/gen/var/pack4x8snorm/4d22e7.wgsl.expected.spvasm b/test/tint/builtins/gen/var/pack4x8snorm/4d22e7.wgsl.expected.spvasm new file mode 100644 index 0000000000..74247cd747 --- /dev/null +++ b/test/tint/builtins/gen/var/pack4x8snorm/4d22e7.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %pack4x8snorm_4d22e7 "pack4x8snorm_4d22e7" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %21 = OpConstantNull %uint + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%pack4x8snorm_4d22e7 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_uint Function %21 + OpStore %arg_0 %5 + %18 = OpLoad %v4float %arg_0 + %15 = OpExtInst %uint %17 PackSnorm4x8 %18 + OpStore %res %15 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %pack4x8snorm_4d22e7 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %pack4x8snorm_4d22e7 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %pack4x8snorm_4d22e7 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/pack4x8snorm/4d22e7.wgsl.expected.wgsl b/test/tint/builtins/gen/var/pack4x8snorm/4d22e7.wgsl.expected.wgsl new file mode 100644 index 0000000000..18df3dbaca --- /dev/null +++ b/test/tint/builtins/gen/var/pack4x8snorm/4d22e7.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn pack4x8snorm_4d22e7() { + var arg_0 = vec4(); + var res : u32 = pack4x8snorm(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + pack4x8snorm_4d22e7(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + pack4x8snorm_4d22e7(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + pack4x8snorm_4d22e7(); +} diff --git a/test/tint/builtins/gen/var/pack4x8unorm/95c456.wgsl b/test/tint/builtins/gen/var/pack4x8unorm/95c456.wgsl new file mode 100644 index 0000000000..96dd055e92 --- /dev/null +++ b/test/tint/builtins/gen/var/pack4x8unorm/95c456.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn pack4x8unorm(vec4) -> u32 +fn pack4x8unorm_95c456() { + var arg_0 = vec4(); + var res: u32 = pack4x8unorm(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + pack4x8unorm_95c456(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + pack4x8unorm_95c456(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + pack4x8unorm_95c456(); +} diff --git a/test/tint/builtins/gen/var/pack4x8unorm/95c456.wgsl.expected.glsl b/test/tint/builtins/gen/var/pack4x8unorm/95c456.wgsl.expected.glsl new file mode 100644 index 0000000000..8e9eb906d0 --- /dev/null +++ b/test/tint/builtins/gen/var/pack4x8unorm/95c456.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void pack4x8unorm_95c456() { + vec4 arg_0 = vec4(0.0f); + uint res = packUnorm4x8(arg_0); +} + +vec4 vertex_main() { + pack4x8unorm_95c456(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void pack4x8unorm_95c456() { + vec4 arg_0 = vec4(0.0f); + uint res = packUnorm4x8(arg_0); +} + +void fragment_main() { + pack4x8unorm_95c456(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void pack4x8unorm_95c456() { + vec4 arg_0 = vec4(0.0f); + uint res = packUnorm4x8(arg_0); +} + +void compute_main() { + pack4x8unorm_95c456(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/pack4x8unorm/95c456.wgsl.expected.hlsl b/test/tint/builtins/gen/var/pack4x8unorm/95c456.wgsl.expected.hlsl new file mode 100644 index 0000000000..80d63c98d0 --- /dev/null +++ b/test/tint/builtins/gen/var/pack4x8unorm/95c456.wgsl.expected.hlsl @@ -0,0 +1,36 @@ +uint tint_pack4x8unorm(float4 param_0) { + uint4 i = uint4(round(clamp(param_0, 0.0, 1.0) * 255.0)); + return (i.x | i.y << 8 | i.z << 16 | i.w << 24); +} + +void pack4x8unorm_95c456() { + float4 arg_0 = (0.0f).xxxx; + uint res = tint_pack4x8unorm(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pack4x8unorm_95c456(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pack4x8unorm_95c456(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pack4x8unorm_95c456(); + return; +} diff --git a/test/tint/builtins/gen/var/pack4x8unorm/95c456.wgsl.expected.msl b/test/tint/builtins/gen/var/pack4x8unorm/95c456.wgsl.expected.msl new file mode 100644 index 0000000000..faab6f2318 --- /dev/null +++ b/test/tint/builtins/gen/var/pack4x8unorm/95c456.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void pack4x8unorm_95c456() { + float4 arg_0 = float4(0.0f); + uint res = pack_float_to_unorm4x8(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + pack4x8unorm_95c456(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + pack4x8unorm_95c456(); + return; +} + +kernel void compute_main() { + pack4x8unorm_95c456(); + return; +} + diff --git a/test/tint/builtins/gen/var/pack4x8unorm/95c456.wgsl.expected.spvasm b/test/tint/builtins/gen/var/pack4x8unorm/95c456.wgsl.expected.spvasm new file mode 100644 index 0000000000..cc7d9ea508 --- /dev/null +++ b/test/tint/builtins/gen/var/pack4x8unorm/95c456.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %pack4x8unorm_95c456 "pack4x8unorm_95c456" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %21 = OpConstantNull %uint + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%pack4x8unorm_95c456 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_uint Function %21 + OpStore %arg_0 %5 + %18 = OpLoad %v4float %arg_0 + %15 = OpExtInst %uint %17 PackUnorm4x8 %18 + OpStore %res %15 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %pack4x8unorm_95c456 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %pack4x8unorm_95c456 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %pack4x8unorm_95c456 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/pack4x8unorm/95c456.wgsl.expected.wgsl b/test/tint/builtins/gen/var/pack4x8unorm/95c456.wgsl.expected.wgsl new file mode 100644 index 0000000000..fab95be54b --- /dev/null +++ b/test/tint/builtins/gen/var/pack4x8unorm/95c456.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn pack4x8unorm_95c456() { + var arg_0 = vec4(); + var res : u32 = pack4x8unorm(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + pack4x8unorm_95c456(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + pack4x8unorm_95c456(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + pack4x8unorm_95c456(); +} diff --git a/test/tint/builtins/gen/var/pow/04a908.wgsl b/test/tint/builtins/gen/var/pow/04a908.wgsl new file mode 100644 index 0000000000..884e6f44fe --- /dev/null +++ b/test/tint/builtins/gen/var/pow/04a908.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn pow(vec<4, f32>, vec<4, f32>) -> vec<4, f32> +fn pow_04a908() { + var arg_0 = vec4(); + var arg_1 = vec4(); + var res: vec4 = pow(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + pow_04a908(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + pow_04a908(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + pow_04a908(); +} diff --git a/test/tint/builtins/gen/var/pow/04a908.wgsl.expected.glsl b/test/tint/builtins/gen/var/pow/04a908.wgsl.expected.glsl new file mode 100644 index 0000000000..2784abebe3 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/04a908.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void pow_04a908() { + vec4 arg_0 = vec4(0.0f); + vec4 arg_1 = vec4(0.0f); + vec4 res = pow(arg_0, arg_1); +} + +vec4 vertex_main() { + pow_04a908(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void pow_04a908() { + vec4 arg_0 = vec4(0.0f); + vec4 arg_1 = vec4(0.0f); + vec4 res = pow(arg_0, arg_1); +} + +void fragment_main() { + pow_04a908(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void pow_04a908() { + vec4 arg_0 = vec4(0.0f); + vec4 arg_1 = vec4(0.0f); + vec4 res = pow(arg_0, arg_1); +} + +void compute_main() { + pow_04a908(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/pow/04a908.wgsl.expected.hlsl b/test/tint/builtins/gen/var/pow/04a908.wgsl.expected.hlsl new file mode 100644 index 0000000000..1b851b8caa --- /dev/null +++ b/test/tint/builtins/gen/var/pow/04a908.wgsl.expected.hlsl @@ -0,0 +1,32 @@ +void pow_04a908() { + float4 arg_0 = (0.0f).xxxx; + float4 arg_1 = (0.0f).xxxx; + float4 res = pow(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pow_04a908(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pow_04a908(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pow_04a908(); + return; +} diff --git a/test/tint/builtins/gen/var/pow/04a908.wgsl.expected.msl b/test/tint/builtins/gen/var/pow/04a908.wgsl.expected.msl new file mode 100644 index 0000000000..4a9226d910 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/04a908.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void pow_04a908() { + float4 arg_0 = float4(0.0f); + float4 arg_1 = float4(0.0f); + float4 res = pow(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + pow_04a908(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + pow_04a908(); + return; +} + +kernel void compute_main() { + pow_04a908(); + return; +} + diff --git a/test/tint/builtins/gen/var/pow/04a908.wgsl.expected.spvasm b/test/tint/builtins/gen/var/pow/04a908.wgsl.expected.spvasm new file mode 100644 index 0000000000..065f1f2449 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/04a908.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %pow_04a908 "pow_04a908" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %pow_04a908 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %arg_1 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %5 + OpStore %arg_1 %5 + %18 = OpLoad %v4float %arg_0 + %19 = OpLoad %v4float %arg_1 + %16 = OpExtInst %v4float %17 Pow %18 %19 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %pow_04a908 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %pow_04a908 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %pow_04a908 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/pow/04a908.wgsl.expected.wgsl b/test/tint/builtins/gen/var/pow/04a908.wgsl.expected.wgsl new file mode 100644 index 0000000000..1409845719 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/04a908.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn pow_04a908() { + var arg_0 = vec4(); + var arg_1 = vec4(); + var res : vec4 = pow(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + pow_04a908(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + pow_04a908(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + pow_04a908(); +} diff --git a/test/tint/builtins/gen/var/pow/46e029.wgsl b/test/tint/builtins/gen/var/pow/46e029.wgsl new file mode 100644 index 0000000000..c2bee4ab08 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/46e029.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn pow(f32, f32) -> f32 +fn pow_46e029() { + var arg_0 = 1.0; + var arg_1 = 1.0; + var res: f32 = pow(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + pow_46e029(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + pow_46e029(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + pow_46e029(); +} diff --git a/test/tint/builtins/gen/var/pow/46e029.wgsl.expected.glsl b/test/tint/builtins/gen/var/pow/46e029.wgsl.expected.glsl new file mode 100644 index 0000000000..ba9d17ef10 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/46e029.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void pow_46e029() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float res = pow(arg_0, arg_1); +} + +vec4 vertex_main() { + pow_46e029(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void pow_46e029() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float res = pow(arg_0, arg_1); +} + +void fragment_main() { + pow_46e029(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void pow_46e029() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float res = pow(arg_0, arg_1); +} + +void compute_main() { + pow_46e029(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/pow/46e029.wgsl.expected.hlsl b/test/tint/builtins/gen/var/pow/46e029.wgsl.expected.hlsl new file mode 100644 index 0000000000..82b73ac2f3 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/46e029.wgsl.expected.hlsl @@ -0,0 +1,32 @@ +void pow_46e029() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float res = pow(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pow_46e029(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pow_46e029(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pow_46e029(); + return; +} diff --git a/test/tint/builtins/gen/var/pow/46e029.wgsl.expected.msl b/test/tint/builtins/gen/var/pow/46e029.wgsl.expected.msl new file mode 100644 index 0000000000..2cac6c7015 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/46e029.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void pow_46e029() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float res = pow(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + pow_46e029(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + pow_46e029(); + return; +} + +kernel void compute_main() { + pow_46e029(); + return; +} + diff --git a/test/tint/builtins/gen/var/pow/46e029.wgsl.expected.spvasm b/test/tint/builtins/gen/var/pow/46e029.wgsl.expected.spvasm new file mode 100644 index 0000000000..cbf125ff6b --- /dev/null +++ b/test/tint/builtins/gen/var/pow/46e029.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %pow_46e029 "pow_46e029" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %22 = OpTypeFunction %v4float + %pow_46e029 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %arg_1 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + OpStore %arg_1 %float_1 + %19 = OpLoad %float %arg_0 + %20 = OpLoad %float %arg_1 + %17 = OpExtInst %float %18 Pow %19 %20 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %pow_46e029 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %pow_46e029 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %pow_46e029 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/pow/46e029.wgsl.expected.wgsl b/test/tint/builtins/gen/var/pow/46e029.wgsl.expected.wgsl new file mode 100644 index 0000000000..85ddd37b90 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/46e029.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn pow_46e029() { + var arg_0 = 1.0; + var arg_1 = 1.0; + var res : f32 = pow(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + pow_46e029(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + pow_46e029(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + pow_46e029(); +} diff --git a/test/tint/builtins/gen/var/pow/4a46c9.wgsl b/test/tint/builtins/gen/var/pow/4a46c9.wgsl new file mode 100644 index 0000000000..5d991fe614 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/4a46c9.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn pow(vec<3, f32>, vec<3, f32>) -> vec<3, f32> +fn pow_4a46c9() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var res: vec3 = pow(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + pow_4a46c9(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + pow_4a46c9(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + pow_4a46c9(); +} diff --git a/test/tint/builtins/gen/var/pow/4a46c9.wgsl.expected.glsl b/test/tint/builtins/gen/var/pow/4a46c9.wgsl.expected.glsl new file mode 100644 index 0000000000..355dd52e23 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/4a46c9.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void pow_4a46c9() { + vec3 arg_0 = vec3(0.0f); + vec3 arg_1 = vec3(0.0f); + vec3 res = pow(arg_0, arg_1); +} + +vec4 vertex_main() { + pow_4a46c9(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void pow_4a46c9() { + vec3 arg_0 = vec3(0.0f); + vec3 arg_1 = vec3(0.0f); + vec3 res = pow(arg_0, arg_1); +} + +void fragment_main() { + pow_4a46c9(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void pow_4a46c9() { + vec3 arg_0 = vec3(0.0f); + vec3 arg_1 = vec3(0.0f); + vec3 res = pow(arg_0, arg_1); +} + +void compute_main() { + pow_4a46c9(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/pow/4a46c9.wgsl.expected.hlsl b/test/tint/builtins/gen/var/pow/4a46c9.wgsl.expected.hlsl new file mode 100644 index 0000000000..627b2e00fe --- /dev/null +++ b/test/tint/builtins/gen/var/pow/4a46c9.wgsl.expected.hlsl @@ -0,0 +1,32 @@ +void pow_4a46c9() { + float3 arg_0 = (0.0f).xxx; + float3 arg_1 = (0.0f).xxx; + float3 res = pow(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pow_4a46c9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pow_4a46c9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pow_4a46c9(); + return; +} diff --git a/test/tint/builtins/gen/var/pow/4a46c9.wgsl.expected.msl b/test/tint/builtins/gen/var/pow/4a46c9.wgsl.expected.msl new file mode 100644 index 0000000000..fe98d46f79 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/4a46c9.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void pow_4a46c9() { + float3 arg_0 = float3(0.0f); + float3 arg_1 = float3(0.0f); + float3 res = pow(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + pow_4a46c9(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + pow_4a46c9(); + return; +} + +kernel void compute_main() { + pow_4a46c9(); + return; +} + diff --git a/test/tint/builtins/gen/var/pow/4a46c9.wgsl.expected.spvasm b/test/tint/builtins/gen/var/pow/4a46c9.wgsl.expected.spvasm new file mode 100644 index 0000000000..aff9061001 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/4a46c9.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %pow_4a46c9 "pow_4a46c9" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %14 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %pow_4a46c9 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %14 + %arg_1 = OpVariable %_ptr_Function_v3float Function %14 + %res = OpVariable %_ptr_Function_v3float Function %14 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + %20 = OpLoad %v3float %arg_0 + %21 = OpLoad %v3float %arg_1 + %18 = OpExtInst %v3float %19 Pow %20 %21 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %pow_4a46c9 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %pow_4a46c9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %pow_4a46c9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/pow/4a46c9.wgsl.expected.wgsl b/test/tint/builtins/gen/var/pow/4a46c9.wgsl.expected.wgsl new file mode 100644 index 0000000000..71bc724d3d --- /dev/null +++ b/test/tint/builtins/gen/var/pow/4a46c9.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn pow_4a46c9() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var res : vec3 = pow(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + pow_4a46c9(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + pow_4a46c9(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + pow_4a46c9(); +} diff --git a/test/tint/builtins/gen/var/pow/e60ea5.wgsl b/test/tint/builtins/gen/var/pow/e60ea5.wgsl new file mode 100644 index 0000000000..2070ec8bb8 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/e60ea5.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn pow(vec<2, f32>, vec<2, f32>) -> vec<2, f32> +fn pow_e60ea5() { + var arg_0 = vec2(); + var arg_1 = vec2(); + var res: vec2 = pow(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + pow_e60ea5(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + pow_e60ea5(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + pow_e60ea5(); +} diff --git a/test/tint/builtins/gen/var/pow/e60ea5.wgsl.expected.glsl b/test/tint/builtins/gen/var/pow/e60ea5.wgsl.expected.glsl new file mode 100644 index 0000000000..b1537ac83c --- /dev/null +++ b/test/tint/builtins/gen/var/pow/e60ea5.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void pow_e60ea5() { + vec2 arg_0 = vec2(0.0f); + vec2 arg_1 = vec2(0.0f); + vec2 res = pow(arg_0, arg_1); +} + +vec4 vertex_main() { + pow_e60ea5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void pow_e60ea5() { + vec2 arg_0 = vec2(0.0f); + vec2 arg_1 = vec2(0.0f); + vec2 res = pow(arg_0, arg_1); +} + +void fragment_main() { + pow_e60ea5(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void pow_e60ea5() { + vec2 arg_0 = vec2(0.0f); + vec2 arg_1 = vec2(0.0f); + vec2 res = pow(arg_0, arg_1); +} + +void compute_main() { + pow_e60ea5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/pow/e60ea5.wgsl.expected.hlsl b/test/tint/builtins/gen/var/pow/e60ea5.wgsl.expected.hlsl new file mode 100644 index 0000000000..696617b479 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/e60ea5.wgsl.expected.hlsl @@ -0,0 +1,32 @@ +void pow_e60ea5() { + float2 arg_0 = (0.0f).xx; + float2 arg_1 = (0.0f).xx; + float2 res = pow(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pow_e60ea5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pow_e60ea5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pow_e60ea5(); + return; +} diff --git a/test/tint/builtins/gen/var/pow/e60ea5.wgsl.expected.msl b/test/tint/builtins/gen/var/pow/e60ea5.wgsl.expected.msl new file mode 100644 index 0000000000..a0a2d50c62 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/e60ea5.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void pow_e60ea5() { + float2 arg_0 = float2(0.0f); + float2 arg_1 = float2(0.0f); + float2 res = pow(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + pow_e60ea5(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + pow_e60ea5(); + return; +} + +kernel void compute_main() { + pow_e60ea5(); + return; +} + diff --git a/test/tint/builtins/gen/var/pow/e60ea5.wgsl.expected.spvasm b/test/tint/builtins/gen/var/pow/e60ea5.wgsl.expected.spvasm new file mode 100644 index 0000000000..0d1a493c46 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/e60ea5.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %pow_e60ea5 "pow_e60ea5" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %14 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %pow_e60ea5 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %14 + %arg_1 = OpVariable %_ptr_Function_v2float Function %14 + %res = OpVariable %_ptr_Function_v2float Function %14 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + %20 = OpLoad %v2float %arg_0 + %21 = OpLoad %v2float %arg_1 + %18 = OpExtInst %v2float %19 Pow %20 %21 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %pow_e60ea5 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %pow_e60ea5 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %pow_e60ea5 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/pow/e60ea5.wgsl.expected.wgsl b/test/tint/builtins/gen/var/pow/e60ea5.wgsl.expected.wgsl new file mode 100644 index 0000000000..65321f8048 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/e60ea5.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn pow_e60ea5() { + var arg_0 = vec2(); + var arg_1 = vec2(); + var res : vec2 = pow(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + pow_e60ea5(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + pow_e60ea5(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + pow_e60ea5(); +} diff --git a/test/tint/builtins/gen/var/radians/09b7fc.wgsl b/test/tint/builtins/gen/var/radians/09b7fc.wgsl new file mode 100644 index 0000000000..597c22d86e --- /dev/null +++ b/test/tint/builtins/gen/var/radians/09b7fc.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn radians(vec<4, f32>) -> vec<4, f32> +fn radians_09b7fc() { + var arg_0 = vec4(); + var res: vec4 = radians(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + radians_09b7fc(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + radians_09b7fc(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + radians_09b7fc(); +} diff --git a/test/tint/builtins/gen/var/radians/09b7fc.wgsl.expected.glsl b/test/tint/builtins/gen/var/radians/09b7fc.wgsl.expected.glsl new file mode 100644 index 0000000000..d0f2979bad --- /dev/null +++ b/test/tint/builtins/gen/var/radians/09b7fc.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es + +vec4 tint_radians(vec4 param_0) { + return param_0 * 0.017453292519943295474; +} + + +void radians_09b7fc() { + vec4 arg_0 = vec4(0.0f); + vec4 res = tint_radians(arg_0); +} + +vec4 vertex_main() { + radians_09b7fc(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +vec4 tint_radians(vec4 param_0) { + return param_0 * 0.017453292519943295474; +} + + +void radians_09b7fc() { + vec4 arg_0 = vec4(0.0f); + vec4 res = tint_radians(arg_0); +} + +void fragment_main() { + radians_09b7fc(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +vec4 tint_radians(vec4 param_0) { + return param_0 * 0.017453292519943295474; +} + + +void radians_09b7fc() { + vec4 arg_0 = vec4(0.0f); + vec4 res = tint_radians(arg_0); +} + +void compute_main() { + radians_09b7fc(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/radians/09b7fc.wgsl.expected.hlsl b/test/tint/builtins/gen/var/radians/09b7fc.wgsl.expected.hlsl new file mode 100644 index 0000000000..4f9b37da10 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/09b7fc.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +float4 tint_radians(float4 param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_09b7fc() { + float4 arg_0 = (0.0f).xxxx; + float4 res = tint_radians(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + radians_09b7fc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + radians_09b7fc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + radians_09b7fc(); + return; +} diff --git a/test/tint/builtins/gen/var/radians/09b7fc.wgsl.expected.msl b/test/tint/builtins/gen/var/radians/09b7fc.wgsl.expected.msl new file mode 100644 index 0000000000..69bafde5b3 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/09b7fc.wgsl.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; + +float4 tint_radians(float4 param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_09b7fc() { + float4 arg_0 = float4(0.0f); + float4 res = tint_radians(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + radians_09b7fc(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + radians_09b7fc(); + return; +} + +kernel void compute_main() { + radians_09b7fc(); + return; +} + diff --git a/test/tint/builtins/gen/var/radians/09b7fc.wgsl.expected.spvasm b/test/tint/builtins/gen/var/radians/09b7fc.wgsl.expected.spvasm new file mode 100644 index 0000000000..08873d0732 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/09b7fc.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %radians_09b7fc "radians_09b7fc" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%radians_09b7fc = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %5 + %17 = OpLoad %v4float %arg_0 + %15 = OpExtInst %v4float %16 Radians %17 + OpStore %res %15 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %radians_09b7fc + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %radians_09b7fc + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %radians_09b7fc + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/radians/09b7fc.wgsl.expected.wgsl b/test/tint/builtins/gen/var/radians/09b7fc.wgsl.expected.wgsl new file mode 100644 index 0000000000..534b5a7151 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/09b7fc.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn radians_09b7fc() { + var arg_0 = vec4(); + var res : vec4 = radians(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + radians_09b7fc(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + radians_09b7fc(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + radians_09b7fc(); +} diff --git a/test/tint/builtins/gen/var/radians/61687a.wgsl b/test/tint/builtins/gen/var/radians/61687a.wgsl new file mode 100644 index 0000000000..d757077be8 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/61687a.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn radians(vec<2, f32>) -> vec<2, f32> +fn radians_61687a() { + var arg_0 = vec2(); + var res: vec2 = radians(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + radians_61687a(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + radians_61687a(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + radians_61687a(); +} diff --git a/test/tint/builtins/gen/var/radians/61687a.wgsl.expected.glsl b/test/tint/builtins/gen/var/radians/61687a.wgsl.expected.glsl new file mode 100644 index 0000000000..4e6f019afd --- /dev/null +++ b/test/tint/builtins/gen/var/radians/61687a.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es + +vec2 tint_radians(vec2 param_0) { + return param_0 * 0.017453292519943295474; +} + + +void radians_61687a() { + vec2 arg_0 = vec2(0.0f); + vec2 res = tint_radians(arg_0); +} + +vec4 vertex_main() { + radians_61687a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +vec2 tint_radians(vec2 param_0) { + return param_0 * 0.017453292519943295474; +} + + +void radians_61687a() { + vec2 arg_0 = vec2(0.0f); + vec2 res = tint_radians(arg_0); +} + +void fragment_main() { + radians_61687a(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +vec2 tint_radians(vec2 param_0) { + return param_0 * 0.017453292519943295474; +} + + +void radians_61687a() { + vec2 arg_0 = vec2(0.0f); + vec2 res = tint_radians(arg_0); +} + +void compute_main() { + radians_61687a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/radians/61687a.wgsl.expected.hlsl b/test/tint/builtins/gen/var/radians/61687a.wgsl.expected.hlsl new file mode 100644 index 0000000000..6c128af580 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/61687a.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +float2 tint_radians(float2 param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_61687a() { + float2 arg_0 = (0.0f).xx; + float2 res = tint_radians(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + radians_61687a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + radians_61687a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + radians_61687a(); + return; +} diff --git a/test/tint/builtins/gen/var/radians/61687a.wgsl.expected.msl b/test/tint/builtins/gen/var/radians/61687a.wgsl.expected.msl new file mode 100644 index 0000000000..8f58a4bf6e --- /dev/null +++ b/test/tint/builtins/gen/var/radians/61687a.wgsl.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; + +float2 tint_radians(float2 param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_61687a() { + float2 arg_0 = float2(0.0f); + float2 res = tint_radians(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + radians_61687a(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + radians_61687a(); + return; +} + +kernel void compute_main() { + radians_61687a(); + return; +} + diff --git a/test/tint/builtins/gen/var/radians/61687a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/radians/61687a.wgsl.expected.spvasm new file mode 100644 index 0000000000..2d21f8f76f --- /dev/null +++ b/test/tint/builtins/gen/var/radians/61687a.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %radians_61687a "radians_61687a" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %14 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%radians_61687a = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %14 + %res = OpVariable %_ptr_Function_v2float Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %v2float %arg_0 + %17 = OpExtInst %v2float %18 Radians %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %radians_61687a + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %radians_61687a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %radians_61687a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/radians/61687a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/radians/61687a.wgsl.expected.wgsl new file mode 100644 index 0000000000..6591863e7e --- /dev/null +++ b/test/tint/builtins/gen/var/radians/61687a.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn radians_61687a() { + var arg_0 = vec2(); + var res : vec2 = radians(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + radians_61687a(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + radians_61687a(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + radians_61687a(); +} diff --git a/test/tint/builtins/gen/var/radians/6b0ff2.wgsl b/test/tint/builtins/gen/var/radians/6b0ff2.wgsl new file mode 100644 index 0000000000..58d83efb34 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/6b0ff2.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn radians(f32) -> f32 +fn radians_6b0ff2() { + var arg_0 = 1.0; + var res: f32 = radians(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + radians_6b0ff2(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + radians_6b0ff2(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + radians_6b0ff2(); +} diff --git a/test/tint/builtins/gen/var/radians/6b0ff2.wgsl.expected.glsl b/test/tint/builtins/gen/var/radians/6b0ff2.wgsl.expected.glsl new file mode 100644 index 0000000000..bac70b56a4 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/6b0ff2.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es + +float tint_radians(float param_0) { + return param_0 * 0.017453292519943295474; +} + + +void radians_6b0ff2() { + float arg_0 = 1.0f; + float res = tint_radians(arg_0); +} + +vec4 vertex_main() { + radians_6b0ff2(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +float tint_radians(float param_0) { + return param_0 * 0.017453292519943295474; +} + + +void radians_6b0ff2() { + float arg_0 = 1.0f; + float res = tint_radians(arg_0); +} + +void fragment_main() { + radians_6b0ff2(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +float tint_radians(float param_0) { + return param_0 * 0.017453292519943295474; +} + + +void radians_6b0ff2() { + float arg_0 = 1.0f; + float res = tint_radians(arg_0); +} + +void compute_main() { + radians_6b0ff2(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/radians/6b0ff2.wgsl.expected.hlsl b/test/tint/builtins/gen/var/radians/6b0ff2.wgsl.expected.hlsl new file mode 100644 index 0000000000..e10a17da63 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/6b0ff2.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +float tint_radians(float param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_6b0ff2() { + float arg_0 = 1.0f; + float res = tint_radians(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + radians_6b0ff2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + radians_6b0ff2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + radians_6b0ff2(); + return; +} diff --git a/test/tint/builtins/gen/var/radians/6b0ff2.wgsl.expected.msl b/test/tint/builtins/gen/var/radians/6b0ff2.wgsl.expected.msl new file mode 100644 index 0000000000..8a969a7539 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/6b0ff2.wgsl.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; + +float tint_radians(float param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_6b0ff2() { + float arg_0 = 1.0f; + float res = tint_radians(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + radians_6b0ff2(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + radians_6b0ff2(); + return; +} + +kernel void compute_main() { + radians_6b0ff2(); + return; +} + diff --git a/test/tint/builtins/gen/var/radians/6b0ff2.wgsl.expected.spvasm b/test/tint/builtins/gen/var/radians/6b0ff2.wgsl.expected.spvasm new file mode 100644 index 0000000000..ddbe63a331 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/6b0ff2.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %radians_6b0ff2 "radians_6b0ff2" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %20 = OpTypeFunction %v4float +%radians_6b0ff2 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + %18 = OpLoad %float %arg_0 + %16 = OpExtInst %float %17 Radians %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %radians_6b0ff2 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %radians_6b0ff2 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %radians_6b0ff2 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/radians/6b0ff2.wgsl.expected.wgsl b/test/tint/builtins/gen/var/radians/6b0ff2.wgsl.expected.wgsl new file mode 100644 index 0000000000..ab1a3872f6 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/6b0ff2.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn radians_6b0ff2() { + var arg_0 = 1.0; + var res : f32 = radians(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + radians_6b0ff2(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + radians_6b0ff2(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + radians_6b0ff2(); +} diff --git a/test/tint/builtins/gen/var/radians/f96258.wgsl b/test/tint/builtins/gen/var/radians/f96258.wgsl new file mode 100644 index 0000000000..77c37c6141 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/f96258.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn radians(vec<3, f32>) -> vec<3, f32> +fn radians_f96258() { + var arg_0 = vec3(); + var res: vec3 = radians(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + radians_f96258(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + radians_f96258(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + radians_f96258(); +} diff --git a/test/tint/builtins/gen/var/radians/f96258.wgsl.expected.glsl b/test/tint/builtins/gen/var/radians/f96258.wgsl.expected.glsl new file mode 100644 index 0000000000..e0d0b287f6 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/f96258.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es + +vec3 tint_radians(vec3 param_0) { + return param_0 * 0.017453292519943295474; +} + + +void radians_f96258() { + vec3 arg_0 = vec3(0.0f); + vec3 res = tint_radians(arg_0); +} + +vec4 vertex_main() { + radians_f96258(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +vec3 tint_radians(vec3 param_0) { + return param_0 * 0.017453292519943295474; +} + + +void radians_f96258() { + vec3 arg_0 = vec3(0.0f); + vec3 res = tint_radians(arg_0); +} + +void fragment_main() { + radians_f96258(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +vec3 tint_radians(vec3 param_0) { + return param_0 * 0.017453292519943295474; +} + + +void radians_f96258() { + vec3 arg_0 = vec3(0.0f); + vec3 res = tint_radians(arg_0); +} + +void compute_main() { + radians_f96258(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/radians/f96258.wgsl.expected.hlsl b/test/tint/builtins/gen/var/radians/f96258.wgsl.expected.hlsl new file mode 100644 index 0000000000..352a0b1669 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/f96258.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +float3 tint_radians(float3 param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_f96258() { + float3 arg_0 = (0.0f).xxx; + float3 res = tint_radians(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + radians_f96258(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + radians_f96258(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + radians_f96258(); + return; +} diff --git a/test/tint/builtins/gen/var/radians/f96258.wgsl.expected.msl b/test/tint/builtins/gen/var/radians/f96258.wgsl.expected.msl new file mode 100644 index 0000000000..eb9013e51e --- /dev/null +++ b/test/tint/builtins/gen/var/radians/f96258.wgsl.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; + +float3 tint_radians(float3 param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_f96258() { + float3 arg_0 = float3(0.0f); + float3 res = tint_radians(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + radians_f96258(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + radians_f96258(); + return; +} + +kernel void compute_main() { + radians_f96258(); + return; +} + diff --git a/test/tint/builtins/gen/var/radians/f96258.wgsl.expected.spvasm b/test/tint/builtins/gen/var/radians/f96258.wgsl.expected.spvasm new file mode 100644 index 0000000000..3c05455bf2 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/f96258.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %radians_f96258 "radians_f96258" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %14 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%radians_f96258 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %14 + %res = OpVariable %_ptr_Function_v3float Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %v3float %arg_0 + %17 = OpExtInst %v3float %18 Radians %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %radians_f96258 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %radians_f96258 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %radians_f96258 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/radians/f96258.wgsl.expected.wgsl b/test/tint/builtins/gen/var/radians/f96258.wgsl.expected.wgsl new file mode 100644 index 0000000000..eaf3040cfe --- /dev/null +++ b/test/tint/builtins/gen/var/radians/f96258.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn radians_f96258() { + var arg_0 = vec3(); + var res : vec3 = radians(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + radians_f96258(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + radians_f96258(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + radians_f96258(); +} diff --git a/test/tint/builtins/gen/var/reflect/05357e.wgsl b/test/tint/builtins/gen/var/reflect/05357e.wgsl new file mode 100644 index 0000000000..4eca0e91bc --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/05357e.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn reflect(vec<4, f32>, vec<4, f32>) -> vec<4, f32> +fn reflect_05357e() { + var arg_0 = vec4(); + var arg_1 = vec4(); + var res: vec4 = reflect(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + reflect_05357e(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + reflect_05357e(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + reflect_05357e(); +} diff --git a/test/tint/builtins/gen/var/reflect/05357e.wgsl.expected.glsl b/test/tint/builtins/gen/var/reflect/05357e.wgsl.expected.glsl new file mode 100644 index 0000000000..2b9cec1995 --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/05357e.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void reflect_05357e() { + vec4 arg_0 = vec4(0.0f); + vec4 arg_1 = vec4(0.0f); + vec4 res = reflect(arg_0, arg_1); +} + +vec4 vertex_main() { + reflect_05357e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void reflect_05357e() { + vec4 arg_0 = vec4(0.0f); + vec4 arg_1 = vec4(0.0f); + vec4 res = reflect(arg_0, arg_1); +} + +void fragment_main() { + reflect_05357e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void reflect_05357e() { + vec4 arg_0 = vec4(0.0f); + vec4 arg_1 = vec4(0.0f); + vec4 res = reflect(arg_0, arg_1); +} + +void compute_main() { + reflect_05357e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/reflect/05357e.wgsl.expected.hlsl b/test/tint/builtins/gen/var/reflect/05357e.wgsl.expected.hlsl new file mode 100644 index 0000000000..28d8c4e322 --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/05357e.wgsl.expected.hlsl @@ -0,0 +1,32 @@ +void reflect_05357e() { + float4 arg_0 = (0.0f).xxxx; + float4 arg_1 = (0.0f).xxxx; + float4 res = reflect(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reflect_05357e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reflect_05357e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reflect_05357e(); + return; +} diff --git a/test/tint/builtins/gen/var/reflect/05357e.wgsl.expected.msl b/test/tint/builtins/gen/var/reflect/05357e.wgsl.expected.msl new file mode 100644 index 0000000000..a0c716ba47 --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/05357e.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void reflect_05357e() { + float4 arg_0 = float4(0.0f); + float4 arg_1 = float4(0.0f); + float4 res = reflect(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + reflect_05357e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + reflect_05357e(); + return; +} + +kernel void compute_main() { + reflect_05357e(); + return; +} + diff --git a/test/tint/builtins/gen/var/reflect/05357e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/reflect/05357e.wgsl.expected.spvasm new file mode 100644 index 0000000000..b3c6c7de6e --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/05357e.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %reflect_05357e "reflect_05357e" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%reflect_05357e = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %arg_1 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %5 + OpStore %arg_1 %5 + %18 = OpLoad %v4float %arg_0 + %19 = OpLoad %v4float %arg_1 + %16 = OpExtInst %v4float %17 Reflect %18 %19 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %reflect_05357e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %reflect_05357e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %reflect_05357e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/reflect/05357e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/reflect/05357e.wgsl.expected.wgsl new file mode 100644 index 0000000000..2172c634cf --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/05357e.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn reflect_05357e() { + var arg_0 = vec4(); + var arg_1 = vec4(); + var res : vec4 = reflect(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + reflect_05357e(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + reflect_05357e(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + reflect_05357e(); +} diff --git a/test/tint/builtins/gen/var/reflect/b61e10.wgsl b/test/tint/builtins/gen/var/reflect/b61e10.wgsl new file mode 100644 index 0000000000..e522b9ebc2 --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/b61e10.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn reflect(vec<2, f32>, vec<2, f32>) -> vec<2, f32> +fn reflect_b61e10() { + var arg_0 = vec2(); + var arg_1 = vec2(); + var res: vec2 = reflect(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + reflect_b61e10(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + reflect_b61e10(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + reflect_b61e10(); +} diff --git a/test/tint/builtins/gen/var/reflect/b61e10.wgsl.expected.glsl b/test/tint/builtins/gen/var/reflect/b61e10.wgsl.expected.glsl new file mode 100644 index 0000000000..716303eb5a --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/b61e10.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void reflect_b61e10() { + vec2 arg_0 = vec2(0.0f); + vec2 arg_1 = vec2(0.0f); + vec2 res = reflect(arg_0, arg_1); +} + +vec4 vertex_main() { + reflect_b61e10(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void reflect_b61e10() { + vec2 arg_0 = vec2(0.0f); + vec2 arg_1 = vec2(0.0f); + vec2 res = reflect(arg_0, arg_1); +} + +void fragment_main() { + reflect_b61e10(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void reflect_b61e10() { + vec2 arg_0 = vec2(0.0f); + vec2 arg_1 = vec2(0.0f); + vec2 res = reflect(arg_0, arg_1); +} + +void compute_main() { + reflect_b61e10(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/reflect/b61e10.wgsl.expected.hlsl b/test/tint/builtins/gen/var/reflect/b61e10.wgsl.expected.hlsl new file mode 100644 index 0000000000..c653e766a0 --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/b61e10.wgsl.expected.hlsl @@ -0,0 +1,32 @@ +void reflect_b61e10() { + float2 arg_0 = (0.0f).xx; + float2 arg_1 = (0.0f).xx; + float2 res = reflect(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reflect_b61e10(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reflect_b61e10(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reflect_b61e10(); + return; +} diff --git a/test/tint/builtins/gen/var/reflect/b61e10.wgsl.expected.msl b/test/tint/builtins/gen/var/reflect/b61e10.wgsl.expected.msl new file mode 100644 index 0000000000..c2fe687af2 --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/b61e10.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void reflect_b61e10() { + float2 arg_0 = float2(0.0f); + float2 arg_1 = float2(0.0f); + float2 res = reflect(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + reflect_b61e10(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + reflect_b61e10(); + return; +} + +kernel void compute_main() { + reflect_b61e10(); + return; +} + diff --git a/test/tint/builtins/gen/var/reflect/b61e10.wgsl.expected.spvasm b/test/tint/builtins/gen/var/reflect/b61e10.wgsl.expected.spvasm new file mode 100644 index 0000000000..268d6494f7 --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/b61e10.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %reflect_b61e10 "reflect_b61e10" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %14 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%reflect_b61e10 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %14 + %arg_1 = OpVariable %_ptr_Function_v2float Function %14 + %res = OpVariable %_ptr_Function_v2float Function %14 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + %20 = OpLoad %v2float %arg_0 + %21 = OpLoad %v2float %arg_1 + %18 = OpExtInst %v2float %19 Reflect %20 %21 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %reflect_b61e10 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %reflect_b61e10 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %reflect_b61e10 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/reflect/b61e10.wgsl.expected.wgsl b/test/tint/builtins/gen/var/reflect/b61e10.wgsl.expected.wgsl new file mode 100644 index 0000000000..3fca9bb35f --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/b61e10.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn reflect_b61e10() { + var arg_0 = vec2(); + var arg_1 = vec2(); + var res : vec2 = reflect(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + reflect_b61e10(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + reflect_b61e10(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + reflect_b61e10(); +} diff --git a/test/tint/builtins/gen/var/reflect/f47fdb.wgsl b/test/tint/builtins/gen/var/reflect/f47fdb.wgsl new file mode 100644 index 0000000000..2bc5f6c5cd --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/f47fdb.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn reflect(vec<3, f32>, vec<3, f32>) -> vec<3, f32> +fn reflect_f47fdb() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var res: vec3 = reflect(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + reflect_f47fdb(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + reflect_f47fdb(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + reflect_f47fdb(); +} diff --git a/test/tint/builtins/gen/var/reflect/f47fdb.wgsl.expected.glsl b/test/tint/builtins/gen/var/reflect/f47fdb.wgsl.expected.glsl new file mode 100644 index 0000000000..1cb8b9bfb1 --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/f47fdb.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void reflect_f47fdb() { + vec3 arg_0 = vec3(0.0f); + vec3 arg_1 = vec3(0.0f); + vec3 res = reflect(arg_0, arg_1); +} + +vec4 vertex_main() { + reflect_f47fdb(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void reflect_f47fdb() { + vec3 arg_0 = vec3(0.0f); + vec3 arg_1 = vec3(0.0f); + vec3 res = reflect(arg_0, arg_1); +} + +void fragment_main() { + reflect_f47fdb(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void reflect_f47fdb() { + vec3 arg_0 = vec3(0.0f); + vec3 arg_1 = vec3(0.0f); + vec3 res = reflect(arg_0, arg_1); +} + +void compute_main() { + reflect_f47fdb(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/reflect/f47fdb.wgsl.expected.hlsl b/test/tint/builtins/gen/var/reflect/f47fdb.wgsl.expected.hlsl new file mode 100644 index 0000000000..bf902cd453 --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/f47fdb.wgsl.expected.hlsl @@ -0,0 +1,32 @@ +void reflect_f47fdb() { + float3 arg_0 = (0.0f).xxx; + float3 arg_1 = (0.0f).xxx; + float3 res = reflect(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reflect_f47fdb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reflect_f47fdb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reflect_f47fdb(); + return; +} diff --git a/test/tint/builtins/gen/var/reflect/f47fdb.wgsl.expected.msl b/test/tint/builtins/gen/var/reflect/f47fdb.wgsl.expected.msl new file mode 100644 index 0000000000..abb89d33b5 --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/f47fdb.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void reflect_f47fdb() { + float3 arg_0 = float3(0.0f); + float3 arg_1 = float3(0.0f); + float3 res = reflect(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + reflect_f47fdb(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + reflect_f47fdb(); + return; +} + +kernel void compute_main() { + reflect_f47fdb(); + return; +} + diff --git a/test/tint/builtins/gen/var/reflect/f47fdb.wgsl.expected.spvasm b/test/tint/builtins/gen/var/reflect/f47fdb.wgsl.expected.spvasm new file mode 100644 index 0000000000..db5cf48063 --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/f47fdb.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %reflect_f47fdb "reflect_f47fdb" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %14 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%reflect_f47fdb = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %14 + %arg_1 = OpVariable %_ptr_Function_v3float Function %14 + %res = OpVariable %_ptr_Function_v3float Function %14 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + %20 = OpLoad %v3float %arg_0 + %21 = OpLoad %v3float %arg_1 + %18 = OpExtInst %v3float %19 Reflect %20 %21 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %reflect_f47fdb + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %reflect_f47fdb + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %reflect_f47fdb + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/reflect/f47fdb.wgsl.expected.wgsl b/test/tint/builtins/gen/var/reflect/f47fdb.wgsl.expected.wgsl new file mode 100644 index 0000000000..57b54ed321 --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/f47fdb.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn reflect_f47fdb() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var res : vec3 = reflect(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + reflect_f47fdb(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + reflect_f47fdb(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + reflect_f47fdb(); +} diff --git a/test/tint/builtins/gen/var/refract/7e02e6.wgsl b/test/tint/builtins/gen/var/refract/7e02e6.wgsl new file mode 100644 index 0000000000..0779089377 --- /dev/null +++ b/test/tint/builtins/gen/var/refract/7e02e6.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn refract(vec<4, f32>, vec<4, f32>, f32) -> vec<4, f32> +fn refract_7e02e6() { + var arg_0 = vec4(); + var arg_1 = vec4(); + var arg_2 = 1.0; + var res: vec4 = refract(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + refract_7e02e6(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + refract_7e02e6(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + refract_7e02e6(); +} diff --git a/test/tint/builtins/gen/var/refract/7e02e6.wgsl.expected.glsl b/test/tint/builtins/gen/var/refract/7e02e6.wgsl.expected.glsl new file mode 100644 index 0000000000..72c750d4b6 --- /dev/null +++ b/test/tint/builtins/gen/var/refract/7e02e6.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void refract_7e02e6() { + vec4 arg_0 = vec4(0.0f); + vec4 arg_1 = vec4(0.0f); + float arg_2 = 1.0f; + vec4 res = refract(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + refract_7e02e6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void refract_7e02e6() { + vec4 arg_0 = vec4(0.0f); + vec4 arg_1 = vec4(0.0f); + float arg_2 = 1.0f; + vec4 res = refract(arg_0, arg_1, arg_2); +} + +void fragment_main() { + refract_7e02e6(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void refract_7e02e6() { + vec4 arg_0 = vec4(0.0f); + vec4 arg_1 = vec4(0.0f); + float arg_2 = 1.0f; + vec4 res = refract(arg_0, arg_1, arg_2); +} + +void compute_main() { + refract_7e02e6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/refract/7e02e6.wgsl.expected.hlsl b/test/tint/builtins/gen/var/refract/7e02e6.wgsl.expected.hlsl new file mode 100644 index 0000000000..87895aece3 --- /dev/null +++ b/test/tint/builtins/gen/var/refract/7e02e6.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +void refract_7e02e6() { + float4 arg_0 = (0.0f).xxxx; + float4 arg_1 = (0.0f).xxxx; + float arg_2 = 1.0f; + float4 res = refract(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + refract_7e02e6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + refract_7e02e6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + refract_7e02e6(); + return; +} diff --git a/test/tint/builtins/gen/var/refract/7e02e6.wgsl.expected.msl b/test/tint/builtins/gen/var/refract/7e02e6.wgsl.expected.msl new file mode 100644 index 0000000000..c0304bb5e0 --- /dev/null +++ b/test/tint/builtins/gen/var/refract/7e02e6.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void refract_7e02e6() { + float4 arg_0 = float4(0.0f); + float4 arg_1 = float4(0.0f); + float arg_2 = 1.0f; + float4 res = refract(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + refract_7e02e6(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + refract_7e02e6(); + return; +} + +kernel void compute_main() { + refract_7e02e6(); + return; +} + diff --git a/test/tint/builtins/gen/var/refract/7e02e6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/refract/7e02e6.wgsl.expected.spvasm new file mode 100644 index 0000000000..d40bbec0f9 --- /dev/null +++ b/test/tint/builtins/gen/var/refract/7e02e6.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %refract_7e02e6 "refract_7e02e6" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %25 = OpTypeFunction %v4float +%refract_7e02e6 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %arg_1 = OpVariable %_ptr_Function_v4float Function %5 + %arg_2 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %5 + OpStore %arg_1 %5 + OpStore %arg_2 %float_1 + %21 = OpLoad %v4float %arg_0 + %22 = OpLoad %v4float %arg_1 + %23 = OpLoad %float %arg_2 + %19 = OpExtInst %v4float %20 Refract %21 %22 %23 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %refract_7e02e6 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %refract_7e02e6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %refract_7e02e6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/refract/7e02e6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/refract/7e02e6.wgsl.expected.wgsl new file mode 100644 index 0000000000..747e9924bd --- /dev/null +++ b/test/tint/builtins/gen/var/refract/7e02e6.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn refract_7e02e6() { + var arg_0 = vec4(); + var arg_1 = vec4(); + var arg_2 = 1.0; + var res : vec4 = refract(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + refract_7e02e6(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + refract_7e02e6(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + refract_7e02e6(); +} diff --git a/test/tint/builtins/gen/var/refract/cbc1d2.wgsl b/test/tint/builtins/gen/var/refract/cbc1d2.wgsl new file mode 100644 index 0000000000..e84c072fdc --- /dev/null +++ b/test/tint/builtins/gen/var/refract/cbc1d2.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn refract(vec<3, f32>, vec<3, f32>, f32) -> vec<3, f32> +fn refract_cbc1d2() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var arg_2 = 1.0; + var res: vec3 = refract(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + refract_cbc1d2(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + refract_cbc1d2(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + refract_cbc1d2(); +} diff --git a/test/tint/builtins/gen/var/refract/cbc1d2.wgsl.expected.glsl b/test/tint/builtins/gen/var/refract/cbc1d2.wgsl.expected.glsl new file mode 100644 index 0000000000..248a460c5c --- /dev/null +++ b/test/tint/builtins/gen/var/refract/cbc1d2.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void refract_cbc1d2() { + vec3 arg_0 = vec3(0.0f); + vec3 arg_1 = vec3(0.0f); + float arg_2 = 1.0f; + vec3 res = refract(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + refract_cbc1d2(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void refract_cbc1d2() { + vec3 arg_0 = vec3(0.0f); + vec3 arg_1 = vec3(0.0f); + float arg_2 = 1.0f; + vec3 res = refract(arg_0, arg_1, arg_2); +} + +void fragment_main() { + refract_cbc1d2(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void refract_cbc1d2() { + vec3 arg_0 = vec3(0.0f); + vec3 arg_1 = vec3(0.0f); + float arg_2 = 1.0f; + vec3 res = refract(arg_0, arg_1, arg_2); +} + +void compute_main() { + refract_cbc1d2(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/refract/cbc1d2.wgsl.expected.hlsl b/test/tint/builtins/gen/var/refract/cbc1d2.wgsl.expected.hlsl new file mode 100644 index 0000000000..bf241e068d --- /dev/null +++ b/test/tint/builtins/gen/var/refract/cbc1d2.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +void refract_cbc1d2() { + float3 arg_0 = (0.0f).xxx; + float3 arg_1 = (0.0f).xxx; + float arg_2 = 1.0f; + float3 res = refract(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + refract_cbc1d2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + refract_cbc1d2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + refract_cbc1d2(); + return; +} diff --git a/test/tint/builtins/gen/var/refract/cbc1d2.wgsl.expected.msl b/test/tint/builtins/gen/var/refract/cbc1d2.wgsl.expected.msl new file mode 100644 index 0000000000..e9d61c08c8 --- /dev/null +++ b/test/tint/builtins/gen/var/refract/cbc1d2.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void refract_cbc1d2() { + float3 arg_0 = float3(0.0f); + float3 arg_1 = float3(0.0f); + float arg_2 = 1.0f; + float3 res = refract(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + refract_cbc1d2(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + refract_cbc1d2(); + return; +} + +kernel void compute_main() { + refract_cbc1d2(); + return; +} + diff --git a/test/tint/builtins/gen/var/refract/cbc1d2.wgsl.expected.spvasm b/test/tint/builtins/gen/var/refract/cbc1d2.wgsl.expected.spvasm new file mode 100644 index 0000000000..d0498ff0da --- /dev/null +++ b/test/tint/builtins/gen/var/refract/cbc1d2.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + %22 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %refract_cbc1d2 "refract_cbc1d2" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %14 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %27 = OpTypeFunction %v4float +%refract_cbc1d2 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %14 + %arg_1 = OpVariable %_ptr_Function_v3float Function %14 + %arg_2 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_v3float Function %14 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + OpStore %arg_2 %float_1 + %23 = OpLoad %v3float %arg_0 + %24 = OpLoad %v3float %arg_1 + %25 = OpLoad %float %arg_2 + %21 = OpExtInst %v3float %22 Refract %23 %24 %25 + OpStore %res %21 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %refract_cbc1d2 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %refract_cbc1d2 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %refract_cbc1d2 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/refract/cbc1d2.wgsl.expected.wgsl b/test/tint/builtins/gen/var/refract/cbc1d2.wgsl.expected.wgsl new file mode 100644 index 0000000000..d71d17224e --- /dev/null +++ b/test/tint/builtins/gen/var/refract/cbc1d2.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn refract_cbc1d2() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var arg_2 = 1.0; + var res : vec3 = refract(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + refract_cbc1d2(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + refract_cbc1d2(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + refract_cbc1d2(); +} diff --git a/test/tint/builtins/gen/var/refract/cd905f.wgsl b/test/tint/builtins/gen/var/refract/cd905f.wgsl new file mode 100644 index 0000000000..50675c7918 --- /dev/null +++ b/test/tint/builtins/gen/var/refract/cd905f.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn refract(vec<2, f32>, vec<2, f32>, f32) -> vec<2, f32> +fn refract_cd905f() { + var arg_0 = vec2(); + var arg_1 = vec2(); + var arg_2 = 1.0; + var res: vec2 = refract(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + refract_cd905f(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + refract_cd905f(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + refract_cd905f(); +} diff --git a/test/tint/builtins/gen/var/refract/cd905f.wgsl.expected.glsl b/test/tint/builtins/gen/var/refract/cd905f.wgsl.expected.glsl new file mode 100644 index 0000000000..906e9f6305 --- /dev/null +++ b/test/tint/builtins/gen/var/refract/cd905f.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void refract_cd905f() { + vec2 arg_0 = vec2(0.0f); + vec2 arg_1 = vec2(0.0f); + float arg_2 = 1.0f; + vec2 res = refract(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + refract_cd905f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void refract_cd905f() { + vec2 arg_0 = vec2(0.0f); + vec2 arg_1 = vec2(0.0f); + float arg_2 = 1.0f; + vec2 res = refract(arg_0, arg_1, arg_2); +} + +void fragment_main() { + refract_cd905f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void refract_cd905f() { + vec2 arg_0 = vec2(0.0f); + vec2 arg_1 = vec2(0.0f); + float arg_2 = 1.0f; + vec2 res = refract(arg_0, arg_1, arg_2); +} + +void compute_main() { + refract_cd905f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/refract/cd905f.wgsl.expected.hlsl b/test/tint/builtins/gen/var/refract/cd905f.wgsl.expected.hlsl new file mode 100644 index 0000000000..6c5ef8a7aa --- /dev/null +++ b/test/tint/builtins/gen/var/refract/cd905f.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +void refract_cd905f() { + float2 arg_0 = (0.0f).xx; + float2 arg_1 = (0.0f).xx; + float arg_2 = 1.0f; + float2 res = refract(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + refract_cd905f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + refract_cd905f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + refract_cd905f(); + return; +} diff --git a/test/tint/builtins/gen/var/refract/cd905f.wgsl.expected.msl b/test/tint/builtins/gen/var/refract/cd905f.wgsl.expected.msl new file mode 100644 index 0000000000..8f9e3f1a2a --- /dev/null +++ b/test/tint/builtins/gen/var/refract/cd905f.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void refract_cd905f() { + float2 arg_0 = float2(0.0f); + float2 arg_1 = float2(0.0f); + float arg_2 = 1.0f; + float2 res = refract(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + refract_cd905f(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + refract_cd905f(); + return; +} + +kernel void compute_main() { + refract_cd905f(); + return; +} + diff --git a/test/tint/builtins/gen/var/refract/cd905f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/refract/cd905f.wgsl.expected.spvasm new file mode 100644 index 0000000000..c062222ce1 --- /dev/null +++ b/test/tint/builtins/gen/var/refract/cd905f.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + %22 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %refract_cd905f "refract_cd905f" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %14 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %27 = OpTypeFunction %v4float +%refract_cd905f = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %14 + %arg_1 = OpVariable %_ptr_Function_v2float Function %14 + %arg_2 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_v2float Function %14 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + OpStore %arg_2 %float_1 + %23 = OpLoad %v2float %arg_0 + %24 = OpLoad %v2float %arg_1 + %25 = OpLoad %float %arg_2 + %21 = OpExtInst %v2float %22 Refract %23 %24 %25 + OpStore %res %21 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %refract_cd905f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %refract_cd905f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %refract_cd905f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/refract/cd905f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/refract/cd905f.wgsl.expected.wgsl new file mode 100644 index 0000000000..34cfbcef9d --- /dev/null +++ b/test/tint/builtins/gen/var/refract/cd905f.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn refract_cd905f() { + var arg_0 = vec2(); + var arg_1 = vec2(); + var arg_2 = 1.0; + var res : vec2 = refract(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + refract_cd905f(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + refract_cd905f(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + refract_cd905f(); +} diff --git a/test/tint/builtins/gen/var/reverseBits/222177.wgsl b/test/tint/builtins/gen/var/reverseBits/222177.wgsl new file mode 100644 index 0000000000..7d2ca9506d --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/222177.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn reverseBits(vec<2, i32>) -> vec<2, i32> +fn reverseBits_222177() { + var arg_0 = vec2(); + var res: vec2 = reverseBits(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + reverseBits_222177(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + reverseBits_222177(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + reverseBits_222177(); +} diff --git a/test/tint/builtins/gen/var/reverseBits/222177.wgsl.expected.glsl b/test/tint/builtins/gen/var/reverseBits/222177.wgsl.expected.glsl new file mode 100644 index 0000000000..fe39948967 --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/222177.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void reverseBits_222177() { + ivec2 arg_0 = ivec2(0); + ivec2 res = bitfieldReverse(arg_0); +} + +vec4 vertex_main() { + reverseBits_222177(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void reverseBits_222177() { + ivec2 arg_0 = ivec2(0); + ivec2 res = bitfieldReverse(arg_0); +} + +void fragment_main() { + reverseBits_222177(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void reverseBits_222177() { + ivec2 arg_0 = ivec2(0); + ivec2 res = bitfieldReverse(arg_0); +} + +void compute_main() { + reverseBits_222177(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/reverseBits/222177.wgsl.expected.hlsl b/test/tint/builtins/gen/var/reverseBits/222177.wgsl.expected.hlsl new file mode 100644 index 0000000000..0e6556ff63 --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/222177.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void reverseBits_222177() { + int2 arg_0 = (0).xx; + int2 res = asint(reversebits(asuint(arg_0))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reverseBits_222177(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reverseBits_222177(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reverseBits_222177(); + return; +} diff --git a/test/tint/builtins/gen/var/reverseBits/222177.wgsl.expected.msl b/test/tint/builtins/gen/var/reverseBits/222177.wgsl.expected.msl new file mode 100644 index 0000000000..f1c5c14959 --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/222177.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void reverseBits_222177() { + int2 arg_0 = int2(0); + int2 res = reverse_bits(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + reverseBits_222177(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + reverseBits_222177(); + return; +} + +kernel void compute_main() { + reverseBits_222177(); + return; +} + diff --git a/test/tint/builtins/gen/var/reverseBits/222177.wgsl.expected.spvasm b/test/tint/builtins/gen/var/reverseBits/222177.wgsl.expected.spvasm new file mode 100644 index 0000000000..68e48e24dd --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/222177.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %reverseBits_222177 "reverseBits_222177" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %15 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%reverseBits_222177 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2int Function %15 + %res = OpVariable %_ptr_Function_v2int Function %15 + OpStore %arg_0 %15 + %19 = OpLoad %v2int %arg_0 + %18 = OpBitReverse %v2int %19 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %reverseBits_222177 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %reverseBits_222177 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %reverseBits_222177 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/reverseBits/222177.wgsl.expected.wgsl b/test/tint/builtins/gen/var/reverseBits/222177.wgsl.expected.wgsl new file mode 100644 index 0000000000..40ebf3ccbf --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/222177.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn reverseBits_222177() { + var arg_0 = vec2(); + var res : vec2 = reverseBits(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + reverseBits_222177(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + reverseBits_222177(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + reverseBits_222177(); +} diff --git a/test/tint/builtins/gen/var/reverseBits/35fea9.wgsl b/test/tint/builtins/gen/var/reverseBits/35fea9.wgsl new file mode 100644 index 0000000000..93b2e48fe8 --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/35fea9.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn reverseBits(vec<4, u32>) -> vec<4, u32> +fn reverseBits_35fea9() { + var arg_0 = vec4(); + var res: vec4 = reverseBits(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + reverseBits_35fea9(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + reverseBits_35fea9(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + reverseBits_35fea9(); +} diff --git a/test/tint/builtins/gen/var/reverseBits/35fea9.wgsl.expected.glsl b/test/tint/builtins/gen/var/reverseBits/35fea9.wgsl.expected.glsl new file mode 100644 index 0000000000..095e3c29ab --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/35fea9.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void reverseBits_35fea9() { + uvec4 arg_0 = uvec4(0u); + uvec4 res = bitfieldReverse(arg_0); +} + +vec4 vertex_main() { + reverseBits_35fea9(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void reverseBits_35fea9() { + uvec4 arg_0 = uvec4(0u); + uvec4 res = bitfieldReverse(arg_0); +} + +void fragment_main() { + reverseBits_35fea9(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void reverseBits_35fea9() { + uvec4 arg_0 = uvec4(0u); + uvec4 res = bitfieldReverse(arg_0); +} + +void compute_main() { + reverseBits_35fea9(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/reverseBits/35fea9.wgsl.expected.hlsl b/test/tint/builtins/gen/var/reverseBits/35fea9.wgsl.expected.hlsl new file mode 100644 index 0000000000..cfe947703f --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/35fea9.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void reverseBits_35fea9() { + uint4 arg_0 = (0u).xxxx; + uint4 res = reversebits(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reverseBits_35fea9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reverseBits_35fea9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reverseBits_35fea9(); + return; +} diff --git a/test/tint/builtins/gen/var/reverseBits/35fea9.wgsl.expected.msl b/test/tint/builtins/gen/var/reverseBits/35fea9.wgsl.expected.msl new file mode 100644 index 0000000000..796e6730d0 --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/35fea9.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void reverseBits_35fea9() { + uint4 arg_0 = uint4(0u); + uint4 res = reverse_bits(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + reverseBits_35fea9(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + reverseBits_35fea9(); + return; +} + +kernel void compute_main() { + reverseBits_35fea9(); + return; +} + diff --git a/test/tint/builtins/gen/var/reverseBits/35fea9.wgsl.expected.spvasm b/test/tint/builtins/gen/var/reverseBits/35fea9.wgsl.expected.spvasm new file mode 100644 index 0000000000..ca1745563d --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/35fea9.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %reverseBits_35fea9 "reverseBits_35fea9" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + %15 = OpConstantNull %v4uint +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%reverseBits_35fea9 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4uint Function %15 + %res = OpVariable %_ptr_Function_v4uint Function %15 + OpStore %arg_0 %15 + %19 = OpLoad %v4uint %arg_0 + %18 = OpBitReverse %v4uint %19 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %reverseBits_35fea9 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %reverseBits_35fea9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %reverseBits_35fea9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/reverseBits/35fea9.wgsl.expected.wgsl b/test/tint/builtins/gen/var/reverseBits/35fea9.wgsl.expected.wgsl new file mode 100644 index 0000000000..b158c6899b --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/35fea9.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn reverseBits_35fea9() { + var arg_0 = vec4(); + var res : vec4 = reverseBits(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + reverseBits_35fea9(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + reverseBits_35fea9(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + reverseBits_35fea9(); +} diff --git a/test/tint/builtins/gen/var/reverseBits/4dbd6f.wgsl b/test/tint/builtins/gen/var/reverseBits/4dbd6f.wgsl new file mode 100644 index 0000000000..5ab35adb4a --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/4dbd6f.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn reverseBits(vec<4, i32>) -> vec<4, i32> +fn reverseBits_4dbd6f() { + var arg_0 = vec4(); + var res: vec4 = reverseBits(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + reverseBits_4dbd6f(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + reverseBits_4dbd6f(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + reverseBits_4dbd6f(); +} diff --git a/test/tint/builtins/gen/var/reverseBits/4dbd6f.wgsl.expected.glsl b/test/tint/builtins/gen/var/reverseBits/4dbd6f.wgsl.expected.glsl new file mode 100644 index 0000000000..fe23a67398 --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/4dbd6f.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void reverseBits_4dbd6f() { + ivec4 arg_0 = ivec4(0); + ivec4 res = bitfieldReverse(arg_0); +} + +vec4 vertex_main() { + reverseBits_4dbd6f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void reverseBits_4dbd6f() { + ivec4 arg_0 = ivec4(0); + ivec4 res = bitfieldReverse(arg_0); +} + +void fragment_main() { + reverseBits_4dbd6f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void reverseBits_4dbd6f() { + ivec4 arg_0 = ivec4(0); + ivec4 res = bitfieldReverse(arg_0); +} + +void compute_main() { + reverseBits_4dbd6f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/reverseBits/4dbd6f.wgsl.expected.hlsl b/test/tint/builtins/gen/var/reverseBits/4dbd6f.wgsl.expected.hlsl new file mode 100644 index 0000000000..e89294502d --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/4dbd6f.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void reverseBits_4dbd6f() { + int4 arg_0 = (0).xxxx; + int4 res = asint(reversebits(asuint(arg_0))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reverseBits_4dbd6f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reverseBits_4dbd6f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reverseBits_4dbd6f(); + return; +} diff --git a/test/tint/builtins/gen/var/reverseBits/4dbd6f.wgsl.expected.msl b/test/tint/builtins/gen/var/reverseBits/4dbd6f.wgsl.expected.msl new file mode 100644 index 0000000000..04ecef0b30 --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/4dbd6f.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void reverseBits_4dbd6f() { + int4 arg_0 = int4(0); + int4 res = reverse_bits(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + reverseBits_4dbd6f(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + reverseBits_4dbd6f(); + return; +} + +kernel void compute_main() { + reverseBits_4dbd6f(); + return; +} + diff --git a/test/tint/builtins/gen/var/reverseBits/4dbd6f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/reverseBits/4dbd6f.wgsl.expected.spvasm new file mode 100644 index 0000000000..c2d1c94c2e --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/4dbd6f.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %reverseBits_4dbd6f "reverseBits_4dbd6f" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %15 = OpConstantNull %v4int +%_ptr_Function_v4int = OpTypePointer Function %v4int + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%reverseBits_4dbd6f = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4int Function %15 + %res = OpVariable %_ptr_Function_v4int Function %15 + OpStore %arg_0 %15 + %19 = OpLoad %v4int %arg_0 + %18 = OpBitReverse %v4int %19 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %reverseBits_4dbd6f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %reverseBits_4dbd6f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %reverseBits_4dbd6f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/reverseBits/4dbd6f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/reverseBits/4dbd6f.wgsl.expected.wgsl new file mode 100644 index 0000000000..fa97ef8794 --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/4dbd6f.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn reverseBits_4dbd6f() { + var arg_0 = vec4(); + var res : vec4 = reverseBits(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + reverseBits_4dbd6f(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + reverseBits_4dbd6f(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + reverseBits_4dbd6f(); +} diff --git a/test/tint/builtins/gen/var/reverseBits/7c4269.wgsl b/test/tint/builtins/gen/var/reverseBits/7c4269.wgsl new file mode 100644 index 0000000000..9ea20f0a84 --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/7c4269.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn reverseBits(i32) -> i32 +fn reverseBits_7c4269() { + var arg_0 = 1; + var res: i32 = reverseBits(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + reverseBits_7c4269(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + reverseBits_7c4269(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + reverseBits_7c4269(); +} diff --git a/test/tint/builtins/gen/var/reverseBits/7c4269.wgsl.expected.glsl b/test/tint/builtins/gen/var/reverseBits/7c4269.wgsl.expected.glsl new file mode 100644 index 0000000000..7f5a81273c --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/7c4269.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void reverseBits_7c4269() { + int arg_0 = 1; + int res = bitfieldReverse(arg_0); +} + +vec4 vertex_main() { + reverseBits_7c4269(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void reverseBits_7c4269() { + int arg_0 = 1; + int res = bitfieldReverse(arg_0); +} + +void fragment_main() { + reverseBits_7c4269(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void reverseBits_7c4269() { + int arg_0 = 1; + int res = bitfieldReverse(arg_0); +} + +void compute_main() { + reverseBits_7c4269(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/reverseBits/7c4269.wgsl.expected.hlsl b/test/tint/builtins/gen/var/reverseBits/7c4269.wgsl.expected.hlsl new file mode 100644 index 0000000000..c3ab61c5c3 --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/7c4269.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void reverseBits_7c4269() { + int arg_0 = 1; + int res = asint(reversebits(asuint(arg_0))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reverseBits_7c4269(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reverseBits_7c4269(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reverseBits_7c4269(); + return; +} diff --git a/test/tint/builtins/gen/var/reverseBits/7c4269.wgsl.expected.msl b/test/tint/builtins/gen/var/reverseBits/7c4269.wgsl.expected.msl new file mode 100644 index 0000000000..2fd16d1baf --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/7c4269.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void reverseBits_7c4269() { + int arg_0 = 1; + int res = reverse_bits(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + reverseBits_7c4269(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + reverseBits_7c4269(); + return; +} + +kernel void compute_main() { + reverseBits_7c4269(); + return; +} + diff --git a/test/tint/builtins/gen/var/reverseBits/7c4269.wgsl.expected.spvasm b/test/tint/builtins/gen/var/reverseBits/7c4269.wgsl.expected.spvasm new file mode 100644 index 0000000000..bd3505207a --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/7c4269.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %reverseBits_7c4269 "reverseBits_7c4269" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %17 = OpConstantNull %int + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%reverseBits_7c4269 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_int Function %17 + %res = OpVariable %_ptr_Function_int Function %17 + OpStore %arg_0 %int_1 + %19 = OpLoad %int %arg_0 + %18 = OpBitReverse %int %19 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %reverseBits_7c4269 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %reverseBits_7c4269 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %reverseBits_7c4269 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/reverseBits/7c4269.wgsl.expected.wgsl b/test/tint/builtins/gen/var/reverseBits/7c4269.wgsl.expected.wgsl new file mode 100644 index 0000000000..fdaa2644c7 --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/7c4269.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn reverseBits_7c4269() { + var arg_0 = 1; + var res : i32 = reverseBits(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + reverseBits_7c4269(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + reverseBits_7c4269(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + reverseBits_7c4269(); +} diff --git a/test/tint/builtins/gen/var/reverseBits/a6ccd4.wgsl b/test/tint/builtins/gen/var/reverseBits/a6ccd4.wgsl new file mode 100644 index 0000000000..507b520bd2 --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/a6ccd4.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn reverseBits(vec<3, u32>) -> vec<3, u32> +fn reverseBits_a6ccd4() { + var arg_0 = vec3(); + var res: vec3 = reverseBits(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + reverseBits_a6ccd4(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + reverseBits_a6ccd4(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + reverseBits_a6ccd4(); +} diff --git a/test/tint/builtins/gen/var/reverseBits/a6ccd4.wgsl.expected.glsl b/test/tint/builtins/gen/var/reverseBits/a6ccd4.wgsl.expected.glsl new file mode 100644 index 0000000000..cd9271ed8e --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/a6ccd4.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void reverseBits_a6ccd4() { + uvec3 arg_0 = uvec3(0u); + uvec3 res = bitfieldReverse(arg_0); +} + +vec4 vertex_main() { + reverseBits_a6ccd4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void reverseBits_a6ccd4() { + uvec3 arg_0 = uvec3(0u); + uvec3 res = bitfieldReverse(arg_0); +} + +void fragment_main() { + reverseBits_a6ccd4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void reverseBits_a6ccd4() { + uvec3 arg_0 = uvec3(0u); + uvec3 res = bitfieldReverse(arg_0); +} + +void compute_main() { + reverseBits_a6ccd4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/reverseBits/a6ccd4.wgsl.expected.hlsl b/test/tint/builtins/gen/var/reverseBits/a6ccd4.wgsl.expected.hlsl new file mode 100644 index 0000000000..7592e9c39b --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/a6ccd4.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void reverseBits_a6ccd4() { + uint3 arg_0 = (0u).xxx; + uint3 res = reversebits(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reverseBits_a6ccd4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reverseBits_a6ccd4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reverseBits_a6ccd4(); + return; +} diff --git a/test/tint/builtins/gen/var/reverseBits/a6ccd4.wgsl.expected.msl b/test/tint/builtins/gen/var/reverseBits/a6ccd4.wgsl.expected.msl new file mode 100644 index 0000000000..d2d54c3eec --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/a6ccd4.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void reverseBits_a6ccd4() { + uint3 arg_0 = uint3(0u); + uint3 res = reverse_bits(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + reverseBits_a6ccd4(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + reverseBits_a6ccd4(); + return; +} + +kernel void compute_main() { + reverseBits_a6ccd4(); + return; +} + diff --git a/test/tint/builtins/gen/var/reverseBits/a6ccd4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/reverseBits/a6ccd4.wgsl.expected.spvasm new file mode 100644 index 0000000000..db3b1535e6 --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/a6ccd4.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %reverseBits_a6ccd4 "reverseBits_a6ccd4" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %15 = OpConstantNull %v3uint +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%reverseBits_a6ccd4 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3uint Function %15 + %res = OpVariable %_ptr_Function_v3uint Function %15 + OpStore %arg_0 %15 + %19 = OpLoad %v3uint %arg_0 + %18 = OpBitReverse %v3uint %19 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %reverseBits_a6ccd4 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %reverseBits_a6ccd4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %reverseBits_a6ccd4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/reverseBits/a6ccd4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/reverseBits/a6ccd4.wgsl.expected.wgsl new file mode 100644 index 0000000000..97f587933e --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/a6ccd4.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn reverseBits_a6ccd4() { + var arg_0 = vec3(); + var res : vec3 = reverseBits(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + reverseBits_a6ccd4(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + reverseBits_a6ccd4(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + reverseBits_a6ccd4(); +} diff --git a/test/tint/builtins/gen/var/reverseBits/c21bc1.wgsl b/test/tint/builtins/gen/var/reverseBits/c21bc1.wgsl new file mode 100644 index 0000000000..8f348e7e4e --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/c21bc1.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn reverseBits(vec<3, i32>) -> vec<3, i32> +fn reverseBits_c21bc1() { + var arg_0 = vec3(); + var res: vec3 = reverseBits(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + reverseBits_c21bc1(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + reverseBits_c21bc1(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + reverseBits_c21bc1(); +} diff --git a/test/tint/builtins/gen/var/reverseBits/c21bc1.wgsl.expected.glsl b/test/tint/builtins/gen/var/reverseBits/c21bc1.wgsl.expected.glsl new file mode 100644 index 0000000000..7ed60de577 --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/c21bc1.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void reverseBits_c21bc1() { + ivec3 arg_0 = ivec3(0); + ivec3 res = bitfieldReverse(arg_0); +} + +vec4 vertex_main() { + reverseBits_c21bc1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void reverseBits_c21bc1() { + ivec3 arg_0 = ivec3(0); + ivec3 res = bitfieldReverse(arg_0); +} + +void fragment_main() { + reverseBits_c21bc1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void reverseBits_c21bc1() { + ivec3 arg_0 = ivec3(0); + ivec3 res = bitfieldReverse(arg_0); +} + +void compute_main() { + reverseBits_c21bc1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/reverseBits/c21bc1.wgsl.expected.hlsl b/test/tint/builtins/gen/var/reverseBits/c21bc1.wgsl.expected.hlsl new file mode 100644 index 0000000000..1676f541f5 --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/c21bc1.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void reverseBits_c21bc1() { + int3 arg_0 = (0).xxx; + int3 res = asint(reversebits(asuint(arg_0))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reverseBits_c21bc1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reverseBits_c21bc1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reverseBits_c21bc1(); + return; +} diff --git a/test/tint/builtins/gen/var/reverseBits/c21bc1.wgsl.expected.msl b/test/tint/builtins/gen/var/reverseBits/c21bc1.wgsl.expected.msl new file mode 100644 index 0000000000..3d23b80920 --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/c21bc1.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void reverseBits_c21bc1() { + int3 arg_0 = int3(0); + int3 res = reverse_bits(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + reverseBits_c21bc1(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + reverseBits_c21bc1(); + return; +} + +kernel void compute_main() { + reverseBits_c21bc1(); + return; +} + diff --git a/test/tint/builtins/gen/var/reverseBits/c21bc1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/reverseBits/c21bc1.wgsl.expected.spvasm new file mode 100644 index 0000000000..71ecb17d90 --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/c21bc1.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %reverseBits_c21bc1 "reverseBits_c21bc1" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %15 = OpConstantNull %v3int +%_ptr_Function_v3int = OpTypePointer Function %v3int + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%reverseBits_c21bc1 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3int Function %15 + %res = OpVariable %_ptr_Function_v3int Function %15 + OpStore %arg_0 %15 + %19 = OpLoad %v3int %arg_0 + %18 = OpBitReverse %v3int %19 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %reverseBits_c21bc1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %reverseBits_c21bc1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %reverseBits_c21bc1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/reverseBits/c21bc1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/reverseBits/c21bc1.wgsl.expected.wgsl new file mode 100644 index 0000000000..fe4a6c3120 --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/c21bc1.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn reverseBits_c21bc1() { + var arg_0 = vec3(); + var res : vec3 = reverseBits(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + reverseBits_c21bc1(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + reverseBits_c21bc1(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + reverseBits_c21bc1(); +} diff --git a/test/tint/builtins/gen/var/reverseBits/e1f4c1.wgsl b/test/tint/builtins/gen/var/reverseBits/e1f4c1.wgsl new file mode 100644 index 0000000000..53904080ff --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/e1f4c1.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn reverseBits(vec<2, u32>) -> vec<2, u32> +fn reverseBits_e1f4c1() { + var arg_0 = vec2(); + var res: vec2 = reverseBits(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + reverseBits_e1f4c1(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + reverseBits_e1f4c1(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + reverseBits_e1f4c1(); +} diff --git a/test/tint/builtins/gen/var/reverseBits/e1f4c1.wgsl.expected.glsl b/test/tint/builtins/gen/var/reverseBits/e1f4c1.wgsl.expected.glsl new file mode 100644 index 0000000000..d59036c601 --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/e1f4c1.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void reverseBits_e1f4c1() { + uvec2 arg_0 = uvec2(0u); + uvec2 res = bitfieldReverse(arg_0); +} + +vec4 vertex_main() { + reverseBits_e1f4c1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void reverseBits_e1f4c1() { + uvec2 arg_0 = uvec2(0u); + uvec2 res = bitfieldReverse(arg_0); +} + +void fragment_main() { + reverseBits_e1f4c1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void reverseBits_e1f4c1() { + uvec2 arg_0 = uvec2(0u); + uvec2 res = bitfieldReverse(arg_0); +} + +void compute_main() { + reverseBits_e1f4c1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/reverseBits/e1f4c1.wgsl.expected.hlsl b/test/tint/builtins/gen/var/reverseBits/e1f4c1.wgsl.expected.hlsl new file mode 100644 index 0000000000..6d4ce3f279 --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/e1f4c1.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void reverseBits_e1f4c1() { + uint2 arg_0 = (0u).xx; + uint2 res = reversebits(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reverseBits_e1f4c1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reverseBits_e1f4c1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reverseBits_e1f4c1(); + return; +} diff --git a/test/tint/builtins/gen/var/reverseBits/e1f4c1.wgsl.expected.msl b/test/tint/builtins/gen/var/reverseBits/e1f4c1.wgsl.expected.msl new file mode 100644 index 0000000000..c8f6c6c246 --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/e1f4c1.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void reverseBits_e1f4c1() { + uint2 arg_0 = uint2(0u); + uint2 res = reverse_bits(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + reverseBits_e1f4c1(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + reverseBits_e1f4c1(); + return; +} + +kernel void compute_main() { + reverseBits_e1f4c1(); + return; +} + diff --git a/test/tint/builtins/gen/var/reverseBits/e1f4c1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/reverseBits/e1f4c1.wgsl.expected.spvasm new file mode 100644 index 0000000000..d9a5b777b3 --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/e1f4c1.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %reverseBits_e1f4c1 "reverseBits_e1f4c1" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %15 = OpConstantNull %v2uint +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%reverseBits_e1f4c1 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2uint Function %15 + %res = OpVariable %_ptr_Function_v2uint Function %15 + OpStore %arg_0 %15 + %19 = OpLoad %v2uint %arg_0 + %18 = OpBitReverse %v2uint %19 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %reverseBits_e1f4c1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %reverseBits_e1f4c1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %reverseBits_e1f4c1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/reverseBits/e1f4c1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/reverseBits/e1f4c1.wgsl.expected.wgsl new file mode 100644 index 0000000000..c04788b142 --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/e1f4c1.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn reverseBits_e1f4c1() { + var arg_0 = vec2(); + var res : vec2 = reverseBits(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + reverseBits_e1f4c1(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + reverseBits_e1f4c1(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + reverseBits_e1f4c1(); +} diff --git a/test/tint/builtins/gen/var/reverseBits/e31adf.wgsl b/test/tint/builtins/gen/var/reverseBits/e31adf.wgsl new file mode 100644 index 0000000000..e72facbef0 --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/e31adf.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn reverseBits(u32) -> u32 +fn reverseBits_e31adf() { + var arg_0 = 1u; + var res: u32 = reverseBits(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + reverseBits_e31adf(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + reverseBits_e31adf(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + reverseBits_e31adf(); +} diff --git a/test/tint/builtins/gen/var/reverseBits/e31adf.wgsl.expected.glsl b/test/tint/builtins/gen/var/reverseBits/e31adf.wgsl.expected.glsl new file mode 100644 index 0000000000..0acaf13ac1 --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/e31adf.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void reverseBits_e31adf() { + uint arg_0 = 1u; + uint res = bitfieldReverse(arg_0); +} + +vec4 vertex_main() { + reverseBits_e31adf(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void reverseBits_e31adf() { + uint arg_0 = 1u; + uint res = bitfieldReverse(arg_0); +} + +void fragment_main() { + reverseBits_e31adf(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void reverseBits_e31adf() { + uint arg_0 = 1u; + uint res = bitfieldReverse(arg_0); +} + +void compute_main() { + reverseBits_e31adf(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/reverseBits/e31adf.wgsl.expected.hlsl b/test/tint/builtins/gen/var/reverseBits/e31adf.wgsl.expected.hlsl new file mode 100644 index 0000000000..357463196d --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/e31adf.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void reverseBits_e31adf() { + uint arg_0 = 1u; + uint res = reversebits(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reverseBits_e31adf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reverseBits_e31adf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reverseBits_e31adf(); + return; +} diff --git a/test/tint/builtins/gen/var/reverseBits/e31adf.wgsl.expected.msl b/test/tint/builtins/gen/var/reverseBits/e31adf.wgsl.expected.msl new file mode 100644 index 0000000000..5948fcea8d --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/e31adf.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void reverseBits_e31adf() { + uint arg_0 = 1u; + uint res = reverse_bits(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + reverseBits_e31adf(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + reverseBits_e31adf(); + return; +} + +kernel void compute_main() { + reverseBits_e31adf(); + return; +} + diff --git a/test/tint/builtins/gen/var/reverseBits/e31adf.wgsl.expected.spvasm b/test/tint/builtins/gen/var/reverseBits/e31adf.wgsl.expected.spvasm new file mode 100644 index 0000000000..3dbf2b2988 --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/e31adf.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %reverseBits_e31adf "reverseBits_e31adf" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %17 = OpConstantNull %uint + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%reverseBits_e31adf = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_uint Function %17 + %res = OpVariable %_ptr_Function_uint Function %17 + OpStore %arg_0 %uint_1 + %19 = OpLoad %uint %arg_0 + %18 = OpBitReverse %uint %19 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %reverseBits_e31adf + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %reverseBits_e31adf + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %reverseBits_e31adf + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/reverseBits/e31adf.wgsl.expected.wgsl b/test/tint/builtins/gen/var/reverseBits/e31adf.wgsl.expected.wgsl new file mode 100644 index 0000000000..9d1053684a --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/e31adf.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn reverseBits_e31adf() { + var arg_0 = 1u; + var res : u32 = reverseBits(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + reverseBits_e31adf(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + reverseBits_e31adf(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + reverseBits_e31adf(); +} diff --git a/test/tint/builtins/gen/var/round/106c0b.wgsl b/test/tint/builtins/gen/var/round/106c0b.wgsl new file mode 100644 index 0000000000..7be10c2e4b --- /dev/null +++ b/test/tint/builtins/gen/var/round/106c0b.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn round(vec<4, f32>) -> vec<4, f32> +fn round_106c0b() { + var arg_0 = vec4(); + var res: vec4 = round(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + round_106c0b(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + round_106c0b(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + round_106c0b(); +} diff --git a/test/tint/builtins/gen/var/round/106c0b.wgsl.expected.glsl b/test/tint/builtins/gen/var/round/106c0b.wgsl.expected.glsl new file mode 100644 index 0000000000..f429459cdf --- /dev/null +++ b/test/tint/builtins/gen/var/round/106c0b.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void round_106c0b() { + vec4 arg_0 = vec4(0.0f); + vec4 res = round(arg_0); +} + +vec4 vertex_main() { + round_106c0b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void round_106c0b() { + vec4 arg_0 = vec4(0.0f); + vec4 res = round(arg_0); +} + +void fragment_main() { + round_106c0b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void round_106c0b() { + vec4 arg_0 = vec4(0.0f); + vec4 res = round(arg_0); +} + +void compute_main() { + round_106c0b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/round/106c0b.wgsl.expected.hlsl b/test/tint/builtins/gen/var/round/106c0b.wgsl.expected.hlsl new file mode 100644 index 0000000000..01f6555b8a --- /dev/null +++ b/test/tint/builtins/gen/var/round/106c0b.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void round_106c0b() { + float4 arg_0 = (0.0f).xxxx; + float4 res = round(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + round_106c0b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + round_106c0b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + round_106c0b(); + return; +} diff --git a/test/tint/builtins/gen/var/round/106c0b.wgsl.expected.msl b/test/tint/builtins/gen/var/round/106c0b.wgsl.expected.msl new file mode 100644 index 0000000000..ad1867fbb0 --- /dev/null +++ b/test/tint/builtins/gen/var/round/106c0b.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void round_106c0b() { + float4 arg_0 = float4(0.0f); + float4 res = rint(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + round_106c0b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + round_106c0b(); + return; +} + +kernel void compute_main() { + round_106c0b(); + return; +} + diff --git a/test/tint/builtins/gen/var/round/106c0b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/round/106c0b.wgsl.expected.spvasm new file mode 100644 index 0000000000..90e9744413 --- /dev/null +++ b/test/tint/builtins/gen/var/round/106c0b.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %round_106c0b "round_106c0b" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%round_106c0b = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %5 + %17 = OpLoad %v4float %arg_0 + %15 = OpExtInst %v4float %16 RoundEven %17 + OpStore %res %15 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %round_106c0b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %round_106c0b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %round_106c0b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/round/106c0b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/round/106c0b.wgsl.expected.wgsl new file mode 100644 index 0000000000..a21172045d --- /dev/null +++ b/test/tint/builtins/gen/var/round/106c0b.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn round_106c0b() { + var arg_0 = vec4(); + var res : vec4 = round(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + round_106c0b(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + round_106c0b(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + round_106c0b(); +} diff --git a/test/tint/builtins/gen/var/round/1c7897.wgsl b/test/tint/builtins/gen/var/round/1c7897.wgsl new file mode 100644 index 0000000000..02bb2d6923 --- /dev/null +++ b/test/tint/builtins/gen/var/round/1c7897.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn round(vec<3, f32>) -> vec<3, f32> +fn round_1c7897() { + var arg_0 = vec3(); + var res: vec3 = round(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + round_1c7897(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + round_1c7897(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + round_1c7897(); +} diff --git a/test/tint/builtins/gen/var/round/1c7897.wgsl.expected.glsl b/test/tint/builtins/gen/var/round/1c7897.wgsl.expected.glsl new file mode 100644 index 0000000000..61d0b0c90d --- /dev/null +++ b/test/tint/builtins/gen/var/round/1c7897.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void round_1c7897() { + vec3 arg_0 = vec3(0.0f); + vec3 res = round(arg_0); +} + +vec4 vertex_main() { + round_1c7897(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void round_1c7897() { + vec3 arg_0 = vec3(0.0f); + vec3 res = round(arg_0); +} + +void fragment_main() { + round_1c7897(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void round_1c7897() { + vec3 arg_0 = vec3(0.0f); + vec3 res = round(arg_0); +} + +void compute_main() { + round_1c7897(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/round/1c7897.wgsl.expected.hlsl b/test/tint/builtins/gen/var/round/1c7897.wgsl.expected.hlsl new file mode 100644 index 0000000000..bcc74fd261 --- /dev/null +++ b/test/tint/builtins/gen/var/round/1c7897.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void round_1c7897() { + float3 arg_0 = (0.0f).xxx; + float3 res = round(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + round_1c7897(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + round_1c7897(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + round_1c7897(); + return; +} diff --git a/test/tint/builtins/gen/var/round/1c7897.wgsl.expected.msl b/test/tint/builtins/gen/var/round/1c7897.wgsl.expected.msl new file mode 100644 index 0000000000..c528ea95c7 --- /dev/null +++ b/test/tint/builtins/gen/var/round/1c7897.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void round_1c7897() { + float3 arg_0 = float3(0.0f); + float3 res = rint(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + round_1c7897(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + round_1c7897(); + return; +} + +kernel void compute_main() { + round_1c7897(); + return; +} + diff --git a/test/tint/builtins/gen/var/round/1c7897.wgsl.expected.spvasm b/test/tint/builtins/gen/var/round/1c7897.wgsl.expected.spvasm new file mode 100644 index 0000000000..3c068e768d --- /dev/null +++ b/test/tint/builtins/gen/var/round/1c7897.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %round_1c7897 "round_1c7897" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %14 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%round_1c7897 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %14 + %res = OpVariable %_ptr_Function_v3float Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %v3float %arg_0 + %17 = OpExtInst %v3float %18 RoundEven %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %round_1c7897 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %round_1c7897 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %round_1c7897 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/round/1c7897.wgsl.expected.wgsl b/test/tint/builtins/gen/var/round/1c7897.wgsl.expected.wgsl new file mode 100644 index 0000000000..07ae079dc8 --- /dev/null +++ b/test/tint/builtins/gen/var/round/1c7897.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn round_1c7897() { + var arg_0 = vec3(); + var res : vec3 = round(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + round_1c7897(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + round_1c7897(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + round_1c7897(); +} diff --git a/test/tint/builtins/gen/var/round/52c84d.wgsl b/test/tint/builtins/gen/var/round/52c84d.wgsl new file mode 100644 index 0000000000..49ecbee0b9 --- /dev/null +++ b/test/tint/builtins/gen/var/round/52c84d.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn round(vec<2, f32>) -> vec<2, f32> +fn round_52c84d() { + var arg_0 = vec2(); + var res: vec2 = round(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + round_52c84d(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + round_52c84d(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + round_52c84d(); +} diff --git a/test/tint/builtins/gen/var/round/52c84d.wgsl.expected.glsl b/test/tint/builtins/gen/var/round/52c84d.wgsl.expected.glsl new file mode 100644 index 0000000000..9e6c847735 --- /dev/null +++ b/test/tint/builtins/gen/var/round/52c84d.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void round_52c84d() { + vec2 arg_0 = vec2(0.0f); + vec2 res = round(arg_0); +} + +vec4 vertex_main() { + round_52c84d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void round_52c84d() { + vec2 arg_0 = vec2(0.0f); + vec2 res = round(arg_0); +} + +void fragment_main() { + round_52c84d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void round_52c84d() { + vec2 arg_0 = vec2(0.0f); + vec2 res = round(arg_0); +} + +void compute_main() { + round_52c84d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/round/52c84d.wgsl.expected.hlsl b/test/tint/builtins/gen/var/round/52c84d.wgsl.expected.hlsl new file mode 100644 index 0000000000..48b5930c0f --- /dev/null +++ b/test/tint/builtins/gen/var/round/52c84d.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void round_52c84d() { + float2 arg_0 = (0.0f).xx; + float2 res = round(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + round_52c84d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + round_52c84d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + round_52c84d(); + return; +} diff --git a/test/tint/builtins/gen/var/round/52c84d.wgsl.expected.msl b/test/tint/builtins/gen/var/round/52c84d.wgsl.expected.msl new file mode 100644 index 0000000000..3ebec21331 --- /dev/null +++ b/test/tint/builtins/gen/var/round/52c84d.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void round_52c84d() { + float2 arg_0 = float2(0.0f); + float2 res = rint(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + round_52c84d(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + round_52c84d(); + return; +} + +kernel void compute_main() { + round_52c84d(); + return; +} + diff --git a/test/tint/builtins/gen/var/round/52c84d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/round/52c84d.wgsl.expected.spvasm new file mode 100644 index 0000000000..d59eb68ae0 --- /dev/null +++ b/test/tint/builtins/gen/var/round/52c84d.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %round_52c84d "round_52c84d" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %14 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%round_52c84d = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %14 + %res = OpVariable %_ptr_Function_v2float Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %v2float %arg_0 + %17 = OpExtInst %v2float %18 RoundEven %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %round_52c84d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %round_52c84d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %round_52c84d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/round/52c84d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/round/52c84d.wgsl.expected.wgsl new file mode 100644 index 0000000000..b92ade61f4 --- /dev/null +++ b/test/tint/builtins/gen/var/round/52c84d.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn round_52c84d() { + var arg_0 = vec2(); + var res : vec2 = round(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + round_52c84d(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + round_52c84d(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + round_52c84d(); +} diff --git a/test/tint/builtins/gen/var/round/9edc38.wgsl b/test/tint/builtins/gen/var/round/9edc38.wgsl new file mode 100644 index 0000000000..1c7f2e0de7 --- /dev/null +++ b/test/tint/builtins/gen/var/round/9edc38.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn round(f32) -> f32 +fn round_9edc38() { + var arg_0 = 1.0; + var res: f32 = round(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + round_9edc38(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + round_9edc38(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + round_9edc38(); +} diff --git a/test/tint/builtins/gen/var/round/9edc38.wgsl.expected.glsl b/test/tint/builtins/gen/var/round/9edc38.wgsl.expected.glsl new file mode 100644 index 0000000000..f6758703f6 --- /dev/null +++ b/test/tint/builtins/gen/var/round/9edc38.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void round_9edc38() { + float arg_0 = 1.0f; + float res = round(arg_0); +} + +vec4 vertex_main() { + round_9edc38(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void round_9edc38() { + float arg_0 = 1.0f; + float res = round(arg_0); +} + +void fragment_main() { + round_9edc38(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void round_9edc38() { + float arg_0 = 1.0f; + float res = round(arg_0); +} + +void compute_main() { + round_9edc38(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/round/9edc38.wgsl.expected.hlsl b/test/tint/builtins/gen/var/round/9edc38.wgsl.expected.hlsl new file mode 100644 index 0000000000..f68cfd024f --- /dev/null +++ b/test/tint/builtins/gen/var/round/9edc38.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void round_9edc38() { + float arg_0 = 1.0f; + float res = round(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + round_9edc38(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + round_9edc38(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + round_9edc38(); + return; +} diff --git a/test/tint/builtins/gen/var/round/9edc38.wgsl.expected.msl b/test/tint/builtins/gen/var/round/9edc38.wgsl.expected.msl new file mode 100644 index 0000000000..bee06fa0b8 --- /dev/null +++ b/test/tint/builtins/gen/var/round/9edc38.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void round_9edc38() { + float arg_0 = 1.0f; + float res = rint(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + round_9edc38(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + round_9edc38(); + return; +} + +kernel void compute_main() { + round_9edc38(); + return; +} + diff --git a/test/tint/builtins/gen/var/round/9edc38.wgsl.expected.spvasm b/test/tint/builtins/gen/var/round/9edc38.wgsl.expected.spvasm new file mode 100644 index 0000000000..24731f7469 --- /dev/null +++ b/test/tint/builtins/gen/var/round/9edc38.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %round_9edc38 "round_9edc38" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %20 = OpTypeFunction %v4float +%round_9edc38 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + %18 = OpLoad %float %arg_0 + %16 = OpExtInst %float %17 RoundEven %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %round_9edc38 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %round_9edc38 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %round_9edc38 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/round/9edc38.wgsl.expected.wgsl b/test/tint/builtins/gen/var/round/9edc38.wgsl.expected.wgsl new file mode 100644 index 0000000000..b4d0e0164b --- /dev/null +++ b/test/tint/builtins/gen/var/round/9edc38.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn round_9edc38() { + var arg_0 = 1.0; + var res : f32 = round(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + round_9edc38(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + round_9edc38(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + round_9edc38(); +} diff --git a/test/tint/builtins/gen/var/select/00b848.wgsl b/test/tint/builtins/gen/var/select/00b848.wgsl new file mode 100644 index 0000000000..a6fbecbafa --- /dev/null +++ b/test/tint/builtins/gen/var/select/00b848.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<2, i32>, vec<2, i32>, vec<2, bool>) -> vec<2, i32> +fn select_00b848() { + var arg_0 = vec2(); + var arg_1 = vec2(); + var arg_2 = vec2(); + var res: vec2 = select(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + select_00b848(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + select_00b848(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + select_00b848(); +} diff --git a/test/tint/builtins/gen/var/select/00b848.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/00b848.wgsl.expected.glsl new file mode 100644 index 0000000000..74a8fcb5d9 --- /dev/null +++ b/test/tint/builtins/gen/var/select/00b848.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void select_00b848() { + ivec2 arg_0 = ivec2(0); + ivec2 arg_1 = ivec2(0); + bvec2 arg_2 = bvec2(false); + ivec2 res = mix(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + select_00b848(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_00b848() { + ivec2 arg_0 = ivec2(0); + ivec2 arg_1 = ivec2(0); + bvec2 arg_2 = bvec2(false); + ivec2 res = mix(arg_0, arg_1, arg_2); +} + +void fragment_main() { + select_00b848(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_00b848() { + ivec2 arg_0 = ivec2(0); + ivec2 arg_1 = ivec2(0); + bvec2 arg_2 = bvec2(false); + ivec2 res = mix(arg_0, arg_1, arg_2); +} + +void compute_main() { + select_00b848(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/select/00b848.wgsl.expected.hlsl b/test/tint/builtins/gen/var/select/00b848.wgsl.expected.hlsl new file mode 100644 index 0000000000..c2142a74f2 --- /dev/null +++ b/test/tint/builtins/gen/var/select/00b848.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +void select_00b848() { + int2 arg_0 = (0).xx; + int2 arg_1 = (0).xx; + bool2 arg_2 = (false).xx; + int2 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_00b848(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_00b848(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_00b848(); + return; +} diff --git a/test/tint/builtins/gen/var/select/00b848.wgsl.expected.msl b/test/tint/builtins/gen/var/select/00b848.wgsl.expected.msl new file mode 100644 index 0000000000..a25887643e --- /dev/null +++ b/test/tint/builtins/gen/var/select/00b848.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void select_00b848() { + int2 arg_0 = int2(0); + int2 arg_1 = int2(0); + bool2 arg_2 = bool2(false); + int2 res = select(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_00b848(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_00b848(); + return; +} + +kernel void compute_main() { + select_00b848(); + return; +} + diff --git a/test/tint/builtins/gen/var/select/00b848.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/00b848.wgsl.expected.spvasm new file mode 100644 index 0000000000..3b0f2eac08 --- /dev/null +++ b/test/tint/builtins/gen/var/select/00b848.wgsl.expected.spvasm @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_00b848 "select_00b848" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %15 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %21 = OpConstantNull %v2bool +%_ptr_Function_v2bool = OpTypePointer Function %v2bool + %29 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_00b848 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2int Function %15 + %arg_1 = OpVariable %_ptr_Function_v2int Function %15 + %arg_2 = OpVariable %_ptr_Function_v2bool Function %21 + %res = OpVariable %_ptr_Function_v2int Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %21 + %25 = OpLoad %v2bool %arg_2 + %26 = OpLoad %v2int %arg_1 + %27 = OpLoad %v2int %arg_0 + %24 = OpSelect %v2int %25 %26 %27 + OpStore %res %24 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %29 + %31 = OpLabel + %32 = OpFunctionCall %void %select_00b848 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %35 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %select_00b848 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %41 = OpLabel + %42 = OpFunctionCall %void %select_00b848 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/select/00b848.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/00b848.wgsl.expected.wgsl new file mode 100644 index 0000000000..f23e5002d3 --- /dev/null +++ b/test/tint/builtins/gen/var/select/00b848.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn select_00b848() { + var arg_0 = vec2(); + var arg_1 = vec2(); + var arg_2 = vec2(); + var res : vec2 = select(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + select_00b848(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + select_00b848(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + select_00b848(); +} diff --git a/test/tint/builtins/gen/var/select/01e2cd.wgsl b/test/tint/builtins/gen/var/select/01e2cd.wgsl new file mode 100644 index 0000000000..e33b451811 --- /dev/null +++ b/test/tint/builtins/gen/var/select/01e2cd.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<3, i32>, vec<3, i32>, vec<3, bool>) -> vec<3, i32> +fn select_01e2cd() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var arg_2 = vec3(); + var res: vec3 = select(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + select_01e2cd(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + select_01e2cd(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + select_01e2cd(); +} diff --git a/test/tint/builtins/gen/var/select/01e2cd.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/01e2cd.wgsl.expected.glsl new file mode 100644 index 0000000000..66f69a457c --- /dev/null +++ b/test/tint/builtins/gen/var/select/01e2cd.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void select_01e2cd() { + ivec3 arg_0 = ivec3(0); + ivec3 arg_1 = ivec3(0); + bvec3 arg_2 = bvec3(false); + ivec3 res = mix(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + select_01e2cd(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_01e2cd() { + ivec3 arg_0 = ivec3(0); + ivec3 arg_1 = ivec3(0); + bvec3 arg_2 = bvec3(false); + ivec3 res = mix(arg_0, arg_1, arg_2); +} + +void fragment_main() { + select_01e2cd(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_01e2cd() { + ivec3 arg_0 = ivec3(0); + ivec3 arg_1 = ivec3(0); + bvec3 arg_2 = bvec3(false); + ivec3 res = mix(arg_0, arg_1, arg_2); +} + +void compute_main() { + select_01e2cd(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/select/01e2cd.wgsl.expected.hlsl b/test/tint/builtins/gen/var/select/01e2cd.wgsl.expected.hlsl new file mode 100644 index 0000000000..633a71105c --- /dev/null +++ b/test/tint/builtins/gen/var/select/01e2cd.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +void select_01e2cd() { + int3 arg_0 = (0).xxx; + int3 arg_1 = (0).xxx; + bool3 arg_2 = (false).xxx; + int3 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_01e2cd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_01e2cd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_01e2cd(); + return; +} diff --git a/test/tint/builtins/gen/var/select/01e2cd.wgsl.expected.msl b/test/tint/builtins/gen/var/select/01e2cd.wgsl.expected.msl new file mode 100644 index 0000000000..baa5aaeb72 --- /dev/null +++ b/test/tint/builtins/gen/var/select/01e2cd.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void select_01e2cd() { + int3 arg_0 = int3(0); + int3 arg_1 = int3(0); + bool3 arg_2 = bool3(false); + int3 res = select(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_01e2cd(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_01e2cd(); + return; +} + +kernel void compute_main() { + select_01e2cd(); + return; +} + diff --git a/test/tint/builtins/gen/var/select/01e2cd.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/01e2cd.wgsl.expected.spvasm new file mode 100644 index 0000000000..1025685aed --- /dev/null +++ b/test/tint/builtins/gen/var/select/01e2cd.wgsl.expected.spvasm @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_01e2cd "select_01e2cd" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %15 = OpConstantNull %v3int +%_ptr_Function_v3int = OpTypePointer Function %v3int + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %21 = OpConstantNull %v3bool +%_ptr_Function_v3bool = OpTypePointer Function %v3bool + %29 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_01e2cd = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3int Function %15 + %arg_1 = OpVariable %_ptr_Function_v3int Function %15 + %arg_2 = OpVariable %_ptr_Function_v3bool Function %21 + %res = OpVariable %_ptr_Function_v3int Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %21 + %25 = OpLoad %v3bool %arg_2 + %26 = OpLoad %v3int %arg_1 + %27 = OpLoad %v3int %arg_0 + %24 = OpSelect %v3int %25 %26 %27 + OpStore %res %24 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %29 + %31 = OpLabel + %32 = OpFunctionCall %void %select_01e2cd + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %35 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %select_01e2cd + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %41 = OpLabel + %42 = OpFunctionCall %void %select_01e2cd + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/select/01e2cd.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/01e2cd.wgsl.expected.wgsl new file mode 100644 index 0000000000..9e110daf95 --- /dev/null +++ b/test/tint/builtins/gen/var/select/01e2cd.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn select_01e2cd() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var arg_2 = vec3(); + var res : vec3 = select(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + select_01e2cd(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + select_01e2cd(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + select_01e2cd(); +} diff --git a/test/tint/builtins/gen/var/select/087ea4.wgsl b/test/tint/builtins/gen/var/select/087ea4.wgsl new file mode 100644 index 0000000000..a3c3dd7f93 --- /dev/null +++ b/test/tint/builtins/gen/var/select/087ea4.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<4, u32>, vec<4, u32>, bool) -> vec<4, u32> +fn select_087ea4() { + var arg_0 = vec4(); + var arg_1 = vec4(); + var arg_2 = bool(); + var res: vec4 = select(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + select_087ea4(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + select_087ea4(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + select_087ea4(); +} diff --git a/test/tint/builtins/gen/var/select/087ea4.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/087ea4.wgsl.expected.glsl new file mode 100644 index 0000000000..cd692d5fe1 --- /dev/null +++ b/test/tint/builtins/gen/var/select/087ea4.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void select_087ea4() { + uvec4 arg_0 = uvec4(0u); + uvec4 arg_1 = uvec4(0u); + bool arg_2 = false; + uvec4 res = (arg_2 ? arg_1 : arg_0); +} + +vec4 vertex_main() { + select_087ea4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_087ea4() { + uvec4 arg_0 = uvec4(0u); + uvec4 arg_1 = uvec4(0u); + bool arg_2 = false; + uvec4 res = (arg_2 ? arg_1 : arg_0); +} + +void fragment_main() { + select_087ea4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_087ea4() { + uvec4 arg_0 = uvec4(0u); + uvec4 arg_1 = uvec4(0u); + bool arg_2 = false; + uvec4 res = (arg_2 ? arg_1 : arg_0); +} + +void compute_main() { + select_087ea4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/select/087ea4.wgsl.expected.hlsl b/test/tint/builtins/gen/var/select/087ea4.wgsl.expected.hlsl new file mode 100644 index 0000000000..d7f59159c3 --- /dev/null +++ b/test/tint/builtins/gen/var/select/087ea4.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +void select_087ea4() { + uint4 arg_0 = (0u).xxxx; + uint4 arg_1 = (0u).xxxx; + bool arg_2 = false; + uint4 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_087ea4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_087ea4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_087ea4(); + return; +} diff --git a/test/tint/builtins/gen/var/select/087ea4.wgsl.expected.msl b/test/tint/builtins/gen/var/select/087ea4.wgsl.expected.msl new file mode 100644 index 0000000000..c42d1e5159 --- /dev/null +++ b/test/tint/builtins/gen/var/select/087ea4.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void select_087ea4() { + uint4 arg_0 = uint4(0u); + uint4 arg_1 = uint4(0u); + bool arg_2 = false; + uint4 res = select(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_087ea4(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_087ea4(); + return; +} + +kernel void compute_main() { + select_087ea4(); + return; +} + diff --git a/test/tint/builtins/gen/var/select/087ea4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/087ea4.wgsl.expected.spvasm new file mode 100644 index 0000000000..34e1100730 --- /dev/null +++ b/test/tint/builtins/gen/var/select/087ea4.wgsl.expected.spvasm @@ -0,0 +1,87 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_087ea4 "select_087ea4" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + %15 = OpConstantNull %v4uint +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %bool = OpTypeBool + %20 = OpConstantNull %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %v4bool = OpTypeVector %bool 4 +%_ptr_Function_v4bool = OpTypePointer Function %v4bool + %30 = OpConstantNull %v4bool + %33 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_087ea4 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4uint Function %15 + %arg_1 = OpVariable %_ptr_Function_v4uint Function %15 + %arg_2 = OpVariable %_ptr_Function_bool Function %20 + %28 = OpVariable %_ptr_Function_v4bool Function %30 + %res = OpVariable %_ptr_Function_v4uint Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %20 + %24 = OpLoad %bool %arg_2 + %25 = OpLoad %v4uint %arg_1 + %26 = OpLoad %v4uint %arg_0 + %31 = OpCompositeConstruct %v4bool %24 %24 %24 %24 + %23 = OpSelect %v4uint %31 %25 %26 + OpStore %res %23 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %33 + %35 = OpLabel + %36 = OpFunctionCall %void %select_087ea4 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %39 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %42 = OpLabel + %43 = OpFunctionCall %void %select_087ea4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %45 = OpLabel + %46 = OpFunctionCall %void %select_087ea4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/select/087ea4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/087ea4.wgsl.expected.wgsl new file mode 100644 index 0000000000..c868bbfa9d --- /dev/null +++ b/test/tint/builtins/gen/var/select/087ea4.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn select_087ea4() { + var arg_0 = vec4(); + var arg_1 = vec4(); + var arg_2 = bool(); + var res : vec4 = select(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + select_087ea4(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + select_087ea4(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + select_087ea4(); +} diff --git a/test/tint/builtins/gen/var/select/1e960b.wgsl b/test/tint/builtins/gen/var/select/1e960b.wgsl new file mode 100644 index 0000000000..9f66b8548d --- /dev/null +++ b/test/tint/builtins/gen/var/select/1e960b.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<2, u32>, vec<2, u32>, vec<2, bool>) -> vec<2, u32> +fn select_1e960b() { + var arg_0 = vec2(); + var arg_1 = vec2(); + var arg_2 = vec2(); + var res: vec2 = select(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + select_1e960b(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + select_1e960b(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + select_1e960b(); +} diff --git a/test/tint/builtins/gen/var/select/1e960b.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/1e960b.wgsl.expected.glsl new file mode 100644 index 0000000000..535a865afa --- /dev/null +++ b/test/tint/builtins/gen/var/select/1e960b.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void select_1e960b() { + uvec2 arg_0 = uvec2(0u); + uvec2 arg_1 = uvec2(0u); + bvec2 arg_2 = bvec2(false); + uvec2 res = mix(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + select_1e960b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_1e960b() { + uvec2 arg_0 = uvec2(0u); + uvec2 arg_1 = uvec2(0u); + bvec2 arg_2 = bvec2(false); + uvec2 res = mix(arg_0, arg_1, arg_2); +} + +void fragment_main() { + select_1e960b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_1e960b() { + uvec2 arg_0 = uvec2(0u); + uvec2 arg_1 = uvec2(0u); + bvec2 arg_2 = bvec2(false); + uvec2 res = mix(arg_0, arg_1, arg_2); +} + +void compute_main() { + select_1e960b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/select/1e960b.wgsl.expected.hlsl b/test/tint/builtins/gen/var/select/1e960b.wgsl.expected.hlsl new file mode 100644 index 0000000000..96128cc432 --- /dev/null +++ b/test/tint/builtins/gen/var/select/1e960b.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +void select_1e960b() { + uint2 arg_0 = (0u).xx; + uint2 arg_1 = (0u).xx; + bool2 arg_2 = (false).xx; + uint2 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_1e960b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_1e960b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_1e960b(); + return; +} diff --git a/test/tint/builtins/gen/var/select/1e960b.wgsl.expected.msl b/test/tint/builtins/gen/var/select/1e960b.wgsl.expected.msl new file mode 100644 index 0000000000..9f44a9492b --- /dev/null +++ b/test/tint/builtins/gen/var/select/1e960b.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void select_1e960b() { + uint2 arg_0 = uint2(0u); + uint2 arg_1 = uint2(0u); + bool2 arg_2 = bool2(false); + uint2 res = select(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_1e960b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_1e960b(); + return; +} + +kernel void compute_main() { + select_1e960b(); + return; +} + diff --git a/test/tint/builtins/gen/var/select/1e960b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/1e960b.wgsl.expected.spvasm new file mode 100644 index 0000000000..70bc86aac1 --- /dev/null +++ b/test/tint/builtins/gen/var/select/1e960b.wgsl.expected.spvasm @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_1e960b "select_1e960b" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %15 = OpConstantNull %v2uint +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %21 = OpConstantNull %v2bool +%_ptr_Function_v2bool = OpTypePointer Function %v2bool + %29 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_1e960b = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2uint Function %15 + %arg_1 = OpVariable %_ptr_Function_v2uint Function %15 + %arg_2 = OpVariable %_ptr_Function_v2bool Function %21 + %res = OpVariable %_ptr_Function_v2uint Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %21 + %25 = OpLoad %v2bool %arg_2 + %26 = OpLoad %v2uint %arg_1 + %27 = OpLoad %v2uint %arg_0 + %24 = OpSelect %v2uint %25 %26 %27 + OpStore %res %24 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %29 + %31 = OpLabel + %32 = OpFunctionCall %void %select_1e960b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %35 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %select_1e960b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %41 = OpLabel + %42 = OpFunctionCall %void %select_1e960b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/select/1e960b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/1e960b.wgsl.expected.wgsl new file mode 100644 index 0000000000..74b9532c8f --- /dev/null +++ b/test/tint/builtins/gen/var/select/1e960b.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn select_1e960b() { + var arg_0 = vec2(); + var arg_1 = vec2(); + var arg_2 = vec2(); + var res : vec2 = select(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + select_1e960b(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + select_1e960b(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + select_1e960b(); +} diff --git a/test/tint/builtins/gen/var/select/266aff.wgsl b/test/tint/builtins/gen/var/select/266aff.wgsl new file mode 100644 index 0000000000..7630dfbd77 --- /dev/null +++ b/test/tint/builtins/gen/var/select/266aff.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<2, f32>, vec<2, f32>, vec<2, bool>) -> vec<2, f32> +fn select_266aff() { + var arg_0 = vec2(); + var arg_1 = vec2(); + var arg_2 = vec2(); + var res: vec2 = select(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + select_266aff(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + select_266aff(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + select_266aff(); +} diff --git a/test/tint/builtins/gen/var/select/266aff.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/266aff.wgsl.expected.glsl new file mode 100644 index 0000000000..0bc653dd5c --- /dev/null +++ b/test/tint/builtins/gen/var/select/266aff.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void select_266aff() { + vec2 arg_0 = vec2(0.0f); + vec2 arg_1 = vec2(0.0f); + bvec2 arg_2 = bvec2(false); + vec2 res = mix(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + select_266aff(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_266aff() { + vec2 arg_0 = vec2(0.0f); + vec2 arg_1 = vec2(0.0f); + bvec2 arg_2 = bvec2(false); + vec2 res = mix(arg_0, arg_1, arg_2); +} + +void fragment_main() { + select_266aff(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_266aff() { + vec2 arg_0 = vec2(0.0f); + vec2 arg_1 = vec2(0.0f); + bvec2 arg_2 = bvec2(false); + vec2 res = mix(arg_0, arg_1, arg_2); +} + +void compute_main() { + select_266aff(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/select/266aff.wgsl.expected.hlsl b/test/tint/builtins/gen/var/select/266aff.wgsl.expected.hlsl new file mode 100644 index 0000000000..1615eb0b40 --- /dev/null +++ b/test/tint/builtins/gen/var/select/266aff.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +void select_266aff() { + float2 arg_0 = (0.0f).xx; + float2 arg_1 = (0.0f).xx; + bool2 arg_2 = (false).xx; + float2 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_266aff(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_266aff(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_266aff(); + return; +} diff --git a/test/tint/builtins/gen/var/select/266aff.wgsl.expected.msl b/test/tint/builtins/gen/var/select/266aff.wgsl.expected.msl new file mode 100644 index 0000000000..ed3eacc398 --- /dev/null +++ b/test/tint/builtins/gen/var/select/266aff.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void select_266aff() { + float2 arg_0 = float2(0.0f); + float2 arg_1 = float2(0.0f); + bool2 arg_2 = bool2(false); + float2 res = select(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_266aff(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_266aff(); + return; +} + +kernel void compute_main() { + select_266aff(); + return; +} + diff --git a/test/tint/builtins/gen/var/select/266aff.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/266aff.wgsl.expected.spvasm new file mode 100644 index 0000000000..b4542d6429 --- /dev/null +++ b/test/tint/builtins/gen/var/select/266aff.wgsl.expected.spvasm @@ -0,0 +1,82 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 42 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_266aff "select_266aff" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %14 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %20 = OpConstantNull %v2bool +%_ptr_Function_v2bool = OpTypePointer Function %v2bool + %28 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_266aff = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %14 + %arg_1 = OpVariable %_ptr_Function_v2float Function %14 + %arg_2 = OpVariable %_ptr_Function_v2bool Function %20 + %res = OpVariable %_ptr_Function_v2float Function %14 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + OpStore %arg_2 %20 + %24 = OpLoad %v2bool %arg_2 + %25 = OpLoad %v2float %arg_1 + %26 = OpLoad %v2float %arg_0 + %23 = OpSelect %v2float %24 %25 %26 + OpStore %res %23 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %28 + %30 = OpLabel + %31 = OpFunctionCall %void %select_266aff + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %34 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %select_266aff + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %40 = OpLabel + %41 = OpFunctionCall %void %select_266aff + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/select/266aff.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/266aff.wgsl.expected.wgsl new file mode 100644 index 0000000000..0236878d08 --- /dev/null +++ b/test/tint/builtins/gen/var/select/266aff.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn select_266aff() { + var arg_0 = vec2(); + var arg_1 = vec2(); + var arg_2 = vec2(); + var res : vec2 = select(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + select_266aff(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + select_266aff(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + select_266aff(); +} diff --git a/test/tint/builtins/gen/var/select/28a27e.wgsl b/test/tint/builtins/gen/var/select/28a27e.wgsl new file mode 100644 index 0000000000..f9ae32bca5 --- /dev/null +++ b/test/tint/builtins/gen/var/select/28a27e.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<3, u32>, vec<3, u32>, vec<3, bool>) -> vec<3, u32> +fn select_28a27e() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var arg_2 = vec3(); + var res: vec3 = select(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + select_28a27e(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + select_28a27e(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + select_28a27e(); +} diff --git a/test/tint/builtins/gen/var/select/28a27e.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/28a27e.wgsl.expected.glsl new file mode 100644 index 0000000000..fb511ee385 --- /dev/null +++ b/test/tint/builtins/gen/var/select/28a27e.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void select_28a27e() { + uvec3 arg_0 = uvec3(0u); + uvec3 arg_1 = uvec3(0u); + bvec3 arg_2 = bvec3(false); + uvec3 res = mix(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + select_28a27e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_28a27e() { + uvec3 arg_0 = uvec3(0u); + uvec3 arg_1 = uvec3(0u); + bvec3 arg_2 = bvec3(false); + uvec3 res = mix(arg_0, arg_1, arg_2); +} + +void fragment_main() { + select_28a27e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_28a27e() { + uvec3 arg_0 = uvec3(0u); + uvec3 arg_1 = uvec3(0u); + bvec3 arg_2 = bvec3(false); + uvec3 res = mix(arg_0, arg_1, arg_2); +} + +void compute_main() { + select_28a27e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/select/28a27e.wgsl.expected.hlsl b/test/tint/builtins/gen/var/select/28a27e.wgsl.expected.hlsl new file mode 100644 index 0000000000..9528d884fb --- /dev/null +++ b/test/tint/builtins/gen/var/select/28a27e.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +void select_28a27e() { + uint3 arg_0 = (0u).xxx; + uint3 arg_1 = (0u).xxx; + bool3 arg_2 = (false).xxx; + uint3 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_28a27e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_28a27e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_28a27e(); + return; +} diff --git a/test/tint/builtins/gen/var/select/28a27e.wgsl.expected.msl b/test/tint/builtins/gen/var/select/28a27e.wgsl.expected.msl new file mode 100644 index 0000000000..2ad0a434a2 --- /dev/null +++ b/test/tint/builtins/gen/var/select/28a27e.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void select_28a27e() { + uint3 arg_0 = uint3(0u); + uint3 arg_1 = uint3(0u); + bool3 arg_2 = bool3(false); + uint3 res = select(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_28a27e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_28a27e(); + return; +} + +kernel void compute_main() { + select_28a27e(); + return; +} + diff --git a/test/tint/builtins/gen/var/select/28a27e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/28a27e.wgsl.expected.spvasm new file mode 100644 index 0000000000..7bf5f53ab7 --- /dev/null +++ b/test/tint/builtins/gen/var/select/28a27e.wgsl.expected.spvasm @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_28a27e "select_28a27e" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %15 = OpConstantNull %v3uint +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %21 = OpConstantNull %v3bool +%_ptr_Function_v3bool = OpTypePointer Function %v3bool + %29 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_28a27e = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3uint Function %15 + %arg_1 = OpVariable %_ptr_Function_v3uint Function %15 + %arg_2 = OpVariable %_ptr_Function_v3bool Function %21 + %res = OpVariable %_ptr_Function_v3uint Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %21 + %25 = OpLoad %v3bool %arg_2 + %26 = OpLoad %v3uint %arg_1 + %27 = OpLoad %v3uint %arg_0 + %24 = OpSelect %v3uint %25 %26 %27 + OpStore %res %24 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %29 + %31 = OpLabel + %32 = OpFunctionCall %void %select_28a27e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %35 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %select_28a27e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %41 = OpLabel + %42 = OpFunctionCall %void %select_28a27e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/select/28a27e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/28a27e.wgsl.expected.wgsl new file mode 100644 index 0000000000..2aa730bbe6 --- /dev/null +++ b/test/tint/builtins/gen/var/select/28a27e.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn select_28a27e() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var arg_2 = vec3(); + var res : vec3 = select(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + select_28a27e(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + select_28a27e(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + select_28a27e(); +} diff --git a/test/tint/builtins/gen/var/select/3c25ce.wgsl b/test/tint/builtins/gen/var/select/3c25ce.wgsl new file mode 100644 index 0000000000..913cb41234 --- /dev/null +++ b/test/tint/builtins/gen/var/select/3c25ce.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<3, bool>, vec<3, bool>, bool) -> vec<3, bool> +fn select_3c25ce() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var arg_2 = bool(); + var res: vec3 = select(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + select_3c25ce(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + select_3c25ce(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + select_3c25ce(); +} diff --git a/test/tint/builtins/gen/var/select/3c25ce.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/3c25ce.wgsl.expected.glsl new file mode 100644 index 0000000000..d05d533df2 --- /dev/null +++ b/test/tint/builtins/gen/var/select/3c25ce.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void select_3c25ce() { + bvec3 arg_0 = bvec3(false); + bvec3 arg_1 = bvec3(false); + bool arg_2 = false; + bvec3 res = (arg_2 ? arg_1 : arg_0); +} + +vec4 vertex_main() { + select_3c25ce(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_3c25ce() { + bvec3 arg_0 = bvec3(false); + bvec3 arg_1 = bvec3(false); + bool arg_2 = false; + bvec3 res = (arg_2 ? arg_1 : arg_0); +} + +void fragment_main() { + select_3c25ce(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_3c25ce() { + bvec3 arg_0 = bvec3(false); + bvec3 arg_1 = bvec3(false); + bool arg_2 = false; + bvec3 res = (arg_2 ? arg_1 : arg_0); +} + +void compute_main() { + select_3c25ce(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/select/3c25ce.wgsl.expected.hlsl b/test/tint/builtins/gen/var/select/3c25ce.wgsl.expected.hlsl new file mode 100644 index 0000000000..60e232d3d0 --- /dev/null +++ b/test/tint/builtins/gen/var/select/3c25ce.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +void select_3c25ce() { + bool3 arg_0 = (false).xxx; + bool3 arg_1 = (false).xxx; + bool arg_2 = false; + bool3 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_3c25ce(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_3c25ce(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_3c25ce(); + return; +} diff --git a/test/tint/builtins/gen/var/select/3c25ce.wgsl.expected.msl b/test/tint/builtins/gen/var/select/3c25ce.wgsl.expected.msl new file mode 100644 index 0000000000..9a106b7ed7 --- /dev/null +++ b/test/tint/builtins/gen/var/select/3c25ce.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void select_3c25ce() { + bool3 arg_0 = bool3(false); + bool3 arg_1 = bool3(false); + bool arg_2 = false; + bool3 res = select(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_3c25ce(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_3c25ce(); + return; +} + +kernel void compute_main() { + select_3c25ce(); + return; +} + diff --git a/test/tint/builtins/gen/var/select/3c25ce.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/3c25ce.wgsl.expected.spvasm new file mode 100644 index 0000000000..189d6322ff --- /dev/null +++ b/test/tint/builtins/gen/var/select/3c25ce.wgsl.expected.spvasm @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_3c25ce "select_3c25ce" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %15 = OpConstantNull %v3bool +%_ptr_Function_v3bool = OpTypePointer Function %v3bool + %19 = OpConstantNull %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %29 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_3c25ce = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3bool Function %15 + %arg_1 = OpVariable %_ptr_Function_v3bool Function %15 + %arg_2 = OpVariable %_ptr_Function_bool Function %19 + %26 = OpVariable %_ptr_Function_v3bool Function %15 + %res = OpVariable %_ptr_Function_v3bool Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %19 + %23 = OpLoad %bool %arg_2 + %24 = OpLoad %v3bool %arg_1 + %25 = OpLoad %v3bool %arg_0 + %27 = OpCompositeConstruct %v3bool %23 %23 %23 + %22 = OpSelect %v3bool %27 %24 %25 + OpStore %res %22 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %29 + %31 = OpLabel + %32 = OpFunctionCall %void %select_3c25ce + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %35 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %select_3c25ce + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %41 = OpLabel + %42 = OpFunctionCall %void %select_3c25ce + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/select/3c25ce.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/3c25ce.wgsl.expected.wgsl new file mode 100644 index 0000000000..396fac01fc --- /dev/null +++ b/test/tint/builtins/gen/var/select/3c25ce.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn select_3c25ce() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var arg_2 = bool(); + var res : vec3 = select(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + select_3c25ce(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + select_3c25ce(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + select_3c25ce(); +} diff --git a/test/tint/builtins/gen/var/select/416e14.wgsl b/test/tint/builtins/gen/var/select/416e14.wgsl new file mode 100644 index 0000000000..9e9c75909f --- /dev/null +++ b/test/tint/builtins/gen/var/select/416e14.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(f32, f32, bool) -> f32 +fn select_416e14() { + var arg_0 = 1.0; + var arg_1 = 1.0; + var arg_2 = bool(); + var res: f32 = select(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + select_416e14(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + select_416e14(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + select_416e14(); +} diff --git a/test/tint/builtins/gen/var/select/416e14.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/416e14.wgsl.expected.glsl new file mode 100644 index 0000000000..a6b35b665c --- /dev/null +++ b/test/tint/builtins/gen/var/select/416e14.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void select_416e14() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + bool arg_2 = false; + float res = (arg_2 ? arg_1 : arg_0); +} + +vec4 vertex_main() { + select_416e14(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_416e14() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + bool arg_2 = false; + float res = (arg_2 ? arg_1 : arg_0); +} + +void fragment_main() { + select_416e14(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_416e14() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + bool arg_2 = false; + float res = (arg_2 ? arg_1 : arg_0); +} + +void compute_main() { + select_416e14(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/select/416e14.wgsl.expected.hlsl b/test/tint/builtins/gen/var/select/416e14.wgsl.expected.hlsl new file mode 100644 index 0000000000..a55bde8425 --- /dev/null +++ b/test/tint/builtins/gen/var/select/416e14.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +void select_416e14() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + bool arg_2 = false; + float res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_416e14(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_416e14(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_416e14(); + return; +} diff --git a/test/tint/builtins/gen/var/select/416e14.wgsl.expected.msl b/test/tint/builtins/gen/var/select/416e14.wgsl.expected.msl new file mode 100644 index 0000000000..a11fa7bb10 --- /dev/null +++ b/test/tint/builtins/gen/var/select/416e14.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void select_416e14() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + bool arg_2 = false; + float res = select(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_416e14(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_416e14(); + return; +} + +kernel void compute_main() { + select_416e14(); + return; +} + diff --git a/test/tint/builtins/gen/var/select/416e14.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/416e14.wgsl.expected.spvasm new file mode 100644 index 0000000000..b37cdb4d59 --- /dev/null +++ b/test/tint/builtins/gen/var/select/416e14.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_416e14 "select_416e14" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %bool = OpTypeBool + %18 = OpConstantNull %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %26 = OpTypeFunction %v4float +%select_416e14 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %arg_1 = OpVariable %_ptr_Function_float Function %8 + %arg_2 = OpVariable %_ptr_Function_bool Function %18 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + OpStore %arg_1 %float_1 + OpStore %arg_2 %18 + %22 = OpLoad %bool %arg_2 + %23 = OpLoad %float %arg_1 + %24 = OpLoad %float %arg_0 + %21 = OpSelect %float %22 %23 %24 + OpStore %res %21 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %select_416e14 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %select_416e14 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %select_416e14 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/select/416e14.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/416e14.wgsl.expected.wgsl new file mode 100644 index 0000000000..d35a4c248a --- /dev/null +++ b/test/tint/builtins/gen/var/select/416e14.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn select_416e14() { + var arg_0 = 1.0; + var arg_1 = 1.0; + var arg_2 = bool(); + var res : f32 = select(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + select_416e14(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + select_416e14(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + select_416e14(); +} diff --git a/test/tint/builtins/gen/var/select/51b047.wgsl b/test/tint/builtins/gen/var/select/51b047.wgsl new file mode 100644 index 0000000000..aca27281a9 --- /dev/null +++ b/test/tint/builtins/gen/var/select/51b047.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<2, u32>, vec<2, u32>, bool) -> vec<2, u32> +fn select_51b047() { + var arg_0 = vec2(); + var arg_1 = vec2(); + var arg_2 = bool(); + var res: vec2 = select(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + select_51b047(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + select_51b047(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + select_51b047(); +} diff --git a/test/tint/builtins/gen/var/select/51b047.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/51b047.wgsl.expected.glsl new file mode 100644 index 0000000000..85302fe2e2 --- /dev/null +++ b/test/tint/builtins/gen/var/select/51b047.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void select_51b047() { + uvec2 arg_0 = uvec2(0u); + uvec2 arg_1 = uvec2(0u); + bool arg_2 = false; + uvec2 res = (arg_2 ? arg_1 : arg_0); +} + +vec4 vertex_main() { + select_51b047(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_51b047() { + uvec2 arg_0 = uvec2(0u); + uvec2 arg_1 = uvec2(0u); + bool arg_2 = false; + uvec2 res = (arg_2 ? arg_1 : arg_0); +} + +void fragment_main() { + select_51b047(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_51b047() { + uvec2 arg_0 = uvec2(0u); + uvec2 arg_1 = uvec2(0u); + bool arg_2 = false; + uvec2 res = (arg_2 ? arg_1 : arg_0); +} + +void compute_main() { + select_51b047(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/select/51b047.wgsl.expected.hlsl b/test/tint/builtins/gen/var/select/51b047.wgsl.expected.hlsl new file mode 100644 index 0000000000..09f6e9eb33 --- /dev/null +++ b/test/tint/builtins/gen/var/select/51b047.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +void select_51b047() { + uint2 arg_0 = (0u).xx; + uint2 arg_1 = (0u).xx; + bool arg_2 = false; + uint2 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_51b047(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_51b047(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_51b047(); + return; +} diff --git a/test/tint/builtins/gen/var/select/51b047.wgsl.expected.msl b/test/tint/builtins/gen/var/select/51b047.wgsl.expected.msl new file mode 100644 index 0000000000..9eb0a1d631 --- /dev/null +++ b/test/tint/builtins/gen/var/select/51b047.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void select_51b047() { + uint2 arg_0 = uint2(0u); + uint2 arg_1 = uint2(0u); + bool arg_2 = false; + uint2 res = select(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_51b047(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_51b047(); + return; +} + +kernel void compute_main() { + select_51b047(); + return; +} + diff --git a/test/tint/builtins/gen/var/select/51b047.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/51b047.wgsl.expected.spvasm new file mode 100644 index 0000000000..fd5e791bf4 --- /dev/null +++ b/test/tint/builtins/gen/var/select/51b047.wgsl.expected.spvasm @@ -0,0 +1,87 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_51b047 "select_51b047" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %15 = OpConstantNull %v2uint +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %bool = OpTypeBool + %20 = OpConstantNull %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %v2bool = OpTypeVector %bool 2 +%_ptr_Function_v2bool = OpTypePointer Function %v2bool + %30 = OpConstantNull %v2bool + %33 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_51b047 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2uint Function %15 + %arg_1 = OpVariable %_ptr_Function_v2uint Function %15 + %arg_2 = OpVariable %_ptr_Function_bool Function %20 + %28 = OpVariable %_ptr_Function_v2bool Function %30 + %res = OpVariable %_ptr_Function_v2uint Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %20 + %24 = OpLoad %bool %arg_2 + %25 = OpLoad %v2uint %arg_1 + %26 = OpLoad %v2uint %arg_0 + %31 = OpCompositeConstruct %v2bool %24 %24 + %23 = OpSelect %v2uint %31 %25 %26 + OpStore %res %23 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %33 + %35 = OpLabel + %36 = OpFunctionCall %void %select_51b047 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %39 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %42 = OpLabel + %43 = OpFunctionCall %void %select_51b047 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %45 = OpLabel + %46 = OpFunctionCall %void %select_51b047 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/select/51b047.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/51b047.wgsl.expected.wgsl new file mode 100644 index 0000000000..dd440a89d5 --- /dev/null +++ b/test/tint/builtins/gen/var/select/51b047.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn select_51b047() { + var arg_0 = vec2(); + var arg_1 = vec2(); + var arg_2 = bool(); + var res : vec2 = select(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + select_51b047(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + select_51b047(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + select_51b047(); +} diff --git a/test/tint/builtins/gen/var/select/713567.wgsl b/test/tint/builtins/gen/var/select/713567.wgsl new file mode 100644 index 0000000000..f638664afc --- /dev/null +++ b/test/tint/builtins/gen/var/select/713567.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<4, f32>, vec<4, f32>, bool) -> vec<4, f32> +fn select_713567() { + var arg_0 = vec4(); + var arg_1 = vec4(); + var arg_2 = bool(); + var res: vec4 = select(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + select_713567(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + select_713567(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + select_713567(); +} diff --git a/test/tint/builtins/gen/var/select/713567.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/713567.wgsl.expected.glsl new file mode 100644 index 0000000000..b4cb4871b7 --- /dev/null +++ b/test/tint/builtins/gen/var/select/713567.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void select_713567() { + vec4 arg_0 = vec4(0.0f); + vec4 arg_1 = vec4(0.0f); + bool arg_2 = false; + vec4 res = (arg_2 ? arg_1 : arg_0); +} + +vec4 vertex_main() { + select_713567(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_713567() { + vec4 arg_0 = vec4(0.0f); + vec4 arg_1 = vec4(0.0f); + bool arg_2 = false; + vec4 res = (arg_2 ? arg_1 : arg_0); +} + +void fragment_main() { + select_713567(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_713567() { + vec4 arg_0 = vec4(0.0f); + vec4 arg_1 = vec4(0.0f); + bool arg_2 = false; + vec4 res = (arg_2 ? arg_1 : arg_0); +} + +void compute_main() { + select_713567(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/select/713567.wgsl.expected.hlsl b/test/tint/builtins/gen/var/select/713567.wgsl.expected.hlsl new file mode 100644 index 0000000000..52e530540b --- /dev/null +++ b/test/tint/builtins/gen/var/select/713567.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +void select_713567() { + float4 arg_0 = (0.0f).xxxx; + float4 arg_1 = (0.0f).xxxx; + bool arg_2 = false; + float4 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_713567(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_713567(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_713567(); + return; +} diff --git a/test/tint/builtins/gen/var/select/713567.wgsl.expected.msl b/test/tint/builtins/gen/var/select/713567.wgsl.expected.msl new file mode 100644 index 0000000000..6aa0057b05 --- /dev/null +++ b/test/tint/builtins/gen/var/select/713567.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void select_713567() { + float4 arg_0 = float4(0.0f); + float4 arg_1 = float4(0.0f); + bool arg_2 = false; + float4 res = select(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_713567(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_713567(); + return; +} + +kernel void compute_main() { + select_713567(); + return; +} + diff --git a/test/tint/builtins/gen/var/select/713567.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/713567.wgsl.expected.spvasm new file mode 100644 index 0000000000..a6ed5fa614 --- /dev/null +++ b/test/tint/builtins/gen/var/select/713567.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_713567 "select_713567" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %bool = OpTypeBool + %17 = OpConstantNull %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %v4bool = OpTypeVector %bool 4 +%_ptr_Function_v4bool = OpTypePointer Function %v4bool + %27 = OpConstantNull %v4bool + %30 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_713567 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %arg_1 = OpVariable %_ptr_Function_v4float Function %5 + %arg_2 = OpVariable %_ptr_Function_bool Function %17 + %25 = OpVariable %_ptr_Function_v4bool Function %27 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %5 + OpStore %arg_1 %5 + OpStore %arg_2 %17 + %21 = OpLoad %bool %arg_2 + %22 = OpLoad %v4float %arg_1 + %23 = OpLoad %v4float %arg_0 + %28 = OpCompositeConstruct %v4bool %21 %21 %21 %21 + %20 = OpSelect %v4float %28 %22 %23 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %select_713567 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %36 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %39 = OpLabel + %40 = OpFunctionCall %void %select_713567 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %42 = OpLabel + %43 = OpFunctionCall %void %select_713567 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/select/713567.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/713567.wgsl.expected.wgsl new file mode 100644 index 0000000000..1bc9fb6a58 --- /dev/null +++ b/test/tint/builtins/gen/var/select/713567.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn select_713567() { + var arg_0 = vec4(); + var arg_1 = vec4(); + var arg_2 = bool(); + var res : vec4 = select(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + select_713567(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + select_713567(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + select_713567(); +} diff --git a/test/tint/builtins/gen/var/select/78be5f.wgsl b/test/tint/builtins/gen/var/select/78be5f.wgsl new file mode 100644 index 0000000000..427d23e3a8 --- /dev/null +++ b/test/tint/builtins/gen/var/select/78be5f.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<3, f32>, vec<3, f32>, bool) -> vec<3, f32> +fn select_78be5f() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var arg_2 = bool(); + var res: vec3 = select(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + select_78be5f(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + select_78be5f(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + select_78be5f(); +} diff --git a/test/tint/builtins/gen/var/select/78be5f.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/78be5f.wgsl.expected.glsl new file mode 100644 index 0000000000..562791dc29 --- /dev/null +++ b/test/tint/builtins/gen/var/select/78be5f.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void select_78be5f() { + vec3 arg_0 = vec3(0.0f); + vec3 arg_1 = vec3(0.0f); + bool arg_2 = false; + vec3 res = (arg_2 ? arg_1 : arg_0); +} + +vec4 vertex_main() { + select_78be5f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_78be5f() { + vec3 arg_0 = vec3(0.0f); + vec3 arg_1 = vec3(0.0f); + bool arg_2 = false; + vec3 res = (arg_2 ? arg_1 : arg_0); +} + +void fragment_main() { + select_78be5f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_78be5f() { + vec3 arg_0 = vec3(0.0f); + vec3 arg_1 = vec3(0.0f); + bool arg_2 = false; + vec3 res = (arg_2 ? arg_1 : arg_0); +} + +void compute_main() { + select_78be5f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/select/78be5f.wgsl.expected.hlsl b/test/tint/builtins/gen/var/select/78be5f.wgsl.expected.hlsl new file mode 100644 index 0000000000..e3bf8eb476 --- /dev/null +++ b/test/tint/builtins/gen/var/select/78be5f.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +void select_78be5f() { + float3 arg_0 = (0.0f).xxx; + float3 arg_1 = (0.0f).xxx; + bool arg_2 = false; + float3 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_78be5f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_78be5f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_78be5f(); + return; +} diff --git a/test/tint/builtins/gen/var/select/78be5f.wgsl.expected.msl b/test/tint/builtins/gen/var/select/78be5f.wgsl.expected.msl new file mode 100644 index 0000000000..fa69529c4c --- /dev/null +++ b/test/tint/builtins/gen/var/select/78be5f.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void select_78be5f() { + float3 arg_0 = float3(0.0f); + float3 arg_1 = float3(0.0f); + bool arg_2 = false; + float3 res = select(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_78be5f(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_78be5f(); + return; +} + +kernel void compute_main() { + select_78be5f(); + return; +} + diff --git a/test/tint/builtins/gen/var/select/78be5f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/78be5f.wgsl.expected.spvasm new file mode 100644 index 0000000000..1581ba4c29 --- /dev/null +++ b/test/tint/builtins/gen/var/select/78be5f.wgsl.expected.spvasm @@ -0,0 +1,86 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 46 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_78be5f "select_78be5f" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %14 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %bool = OpTypeBool + %19 = OpConstantNull %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %v3bool = OpTypeVector %bool 3 +%_ptr_Function_v3bool = OpTypePointer Function %v3bool + %29 = OpConstantNull %v3bool + %32 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_78be5f = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %14 + %arg_1 = OpVariable %_ptr_Function_v3float Function %14 + %arg_2 = OpVariable %_ptr_Function_bool Function %19 + %27 = OpVariable %_ptr_Function_v3bool Function %29 + %res = OpVariable %_ptr_Function_v3float Function %14 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + OpStore %arg_2 %19 + %23 = OpLoad %bool %arg_2 + %24 = OpLoad %v3float %arg_1 + %25 = OpLoad %v3float %arg_0 + %30 = OpCompositeConstruct %v3bool %23 %23 %23 + %22 = OpSelect %v3float %30 %24 %25 + OpStore %res %22 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %32 + %34 = OpLabel + %35 = OpFunctionCall %void %select_78be5f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %38 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %41 = OpLabel + %42 = OpFunctionCall %void %select_78be5f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %44 = OpLabel + %45 = OpFunctionCall %void %select_78be5f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/select/78be5f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/78be5f.wgsl.expected.wgsl new file mode 100644 index 0000000000..71f76b0749 --- /dev/null +++ b/test/tint/builtins/gen/var/select/78be5f.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn select_78be5f() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var arg_2 = bool(); + var res : vec3 = select(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + select_78be5f(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + select_78be5f(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + select_78be5f(); +} diff --git a/test/tint/builtins/gen/var/select/80a9a9.wgsl b/test/tint/builtins/gen/var/select/80a9a9.wgsl new file mode 100644 index 0000000000..cffeddc4b0 --- /dev/null +++ b/test/tint/builtins/gen/var/select/80a9a9.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<3, bool>, vec<3, bool>, vec<3, bool>) -> vec<3, bool> +fn select_80a9a9() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var arg_2 = vec3(); + var res: vec3 = select(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + select_80a9a9(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + select_80a9a9(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + select_80a9a9(); +} diff --git a/test/tint/builtins/gen/var/select/80a9a9.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/80a9a9.wgsl.expected.glsl new file mode 100644 index 0000000000..47f6301f49 --- /dev/null +++ b/test/tint/builtins/gen/var/select/80a9a9.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void select_80a9a9() { + bvec3 arg_0 = bvec3(false); + bvec3 arg_1 = bvec3(false); + bvec3 arg_2 = bvec3(false); + bvec3 res = mix(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + select_80a9a9(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_80a9a9() { + bvec3 arg_0 = bvec3(false); + bvec3 arg_1 = bvec3(false); + bvec3 arg_2 = bvec3(false); + bvec3 res = mix(arg_0, arg_1, arg_2); +} + +void fragment_main() { + select_80a9a9(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_80a9a9() { + bvec3 arg_0 = bvec3(false); + bvec3 arg_1 = bvec3(false); + bvec3 arg_2 = bvec3(false); + bvec3 res = mix(arg_0, arg_1, arg_2); +} + +void compute_main() { + select_80a9a9(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/select/80a9a9.wgsl.expected.hlsl b/test/tint/builtins/gen/var/select/80a9a9.wgsl.expected.hlsl new file mode 100644 index 0000000000..b9c340cdd5 --- /dev/null +++ b/test/tint/builtins/gen/var/select/80a9a9.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +void select_80a9a9() { + bool3 arg_0 = (false).xxx; + bool3 arg_1 = (false).xxx; + bool3 arg_2 = (false).xxx; + bool3 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_80a9a9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_80a9a9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_80a9a9(); + return; +} diff --git a/test/tint/builtins/gen/var/select/80a9a9.wgsl.expected.msl b/test/tint/builtins/gen/var/select/80a9a9.wgsl.expected.msl new file mode 100644 index 0000000000..3bc0c23917 --- /dev/null +++ b/test/tint/builtins/gen/var/select/80a9a9.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void select_80a9a9() { + bool3 arg_0 = bool3(false); + bool3 arg_1 = bool3(false); + bool3 arg_2 = bool3(false); + bool3 res = select(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_80a9a9(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_80a9a9(); + return; +} + +kernel void compute_main() { + select_80a9a9(); + return; +} + diff --git a/test/tint/builtins/gen/var/select/80a9a9.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/80a9a9.wgsl.expected.spvasm new file mode 100644 index 0000000000..73f1cdb19a --- /dev/null +++ b/test/tint/builtins/gen/var/select/80a9a9.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_80a9a9 "select_80a9a9" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %15 = OpConstantNull %v3bool +%_ptr_Function_v3bool = OpTypePointer Function %v3bool + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_80a9a9 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3bool Function %15 + %arg_1 = OpVariable %_ptr_Function_v3bool Function %15 + %arg_2 = OpVariable %_ptr_Function_v3bool Function %15 + %res = OpVariable %_ptr_Function_v3bool Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %15 + %21 = OpLoad %v3bool %arg_2 + %22 = OpLoad %v3bool %arg_1 + %23 = OpLoad %v3bool %arg_0 + %20 = OpSelect %v3bool %21 %22 %23 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %select_80a9a9 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %select_80a9a9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %select_80a9a9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/select/80a9a9.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/80a9a9.wgsl.expected.wgsl new file mode 100644 index 0000000000..a49c335443 --- /dev/null +++ b/test/tint/builtins/gen/var/select/80a9a9.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn select_80a9a9() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var arg_2 = vec3(); + var res : vec3 = select(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + select_80a9a9(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + select_80a9a9(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + select_80a9a9(); +} diff --git a/test/tint/builtins/gen/var/select/8fa62c.wgsl b/test/tint/builtins/gen/var/select/8fa62c.wgsl new file mode 100644 index 0000000000..c222014b6f --- /dev/null +++ b/test/tint/builtins/gen/var/select/8fa62c.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<3, i32>, vec<3, i32>, bool) -> vec<3, i32> +fn select_8fa62c() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var arg_2 = bool(); + var res: vec3 = select(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + select_8fa62c(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + select_8fa62c(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + select_8fa62c(); +} diff --git a/test/tint/builtins/gen/var/select/8fa62c.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/8fa62c.wgsl.expected.glsl new file mode 100644 index 0000000000..fd4e04ddd9 --- /dev/null +++ b/test/tint/builtins/gen/var/select/8fa62c.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void select_8fa62c() { + ivec3 arg_0 = ivec3(0); + ivec3 arg_1 = ivec3(0); + bool arg_2 = false; + ivec3 res = (arg_2 ? arg_1 : arg_0); +} + +vec4 vertex_main() { + select_8fa62c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_8fa62c() { + ivec3 arg_0 = ivec3(0); + ivec3 arg_1 = ivec3(0); + bool arg_2 = false; + ivec3 res = (arg_2 ? arg_1 : arg_0); +} + +void fragment_main() { + select_8fa62c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_8fa62c() { + ivec3 arg_0 = ivec3(0); + ivec3 arg_1 = ivec3(0); + bool arg_2 = false; + ivec3 res = (arg_2 ? arg_1 : arg_0); +} + +void compute_main() { + select_8fa62c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/select/8fa62c.wgsl.expected.hlsl b/test/tint/builtins/gen/var/select/8fa62c.wgsl.expected.hlsl new file mode 100644 index 0000000000..2ea69af14b --- /dev/null +++ b/test/tint/builtins/gen/var/select/8fa62c.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +void select_8fa62c() { + int3 arg_0 = (0).xxx; + int3 arg_1 = (0).xxx; + bool arg_2 = false; + int3 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_8fa62c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_8fa62c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_8fa62c(); + return; +} diff --git a/test/tint/builtins/gen/var/select/8fa62c.wgsl.expected.msl b/test/tint/builtins/gen/var/select/8fa62c.wgsl.expected.msl new file mode 100644 index 0000000000..4cd6e75b2a --- /dev/null +++ b/test/tint/builtins/gen/var/select/8fa62c.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void select_8fa62c() { + int3 arg_0 = int3(0); + int3 arg_1 = int3(0); + bool arg_2 = false; + int3 res = select(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_8fa62c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_8fa62c(); + return; +} + +kernel void compute_main() { + select_8fa62c(); + return; +} + diff --git a/test/tint/builtins/gen/var/select/8fa62c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/8fa62c.wgsl.expected.spvasm new file mode 100644 index 0000000000..e3a3e5022a --- /dev/null +++ b/test/tint/builtins/gen/var/select/8fa62c.wgsl.expected.spvasm @@ -0,0 +1,87 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_8fa62c "select_8fa62c" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %15 = OpConstantNull %v3int +%_ptr_Function_v3int = OpTypePointer Function %v3int + %bool = OpTypeBool + %20 = OpConstantNull %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %v3bool = OpTypeVector %bool 3 +%_ptr_Function_v3bool = OpTypePointer Function %v3bool + %30 = OpConstantNull %v3bool + %33 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_8fa62c = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3int Function %15 + %arg_1 = OpVariable %_ptr_Function_v3int Function %15 + %arg_2 = OpVariable %_ptr_Function_bool Function %20 + %28 = OpVariable %_ptr_Function_v3bool Function %30 + %res = OpVariable %_ptr_Function_v3int Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %20 + %24 = OpLoad %bool %arg_2 + %25 = OpLoad %v3int %arg_1 + %26 = OpLoad %v3int %arg_0 + %31 = OpCompositeConstruct %v3bool %24 %24 %24 + %23 = OpSelect %v3int %31 %25 %26 + OpStore %res %23 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %33 + %35 = OpLabel + %36 = OpFunctionCall %void %select_8fa62c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %39 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %42 = OpLabel + %43 = OpFunctionCall %void %select_8fa62c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %45 = OpLabel + %46 = OpFunctionCall %void %select_8fa62c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/select/8fa62c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/8fa62c.wgsl.expected.wgsl new file mode 100644 index 0000000000..3cd2a56ded --- /dev/null +++ b/test/tint/builtins/gen/var/select/8fa62c.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn select_8fa62c() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var arg_2 = bool(); + var res : vec3 = select(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + select_8fa62c(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + select_8fa62c(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + select_8fa62c(); +} diff --git a/test/tint/builtins/gen/var/select/99f883.wgsl b/test/tint/builtins/gen/var/select/99f883.wgsl new file mode 100644 index 0000000000..8b8549d650 --- /dev/null +++ b/test/tint/builtins/gen/var/select/99f883.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(u32, u32, bool) -> u32 +fn select_99f883() { + var arg_0 = 1u; + var arg_1 = 1u; + var arg_2 = bool(); + var res: u32 = select(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + select_99f883(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + select_99f883(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + select_99f883(); +} diff --git a/test/tint/builtins/gen/var/select/99f883.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/99f883.wgsl.expected.glsl new file mode 100644 index 0000000000..6075d9271d --- /dev/null +++ b/test/tint/builtins/gen/var/select/99f883.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void select_99f883() { + uint arg_0 = 1u; + uint arg_1 = 1u; + bool arg_2 = false; + uint res = (arg_2 ? arg_1 : arg_0); +} + +vec4 vertex_main() { + select_99f883(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_99f883() { + uint arg_0 = 1u; + uint arg_1 = 1u; + bool arg_2 = false; + uint res = (arg_2 ? arg_1 : arg_0); +} + +void fragment_main() { + select_99f883(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_99f883() { + uint arg_0 = 1u; + uint arg_1 = 1u; + bool arg_2 = false; + uint res = (arg_2 ? arg_1 : arg_0); +} + +void compute_main() { + select_99f883(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/select/99f883.wgsl.expected.hlsl b/test/tint/builtins/gen/var/select/99f883.wgsl.expected.hlsl new file mode 100644 index 0000000000..c6f25eb063 --- /dev/null +++ b/test/tint/builtins/gen/var/select/99f883.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +void select_99f883() { + uint arg_0 = 1u; + uint arg_1 = 1u; + bool arg_2 = false; + uint res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_99f883(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_99f883(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_99f883(); + return; +} diff --git a/test/tint/builtins/gen/var/select/99f883.wgsl.expected.msl b/test/tint/builtins/gen/var/select/99f883.wgsl.expected.msl new file mode 100644 index 0000000000..7e9341aff6 --- /dev/null +++ b/test/tint/builtins/gen/var/select/99f883.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void select_99f883() { + uint arg_0 = 1u; + uint arg_1 = 1u; + bool arg_2 = false; + uint res = select(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_99f883(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_99f883(); + return; +} + +kernel void compute_main() { + select_99f883(); + return; +} + diff --git a/test/tint/builtins/gen/var/select/99f883.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/99f883.wgsl.expected.spvasm new file mode 100644 index 0000000000..1de620b015 --- /dev/null +++ b/test/tint/builtins/gen/var/select/99f883.wgsl.expected.spvasm @@ -0,0 +1,82 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 42 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_99f883 "select_99f883" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %17 = OpConstantNull %uint + %bool = OpTypeBool + %20 = OpConstantNull %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %28 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_99f883 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_uint Function %17 + %arg_1 = OpVariable %_ptr_Function_uint Function %17 + %arg_2 = OpVariable %_ptr_Function_bool Function %20 + %res = OpVariable %_ptr_Function_uint Function %17 + OpStore %arg_0 %uint_1 + OpStore %arg_1 %uint_1 + OpStore %arg_2 %20 + %24 = OpLoad %bool %arg_2 + %25 = OpLoad %uint %arg_1 + %26 = OpLoad %uint %arg_0 + %23 = OpSelect %uint %24 %25 %26 + OpStore %res %23 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %28 + %30 = OpLabel + %31 = OpFunctionCall %void %select_99f883 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %34 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %select_99f883 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %40 = OpLabel + %41 = OpFunctionCall %void %select_99f883 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/select/99f883.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/99f883.wgsl.expected.wgsl new file mode 100644 index 0000000000..c92d6c3243 --- /dev/null +++ b/test/tint/builtins/gen/var/select/99f883.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn select_99f883() { + var arg_0 = 1u; + var arg_1 = 1u; + var arg_2 = bool(); + var res : u32 = select(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + select_99f883(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + select_99f883(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + select_99f883(); +} diff --git a/test/tint/builtins/gen/var/select/a2860e.wgsl b/test/tint/builtins/gen/var/select/a2860e.wgsl new file mode 100644 index 0000000000..18b2545c62 --- /dev/null +++ b/test/tint/builtins/gen/var/select/a2860e.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<4, i32>, vec<4, i32>, vec<4, bool>) -> vec<4, i32> +fn select_a2860e() { + var arg_0 = vec4(); + var arg_1 = vec4(); + var arg_2 = vec4(); + var res: vec4 = select(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + select_a2860e(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + select_a2860e(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + select_a2860e(); +} diff --git a/test/tint/builtins/gen/var/select/a2860e.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/a2860e.wgsl.expected.glsl new file mode 100644 index 0000000000..791a44ff3d --- /dev/null +++ b/test/tint/builtins/gen/var/select/a2860e.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void select_a2860e() { + ivec4 arg_0 = ivec4(0); + ivec4 arg_1 = ivec4(0); + bvec4 arg_2 = bvec4(false); + ivec4 res = mix(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + select_a2860e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_a2860e() { + ivec4 arg_0 = ivec4(0); + ivec4 arg_1 = ivec4(0); + bvec4 arg_2 = bvec4(false); + ivec4 res = mix(arg_0, arg_1, arg_2); +} + +void fragment_main() { + select_a2860e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_a2860e() { + ivec4 arg_0 = ivec4(0); + ivec4 arg_1 = ivec4(0); + bvec4 arg_2 = bvec4(false); + ivec4 res = mix(arg_0, arg_1, arg_2); +} + +void compute_main() { + select_a2860e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/select/a2860e.wgsl.expected.hlsl b/test/tint/builtins/gen/var/select/a2860e.wgsl.expected.hlsl new file mode 100644 index 0000000000..bc3e47e6a2 --- /dev/null +++ b/test/tint/builtins/gen/var/select/a2860e.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +void select_a2860e() { + int4 arg_0 = (0).xxxx; + int4 arg_1 = (0).xxxx; + bool4 arg_2 = (false).xxxx; + int4 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_a2860e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_a2860e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_a2860e(); + return; +} diff --git a/test/tint/builtins/gen/var/select/a2860e.wgsl.expected.msl b/test/tint/builtins/gen/var/select/a2860e.wgsl.expected.msl new file mode 100644 index 0000000000..bbc42665d6 --- /dev/null +++ b/test/tint/builtins/gen/var/select/a2860e.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void select_a2860e() { + int4 arg_0 = int4(0); + int4 arg_1 = int4(0); + bool4 arg_2 = bool4(false); + int4 res = select(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_a2860e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_a2860e(); + return; +} + +kernel void compute_main() { + select_a2860e(); + return; +} + diff --git a/test/tint/builtins/gen/var/select/a2860e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/a2860e.wgsl.expected.spvasm new file mode 100644 index 0000000000..30c8e3f857 --- /dev/null +++ b/test/tint/builtins/gen/var/select/a2860e.wgsl.expected.spvasm @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_a2860e "select_a2860e" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %15 = OpConstantNull %v4int +%_ptr_Function_v4int = OpTypePointer Function %v4int + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %21 = OpConstantNull %v4bool +%_ptr_Function_v4bool = OpTypePointer Function %v4bool + %29 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_a2860e = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4int Function %15 + %arg_1 = OpVariable %_ptr_Function_v4int Function %15 + %arg_2 = OpVariable %_ptr_Function_v4bool Function %21 + %res = OpVariable %_ptr_Function_v4int Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %21 + %25 = OpLoad %v4bool %arg_2 + %26 = OpLoad %v4int %arg_1 + %27 = OpLoad %v4int %arg_0 + %24 = OpSelect %v4int %25 %26 %27 + OpStore %res %24 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %29 + %31 = OpLabel + %32 = OpFunctionCall %void %select_a2860e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %35 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %select_a2860e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %41 = OpLabel + %42 = OpFunctionCall %void %select_a2860e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/select/a2860e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/a2860e.wgsl.expected.wgsl new file mode 100644 index 0000000000..c665d80ac9 --- /dev/null +++ b/test/tint/builtins/gen/var/select/a2860e.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn select_a2860e() { + var arg_0 = vec4(); + var arg_1 = vec4(); + var arg_2 = vec4(); + var res : vec4 = select(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + select_a2860e(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + select_a2860e(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + select_a2860e(); +} diff --git a/test/tint/builtins/gen/var/select/ab069f.wgsl b/test/tint/builtins/gen/var/select/ab069f.wgsl new file mode 100644 index 0000000000..0defb643df --- /dev/null +++ b/test/tint/builtins/gen/var/select/ab069f.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<4, i32>, vec<4, i32>, bool) -> vec<4, i32> +fn select_ab069f() { + var arg_0 = vec4(); + var arg_1 = vec4(); + var arg_2 = bool(); + var res: vec4 = select(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + select_ab069f(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + select_ab069f(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + select_ab069f(); +} diff --git a/test/tint/builtins/gen/var/select/ab069f.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/ab069f.wgsl.expected.glsl new file mode 100644 index 0000000000..837dc43dde --- /dev/null +++ b/test/tint/builtins/gen/var/select/ab069f.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void select_ab069f() { + ivec4 arg_0 = ivec4(0); + ivec4 arg_1 = ivec4(0); + bool arg_2 = false; + ivec4 res = (arg_2 ? arg_1 : arg_0); +} + +vec4 vertex_main() { + select_ab069f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_ab069f() { + ivec4 arg_0 = ivec4(0); + ivec4 arg_1 = ivec4(0); + bool arg_2 = false; + ivec4 res = (arg_2 ? arg_1 : arg_0); +} + +void fragment_main() { + select_ab069f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_ab069f() { + ivec4 arg_0 = ivec4(0); + ivec4 arg_1 = ivec4(0); + bool arg_2 = false; + ivec4 res = (arg_2 ? arg_1 : arg_0); +} + +void compute_main() { + select_ab069f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/select/ab069f.wgsl.expected.hlsl b/test/tint/builtins/gen/var/select/ab069f.wgsl.expected.hlsl new file mode 100644 index 0000000000..0fb1845622 --- /dev/null +++ b/test/tint/builtins/gen/var/select/ab069f.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +void select_ab069f() { + int4 arg_0 = (0).xxxx; + int4 arg_1 = (0).xxxx; + bool arg_2 = false; + int4 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_ab069f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_ab069f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_ab069f(); + return; +} diff --git a/test/tint/builtins/gen/var/select/ab069f.wgsl.expected.msl b/test/tint/builtins/gen/var/select/ab069f.wgsl.expected.msl new file mode 100644 index 0000000000..415cb8ada9 --- /dev/null +++ b/test/tint/builtins/gen/var/select/ab069f.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void select_ab069f() { + int4 arg_0 = int4(0); + int4 arg_1 = int4(0); + bool arg_2 = false; + int4 res = select(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_ab069f(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_ab069f(); + return; +} + +kernel void compute_main() { + select_ab069f(); + return; +} + diff --git a/test/tint/builtins/gen/var/select/ab069f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/ab069f.wgsl.expected.spvasm new file mode 100644 index 0000000000..738b78877b --- /dev/null +++ b/test/tint/builtins/gen/var/select/ab069f.wgsl.expected.spvasm @@ -0,0 +1,87 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_ab069f "select_ab069f" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %15 = OpConstantNull %v4int +%_ptr_Function_v4int = OpTypePointer Function %v4int + %bool = OpTypeBool + %20 = OpConstantNull %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %v4bool = OpTypeVector %bool 4 +%_ptr_Function_v4bool = OpTypePointer Function %v4bool + %30 = OpConstantNull %v4bool + %33 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_ab069f = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4int Function %15 + %arg_1 = OpVariable %_ptr_Function_v4int Function %15 + %arg_2 = OpVariable %_ptr_Function_bool Function %20 + %28 = OpVariable %_ptr_Function_v4bool Function %30 + %res = OpVariable %_ptr_Function_v4int Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %20 + %24 = OpLoad %bool %arg_2 + %25 = OpLoad %v4int %arg_1 + %26 = OpLoad %v4int %arg_0 + %31 = OpCompositeConstruct %v4bool %24 %24 %24 %24 + %23 = OpSelect %v4int %31 %25 %26 + OpStore %res %23 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %33 + %35 = OpLabel + %36 = OpFunctionCall %void %select_ab069f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %39 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %42 = OpLabel + %43 = OpFunctionCall %void %select_ab069f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %45 = OpLabel + %46 = OpFunctionCall %void %select_ab069f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/select/ab069f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/ab069f.wgsl.expected.wgsl new file mode 100644 index 0000000000..c3c395f88c --- /dev/null +++ b/test/tint/builtins/gen/var/select/ab069f.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn select_ab069f() { + var arg_0 = vec4(); + var arg_1 = vec4(); + var arg_2 = bool(); + var res : vec4 = select(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + select_ab069f(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + select_ab069f(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + select_ab069f(); +} diff --git a/test/tint/builtins/gen/var/select/b04721.wgsl b/test/tint/builtins/gen/var/select/b04721.wgsl new file mode 100644 index 0000000000..21b2378ac6 --- /dev/null +++ b/test/tint/builtins/gen/var/select/b04721.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<3, u32>, vec<3, u32>, bool) -> vec<3, u32> +fn select_b04721() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var arg_2 = bool(); + var res: vec3 = select(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + select_b04721(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + select_b04721(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + select_b04721(); +} diff --git a/test/tint/builtins/gen/var/select/b04721.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/b04721.wgsl.expected.glsl new file mode 100644 index 0000000000..526024da26 --- /dev/null +++ b/test/tint/builtins/gen/var/select/b04721.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void select_b04721() { + uvec3 arg_0 = uvec3(0u); + uvec3 arg_1 = uvec3(0u); + bool arg_2 = false; + uvec3 res = (arg_2 ? arg_1 : arg_0); +} + +vec4 vertex_main() { + select_b04721(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_b04721() { + uvec3 arg_0 = uvec3(0u); + uvec3 arg_1 = uvec3(0u); + bool arg_2 = false; + uvec3 res = (arg_2 ? arg_1 : arg_0); +} + +void fragment_main() { + select_b04721(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_b04721() { + uvec3 arg_0 = uvec3(0u); + uvec3 arg_1 = uvec3(0u); + bool arg_2 = false; + uvec3 res = (arg_2 ? arg_1 : arg_0); +} + +void compute_main() { + select_b04721(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/select/b04721.wgsl.expected.hlsl b/test/tint/builtins/gen/var/select/b04721.wgsl.expected.hlsl new file mode 100644 index 0000000000..c96cebe0db --- /dev/null +++ b/test/tint/builtins/gen/var/select/b04721.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +void select_b04721() { + uint3 arg_0 = (0u).xxx; + uint3 arg_1 = (0u).xxx; + bool arg_2 = false; + uint3 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_b04721(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_b04721(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_b04721(); + return; +} diff --git a/test/tint/builtins/gen/var/select/b04721.wgsl.expected.msl b/test/tint/builtins/gen/var/select/b04721.wgsl.expected.msl new file mode 100644 index 0000000000..594d892fd1 --- /dev/null +++ b/test/tint/builtins/gen/var/select/b04721.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void select_b04721() { + uint3 arg_0 = uint3(0u); + uint3 arg_1 = uint3(0u); + bool arg_2 = false; + uint3 res = select(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_b04721(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_b04721(); + return; +} + +kernel void compute_main() { + select_b04721(); + return; +} + diff --git a/test/tint/builtins/gen/var/select/b04721.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/b04721.wgsl.expected.spvasm new file mode 100644 index 0000000000..e22cbc3d55 --- /dev/null +++ b/test/tint/builtins/gen/var/select/b04721.wgsl.expected.spvasm @@ -0,0 +1,87 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_b04721 "select_b04721" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %15 = OpConstantNull %v3uint +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %bool = OpTypeBool + %20 = OpConstantNull %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %v3bool = OpTypeVector %bool 3 +%_ptr_Function_v3bool = OpTypePointer Function %v3bool + %30 = OpConstantNull %v3bool + %33 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_b04721 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3uint Function %15 + %arg_1 = OpVariable %_ptr_Function_v3uint Function %15 + %arg_2 = OpVariable %_ptr_Function_bool Function %20 + %28 = OpVariable %_ptr_Function_v3bool Function %30 + %res = OpVariable %_ptr_Function_v3uint Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %20 + %24 = OpLoad %bool %arg_2 + %25 = OpLoad %v3uint %arg_1 + %26 = OpLoad %v3uint %arg_0 + %31 = OpCompositeConstruct %v3bool %24 %24 %24 + %23 = OpSelect %v3uint %31 %25 %26 + OpStore %res %23 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %33 + %35 = OpLabel + %36 = OpFunctionCall %void %select_b04721 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %39 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %42 = OpLabel + %43 = OpFunctionCall %void %select_b04721 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %45 = OpLabel + %46 = OpFunctionCall %void %select_b04721 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/select/b04721.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/b04721.wgsl.expected.wgsl new file mode 100644 index 0000000000..5f57eca150 --- /dev/null +++ b/test/tint/builtins/gen/var/select/b04721.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn select_b04721() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var arg_2 = bool(); + var res : vec3 = select(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + select_b04721(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + select_b04721(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + select_b04721(); +} diff --git a/test/tint/builtins/gen/var/select/bb447f.wgsl b/test/tint/builtins/gen/var/select/bb447f.wgsl new file mode 100644 index 0000000000..0a966ab114 --- /dev/null +++ b/test/tint/builtins/gen/var/select/bb447f.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<2, i32>, vec<2, i32>, bool) -> vec<2, i32> +fn select_bb447f() { + var arg_0 = vec2(); + var arg_1 = vec2(); + var arg_2 = bool(); + var res: vec2 = select(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + select_bb447f(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + select_bb447f(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + select_bb447f(); +} diff --git a/test/tint/builtins/gen/var/select/bb447f.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/bb447f.wgsl.expected.glsl new file mode 100644 index 0000000000..481243d88c --- /dev/null +++ b/test/tint/builtins/gen/var/select/bb447f.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void select_bb447f() { + ivec2 arg_0 = ivec2(0); + ivec2 arg_1 = ivec2(0); + bool arg_2 = false; + ivec2 res = (arg_2 ? arg_1 : arg_0); +} + +vec4 vertex_main() { + select_bb447f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_bb447f() { + ivec2 arg_0 = ivec2(0); + ivec2 arg_1 = ivec2(0); + bool arg_2 = false; + ivec2 res = (arg_2 ? arg_1 : arg_0); +} + +void fragment_main() { + select_bb447f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_bb447f() { + ivec2 arg_0 = ivec2(0); + ivec2 arg_1 = ivec2(0); + bool arg_2 = false; + ivec2 res = (arg_2 ? arg_1 : arg_0); +} + +void compute_main() { + select_bb447f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/select/bb447f.wgsl.expected.hlsl b/test/tint/builtins/gen/var/select/bb447f.wgsl.expected.hlsl new file mode 100644 index 0000000000..d4428816a5 --- /dev/null +++ b/test/tint/builtins/gen/var/select/bb447f.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +void select_bb447f() { + int2 arg_0 = (0).xx; + int2 arg_1 = (0).xx; + bool arg_2 = false; + int2 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_bb447f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_bb447f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_bb447f(); + return; +} diff --git a/test/tint/builtins/gen/var/select/bb447f.wgsl.expected.msl b/test/tint/builtins/gen/var/select/bb447f.wgsl.expected.msl new file mode 100644 index 0000000000..69d0161e88 --- /dev/null +++ b/test/tint/builtins/gen/var/select/bb447f.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void select_bb447f() { + int2 arg_0 = int2(0); + int2 arg_1 = int2(0); + bool arg_2 = false; + int2 res = select(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_bb447f(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_bb447f(); + return; +} + +kernel void compute_main() { + select_bb447f(); + return; +} + diff --git a/test/tint/builtins/gen/var/select/bb447f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/bb447f.wgsl.expected.spvasm new file mode 100644 index 0000000000..bf6642a0b4 --- /dev/null +++ b/test/tint/builtins/gen/var/select/bb447f.wgsl.expected.spvasm @@ -0,0 +1,87 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_bb447f "select_bb447f" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %15 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %bool = OpTypeBool + %20 = OpConstantNull %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %v2bool = OpTypeVector %bool 2 +%_ptr_Function_v2bool = OpTypePointer Function %v2bool + %30 = OpConstantNull %v2bool + %33 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_bb447f = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2int Function %15 + %arg_1 = OpVariable %_ptr_Function_v2int Function %15 + %arg_2 = OpVariable %_ptr_Function_bool Function %20 + %28 = OpVariable %_ptr_Function_v2bool Function %30 + %res = OpVariable %_ptr_Function_v2int Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %20 + %24 = OpLoad %bool %arg_2 + %25 = OpLoad %v2int %arg_1 + %26 = OpLoad %v2int %arg_0 + %31 = OpCompositeConstruct %v2bool %24 %24 + %23 = OpSelect %v2int %31 %25 %26 + OpStore %res %23 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %33 + %35 = OpLabel + %36 = OpFunctionCall %void %select_bb447f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %39 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %42 = OpLabel + %43 = OpFunctionCall %void %select_bb447f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %45 = OpLabel + %46 = OpFunctionCall %void %select_bb447f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/select/bb447f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/bb447f.wgsl.expected.wgsl new file mode 100644 index 0000000000..78571c14b8 --- /dev/null +++ b/test/tint/builtins/gen/var/select/bb447f.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn select_bb447f() { + var arg_0 = vec2(); + var arg_1 = vec2(); + var arg_2 = bool(); + var res : vec2 = select(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + select_bb447f(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + select_bb447f(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + select_bb447f(); +} diff --git a/test/tint/builtins/gen/var/select/bb8aae.wgsl b/test/tint/builtins/gen/var/select/bb8aae.wgsl new file mode 100644 index 0000000000..ca9c182e5f --- /dev/null +++ b/test/tint/builtins/gen/var/select/bb8aae.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<4, f32>, vec<4, f32>, vec<4, bool>) -> vec<4, f32> +fn select_bb8aae() { + var arg_0 = vec4(); + var arg_1 = vec4(); + var arg_2 = vec4(); + var res: vec4 = select(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + select_bb8aae(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + select_bb8aae(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + select_bb8aae(); +} diff --git a/test/tint/builtins/gen/var/select/bb8aae.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/bb8aae.wgsl.expected.glsl new file mode 100644 index 0000000000..0db67503f5 --- /dev/null +++ b/test/tint/builtins/gen/var/select/bb8aae.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void select_bb8aae() { + vec4 arg_0 = vec4(0.0f); + vec4 arg_1 = vec4(0.0f); + bvec4 arg_2 = bvec4(false); + vec4 res = mix(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + select_bb8aae(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_bb8aae() { + vec4 arg_0 = vec4(0.0f); + vec4 arg_1 = vec4(0.0f); + bvec4 arg_2 = bvec4(false); + vec4 res = mix(arg_0, arg_1, arg_2); +} + +void fragment_main() { + select_bb8aae(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_bb8aae() { + vec4 arg_0 = vec4(0.0f); + vec4 arg_1 = vec4(0.0f); + bvec4 arg_2 = bvec4(false); + vec4 res = mix(arg_0, arg_1, arg_2); +} + +void compute_main() { + select_bb8aae(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/select/bb8aae.wgsl.expected.hlsl b/test/tint/builtins/gen/var/select/bb8aae.wgsl.expected.hlsl new file mode 100644 index 0000000000..fd3ff6110e --- /dev/null +++ b/test/tint/builtins/gen/var/select/bb8aae.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +void select_bb8aae() { + float4 arg_0 = (0.0f).xxxx; + float4 arg_1 = (0.0f).xxxx; + bool4 arg_2 = (false).xxxx; + float4 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_bb8aae(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_bb8aae(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_bb8aae(); + return; +} diff --git a/test/tint/builtins/gen/var/select/bb8aae.wgsl.expected.msl b/test/tint/builtins/gen/var/select/bb8aae.wgsl.expected.msl new file mode 100644 index 0000000000..c12dc411c3 --- /dev/null +++ b/test/tint/builtins/gen/var/select/bb8aae.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void select_bb8aae() { + float4 arg_0 = float4(0.0f); + float4 arg_1 = float4(0.0f); + bool4 arg_2 = bool4(false); + float4 res = select(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_bb8aae(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_bb8aae(); + return; +} + +kernel void compute_main() { + select_bb8aae(); + return; +} + diff --git a/test/tint/builtins/gen/var/select/bb8aae.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/bb8aae.wgsl.expected.spvasm new file mode 100644 index 0000000000..4edc18fd00 --- /dev/null +++ b/test/tint/builtins/gen/var/select/bb8aae.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_bb8aae "select_bb8aae" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %18 = OpConstantNull %v4bool +%_ptr_Function_v4bool = OpTypePointer Function %v4bool + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_bb8aae = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %arg_1 = OpVariable %_ptr_Function_v4float Function %5 + %arg_2 = OpVariable %_ptr_Function_v4bool Function %18 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %5 + OpStore %arg_1 %5 + OpStore %arg_2 %18 + %22 = OpLoad %v4bool %arg_2 + %23 = OpLoad %v4float %arg_1 + %24 = OpLoad %v4float %arg_0 + %21 = OpSelect %v4float %22 %23 %24 + OpStore %res %21 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %select_bb8aae + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %select_bb8aae + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %select_bb8aae + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/select/bb8aae.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/bb8aae.wgsl.expected.wgsl new file mode 100644 index 0000000000..0ee6a28db6 --- /dev/null +++ b/test/tint/builtins/gen/var/select/bb8aae.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn select_bb8aae() { + var arg_0 = vec4(); + var arg_1 = vec4(); + var arg_2 = vec4(); + var res : vec4 = select(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + select_bb8aae(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + select_bb8aae(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + select_bb8aae(); +} diff --git a/test/tint/builtins/gen/var/select/bf3d29.wgsl b/test/tint/builtins/gen/var/select/bf3d29.wgsl new file mode 100644 index 0000000000..d778c46a45 --- /dev/null +++ b/test/tint/builtins/gen/var/select/bf3d29.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<2, f32>, vec<2, f32>, bool) -> vec<2, f32> +fn select_bf3d29() { + var arg_0 = vec2(); + var arg_1 = vec2(); + var arg_2 = bool(); + var res: vec2 = select(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + select_bf3d29(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + select_bf3d29(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + select_bf3d29(); +} diff --git a/test/tint/builtins/gen/var/select/bf3d29.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/bf3d29.wgsl.expected.glsl new file mode 100644 index 0000000000..e2e29fac41 --- /dev/null +++ b/test/tint/builtins/gen/var/select/bf3d29.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void select_bf3d29() { + vec2 arg_0 = vec2(0.0f); + vec2 arg_1 = vec2(0.0f); + bool arg_2 = false; + vec2 res = (arg_2 ? arg_1 : arg_0); +} + +vec4 vertex_main() { + select_bf3d29(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_bf3d29() { + vec2 arg_0 = vec2(0.0f); + vec2 arg_1 = vec2(0.0f); + bool arg_2 = false; + vec2 res = (arg_2 ? arg_1 : arg_0); +} + +void fragment_main() { + select_bf3d29(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_bf3d29() { + vec2 arg_0 = vec2(0.0f); + vec2 arg_1 = vec2(0.0f); + bool arg_2 = false; + vec2 res = (arg_2 ? arg_1 : arg_0); +} + +void compute_main() { + select_bf3d29(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/select/bf3d29.wgsl.expected.hlsl b/test/tint/builtins/gen/var/select/bf3d29.wgsl.expected.hlsl new file mode 100644 index 0000000000..a4862745eb --- /dev/null +++ b/test/tint/builtins/gen/var/select/bf3d29.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +void select_bf3d29() { + float2 arg_0 = (0.0f).xx; + float2 arg_1 = (0.0f).xx; + bool arg_2 = false; + float2 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_bf3d29(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_bf3d29(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_bf3d29(); + return; +} diff --git a/test/tint/builtins/gen/var/select/bf3d29.wgsl.expected.msl b/test/tint/builtins/gen/var/select/bf3d29.wgsl.expected.msl new file mode 100644 index 0000000000..4e8700682a --- /dev/null +++ b/test/tint/builtins/gen/var/select/bf3d29.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void select_bf3d29() { + float2 arg_0 = float2(0.0f); + float2 arg_1 = float2(0.0f); + bool arg_2 = false; + float2 res = select(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_bf3d29(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_bf3d29(); + return; +} + +kernel void compute_main() { + select_bf3d29(); + return; +} + diff --git a/test/tint/builtins/gen/var/select/bf3d29.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/bf3d29.wgsl.expected.spvasm new file mode 100644 index 0000000000..3b9f6ecc15 --- /dev/null +++ b/test/tint/builtins/gen/var/select/bf3d29.wgsl.expected.spvasm @@ -0,0 +1,86 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 46 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_bf3d29 "select_bf3d29" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %14 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %bool = OpTypeBool + %19 = OpConstantNull %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %v2bool = OpTypeVector %bool 2 +%_ptr_Function_v2bool = OpTypePointer Function %v2bool + %29 = OpConstantNull %v2bool + %32 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_bf3d29 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %14 + %arg_1 = OpVariable %_ptr_Function_v2float Function %14 + %arg_2 = OpVariable %_ptr_Function_bool Function %19 + %27 = OpVariable %_ptr_Function_v2bool Function %29 + %res = OpVariable %_ptr_Function_v2float Function %14 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + OpStore %arg_2 %19 + %23 = OpLoad %bool %arg_2 + %24 = OpLoad %v2float %arg_1 + %25 = OpLoad %v2float %arg_0 + %30 = OpCompositeConstruct %v2bool %23 %23 + %22 = OpSelect %v2float %30 %24 %25 + OpStore %res %22 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %32 + %34 = OpLabel + %35 = OpFunctionCall %void %select_bf3d29 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %38 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %41 = OpLabel + %42 = OpFunctionCall %void %select_bf3d29 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %44 = OpLabel + %45 = OpFunctionCall %void %select_bf3d29 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/select/bf3d29.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/bf3d29.wgsl.expected.wgsl new file mode 100644 index 0000000000..e058445484 --- /dev/null +++ b/test/tint/builtins/gen/var/select/bf3d29.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn select_bf3d29() { + var arg_0 = vec2(); + var arg_1 = vec2(); + var arg_2 = bool(); + var res : vec2 = select(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + select_bf3d29(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + select_bf3d29(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + select_bf3d29(); +} diff --git a/test/tint/builtins/gen/var/select/c31f9e.wgsl b/test/tint/builtins/gen/var/select/c31f9e.wgsl new file mode 100644 index 0000000000..555869bbcc --- /dev/null +++ b/test/tint/builtins/gen/var/select/c31f9e.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(bool, bool, bool) -> bool +fn select_c31f9e() { + var arg_0 = bool(); + var arg_1 = bool(); + var arg_2 = bool(); + var res: bool = select(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + select_c31f9e(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + select_c31f9e(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + select_c31f9e(); +} diff --git a/test/tint/builtins/gen/var/select/c31f9e.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/c31f9e.wgsl.expected.glsl new file mode 100644 index 0000000000..27b14d890e --- /dev/null +++ b/test/tint/builtins/gen/var/select/c31f9e.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void select_c31f9e() { + bool arg_0 = false; + bool arg_1 = false; + bool arg_2 = false; + bool res = (arg_2 ? arg_1 : arg_0); +} + +vec4 vertex_main() { + select_c31f9e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_c31f9e() { + bool arg_0 = false; + bool arg_1 = false; + bool arg_2 = false; + bool res = (arg_2 ? arg_1 : arg_0); +} + +void fragment_main() { + select_c31f9e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_c31f9e() { + bool arg_0 = false; + bool arg_1 = false; + bool arg_2 = false; + bool res = (arg_2 ? arg_1 : arg_0); +} + +void compute_main() { + select_c31f9e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/select/c31f9e.wgsl.expected.hlsl b/test/tint/builtins/gen/var/select/c31f9e.wgsl.expected.hlsl new file mode 100644 index 0000000000..c47c75a787 --- /dev/null +++ b/test/tint/builtins/gen/var/select/c31f9e.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +void select_c31f9e() { + bool arg_0 = false; + bool arg_1 = false; + bool arg_2 = false; + bool res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_c31f9e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_c31f9e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_c31f9e(); + return; +} diff --git a/test/tint/builtins/gen/var/select/c31f9e.wgsl.expected.msl b/test/tint/builtins/gen/var/select/c31f9e.wgsl.expected.msl new file mode 100644 index 0000000000..8ff1e0bb3b --- /dev/null +++ b/test/tint/builtins/gen/var/select/c31f9e.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void select_c31f9e() { + bool arg_0 = false; + bool arg_1 = false; + bool arg_2 = false; + bool res = select(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_c31f9e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_c31f9e(); + return; +} + +kernel void compute_main() { + select_c31f9e(); + return; +} + diff --git a/test/tint/builtins/gen/var/select/c31f9e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/c31f9e.wgsl.expected.spvasm new file mode 100644 index 0000000000..6c8a03d9c0 --- /dev/null +++ b/test/tint/builtins/gen/var/select/c31f9e.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_c31f9e "select_c31f9e" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %bool = OpTypeBool + %14 = OpConstantNull %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_c31f9e = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_bool Function %14 + %arg_1 = OpVariable %_ptr_Function_bool Function %14 + %arg_2 = OpVariable %_ptr_Function_bool Function %14 + %res = OpVariable %_ptr_Function_bool Function %14 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + OpStore %arg_2 %14 + %20 = OpLoad %bool %arg_2 + %21 = OpLoad %bool %arg_1 + %22 = OpLoad %bool %arg_0 + %19 = OpSelect %bool %20 %21 %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %select_c31f9e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %select_c31f9e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %select_c31f9e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/select/c31f9e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/c31f9e.wgsl.expected.wgsl new file mode 100644 index 0000000000..1e577466e7 --- /dev/null +++ b/test/tint/builtins/gen/var/select/c31f9e.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn select_c31f9e() { + var arg_0 = bool(); + var arg_1 = bool(); + var arg_2 = bool(); + var res : bool = select(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + select_c31f9e(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + select_c31f9e(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + select_c31f9e(); +} diff --git a/test/tint/builtins/gen/var/select/c41bd1.wgsl b/test/tint/builtins/gen/var/select/c41bd1.wgsl new file mode 100644 index 0000000000..64817eb545 --- /dev/null +++ b/test/tint/builtins/gen/var/select/c41bd1.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<4, bool>, vec<4, bool>, bool) -> vec<4, bool> +fn select_c41bd1() { + var arg_0 = vec4(); + var arg_1 = vec4(); + var arg_2 = bool(); + var res: vec4 = select(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + select_c41bd1(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + select_c41bd1(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + select_c41bd1(); +} diff --git a/test/tint/builtins/gen/var/select/c41bd1.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/c41bd1.wgsl.expected.glsl new file mode 100644 index 0000000000..a24ce0615b --- /dev/null +++ b/test/tint/builtins/gen/var/select/c41bd1.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void select_c41bd1() { + bvec4 arg_0 = bvec4(false); + bvec4 arg_1 = bvec4(false); + bool arg_2 = false; + bvec4 res = (arg_2 ? arg_1 : arg_0); +} + +vec4 vertex_main() { + select_c41bd1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_c41bd1() { + bvec4 arg_0 = bvec4(false); + bvec4 arg_1 = bvec4(false); + bool arg_2 = false; + bvec4 res = (arg_2 ? arg_1 : arg_0); +} + +void fragment_main() { + select_c41bd1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_c41bd1() { + bvec4 arg_0 = bvec4(false); + bvec4 arg_1 = bvec4(false); + bool arg_2 = false; + bvec4 res = (arg_2 ? arg_1 : arg_0); +} + +void compute_main() { + select_c41bd1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/select/c41bd1.wgsl.expected.hlsl b/test/tint/builtins/gen/var/select/c41bd1.wgsl.expected.hlsl new file mode 100644 index 0000000000..09571cb4c4 --- /dev/null +++ b/test/tint/builtins/gen/var/select/c41bd1.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +void select_c41bd1() { + bool4 arg_0 = (false).xxxx; + bool4 arg_1 = (false).xxxx; + bool arg_2 = false; + bool4 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_c41bd1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_c41bd1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_c41bd1(); + return; +} diff --git a/test/tint/builtins/gen/var/select/c41bd1.wgsl.expected.msl b/test/tint/builtins/gen/var/select/c41bd1.wgsl.expected.msl new file mode 100644 index 0000000000..b2e7ba2250 --- /dev/null +++ b/test/tint/builtins/gen/var/select/c41bd1.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void select_c41bd1() { + bool4 arg_0 = bool4(false); + bool4 arg_1 = bool4(false); + bool arg_2 = false; + bool4 res = select(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_c41bd1(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_c41bd1(); + return; +} + +kernel void compute_main() { + select_c41bd1(); + return; +} + diff --git a/test/tint/builtins/gen/var/select/c41bd1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/c41bd1.wgsl.expected.spvasm new file mode 100644 index 0000000000..b1606411a5 --- /dev/null +++ b/test/tint/builtins/gen/var/select/c41bd1.wgsl.expected.spvasm @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_c41bd1 "select_c41bd1" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %15 = OpConstantNull %v4bool +%_ptr_Function_v4bool = OpTypePointer Function %v4bool + %19 = OpConstantNull %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %29 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_c41bd1 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4bool Function %15 + %arg_1 = OpVariable %_ptr_Function_v4bool Function %15 + %arg_2 = OpVariable %_ptr_Function_bool Function %19 + %26 = OpVariable %_ptr_Function_v4bool Function %15 + %res = OpVariable %_ptr_Function_v4bool Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %19 + %23 = OpLoad %bool %arg_2 + %24 = OpLoad %v4bool %arg_1 + %25 = OpLoad %v4bool %arg_0 + %27 = OpCompositeConstruct %v4bool %23 %23 %23 %23 + %22 = OpSelect %v4bool %27 %24 %25 + OpStore %res %22 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %29 + %31 = OpLabel + %32 = OpFunctionCall %void %select_c41bd1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %35 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %select_c41bd1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %41 = OpLabel + %42 = OpFunctionCall %void %select_c41bd1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/select/c41bd1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/c41bd1.wgsl.expected.wgsl new file mode 100644 index 0000000000..68857ad866 --- /dev/null +++ b/test/tint/builtins/gen/var/select/c41bd1.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn select_c41bd1() { + var arg_0 = vec4(); + var arg_1 = vec4(); + var arg_2 = bool(); + var res : vec4 = select(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + select_c41bd1(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + select_c41bd1(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + select_c41bd1(); +} diff --git a/test/tint/builtins/gen/var/select/c4a4ef.wgsl b/test/tint/builtins/gen/var/select/c4a4ef.wgsl new file mode 100644 index 0000000000..a81e6dfc1a --- /dev/null +++ b/test/tint/builtins/gen/var/select/c4a4ef.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<4, u32>, vec<4, u32>, vec<4, bool>) -> vec<4, u32> +fn select_c4a4ef() { + var arg_0 = vec4(); + var arg_1 = vec4(); + var arg_2 = vec4(); + var res: vec4 = select(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + select_c4a4ef(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + select_c4a4ef(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + select_c4a4ef(); +} diff --git a/test/tint/builtins/gen/var/select/c4a4ef.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/c4a4ef.wgsl.expected.glsl new file mode 100644 index 0000000000..d20e19f80a --- /dev/null +++ b/test/tint/builtins/gen/var/select/c4a4ef.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void select_c4a4ef() { + uvec4 arg_0 = uvec4(0u); + uvec4 arg_1 = uvec4(0u); + bvec4 arg_2 = bvec4(false); + uvec4 res = mix(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + select_c4a4ef(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_c4a4ef() { + uvec4 arg_0 = uvec4(0u); + uvec4 arg_1 = uvec4(0u); + bvec4 arg_2 = bvec4(false); + uvec4 res = mix(arg_0, arg_1, arg_2); +} + +void fragment_main() { + select_c4a4ef(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_c4a4ef() { + uvec4 arg_0 = uvec4(0u); + uvec4 arg_1 = uvec4(0u); + bvec4 arg_2 = bvec4(false); + uvec4 res = mix(arg_0, arg_1, arg_2); +} + +void compute_main() { + select_c4a4ef(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/select/c4a4ef.wgsl.expected.hlsl b/test/tint/builtins/gen/var/select/c4a4ef.wgsl.expected.hlsl new file mode 100644 index 0000000000..640511b0db --- /dev/null +++ b/test/tint/builtins/gen/var/select/c4a4ef.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +void select_c4a4ef() { + uint4 arg_0 = (0u).xxxx; + uint4 arg_1 = (0u).xxxx; + bool4 arg_2 = (false).xxxx; + uint4 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_c4a4ef(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_c4a4ef(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_c4a4ef(); + return; +} diff --git a/test/tint/builtins/gen/var/select/c4a4ef.wgsl.expected.msl b/test/tint/builtins/gen/var/select/c4a4ef.wgsl.expected.msl new file mode 100644 index 0000000000..0c1ae54b40 --- /dev/null +++ b/test/tint/builtins/gen/var/select/c4a4ef.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void select_c4a4ef() { + uint4 arg_0 = uint4(0u); + uint4 arg_1 = uint4(0u); + bool4 arg_2 = bool4(false); + uint4 res = select(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_c4a4ef(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_c4a4ef(); + return; +} + +kernel void compute_main() { + select_c4a4ef(); + return; +} + diff --git a/test/tint/builtins/gen/var/select/c4a4ef.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/c4a4ef.wgsl.expected.spvasm new file mode 100644 index 0000000000..43b65fb282 --- /dev/null +++ b/test/tint/builtins/gen/var/select/c4a4ef.wgsl.expected.spvasm @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_c4a4ef "select_c4a4ef" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + %15 = OpConstantNull %v4uint +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %21 = OpConstantNull %v4bool +%_ptr_Function_v4bool = OpTypePointer Function %v4bool + %29 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_c4a4ef = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4uint Function %15 + %arg_1 = OpVariable %_ptr_Function_v4uint Function %15 + %arg_2 = OpVariable %_ptr_Function_v4bool Function %21 + %res = OpVariable %_ptr_Function_v4uint Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %21 + %25 = OpLoad %v4bool %arg_2 + %26 = OpLoad %v4uint %arg_1 + %27 = OpLoad %v4uint %arg_0 + %24 = OpSelect %v4uint %25 %26 %27 + OpStore %res %24 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %29 + %31 = OpLabel + %32 = OpFunctionCall %void %select_c4a4ef + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %35 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %select_c4a4ef + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %41 = OpLabel + %42 = OpFunctionCall %void %select_c4a4ef + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/select/c4a4ef.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/c4a4ef.wgsl.expected.wgsl new file mode 100644 index 0000000000..843cfc4026 --- /dev/null +++ b/test/tint/builtins/gen/var/select/c4a4ef.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn select_c4a4ef() { + var arg_0 = vec4(); + var arg_1 = vec4(); + var arg_2 = vec4(); + var res : vec4 = select(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + select_c4a4ef(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + select_c4a4ef(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + select_c4a4ef(); +} diff --git a/test/tint/builtins/gen/var/select/cb9301.wgsl b/test/tint/builtins/gen/var/select/cb9301.wgsl new file mode 100644 index 0000000000..0adf8d72c6 --- /dev/null +++ b/test/tint/builtins/gen/var/select/cb9301.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<2, bool>, vec<2, bool>, vec<2, bool>) -> vec<2, bool> +fn select_cb9301() { + var arg_0 = vec2(); + var arg_1 = vec2(); + var arg_2 = vec2(); + var res: vec2 = select(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + select_cb9301(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + select_cb9301(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + select_cb9301(); +} diff --git a/test/tint/builtins/gen/var/select/cb9301.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/cb9301.wgsl.expected.glsl new file mode 100644 index 0000000000..83f3e7663b --- /dev/null +++ b/test/tint/builtins/gen/var/select/cb9301.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void select_cb9301() { + bvec2 arg_0 = bvec2(false); + bvec2 arg_1 = bvec2(false); + bvec2 arg_2 = bvec2(false); + bvec2 res = mix(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + select_cb9301(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_cb9301() { + bvec2 arg_0 = bvec2(false); + bvec2 arg_1 = bvec2(false); + bvec2 arg_2 = bvec2(false); + bvec2 res = mix(arg_0, arg_1, arg_2); +} + +void fragment_main() { + select_cb9301(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_cb9301() { + bvec2 arg_0 = bvec2(false); + bvec2 arg_1 = bvec2(false); + bvec2 arg_2 = bvec2(false); + bvec2 res = mix(arg_0, arg_1, arg_2); +} + +void compute_main() { + select_cb9301(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/select/cb9301.wgsl.expected.hlsl b/test/tint/builtins/gen/var/select/cb9301.wgsl.expected.hlsl new file mode 100644 index 0000000000..712794e7a1 --- /dev/null +++ b/test/tint/builtins/gen/var/select/cb9301.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +void select_cb9301() { + bool2 arg_0 = (false).xx; + bool2 arg_1 = (false).xx; + bool2 arg_2 = (false).xx; + bool2 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_cb9301(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_cb9301(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_cb9301(); + return; +} diff --git a/test/tint/builtins/gen/var/select/cb9301.wgsl.expected.msl b/test/tint/builtins/gen/var/select/cb9301.wgsl.expected.msl new file mode 100644 index 0000000000..f3fd18c507 --- /dev/null +++ b/test/tint/builtins/gen/var/select/cb9301.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void select_cb9301() { + bool2 arg_0 = bool2(false); + bool2 arg_1 = bool2(false); + bool2 arg_2 = bool2(false); + bool2 res = select(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_cb9301(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_cb9301(); + return; +} + +kernel void compute_main() { + select_cb9301(); + return; +} + diff --git a/test/tint/builtins/gen/var/select/cb9301.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/cb9301.wgsl.expected.spvasm new file mode 100644 index 0000000000..13598e7110 --- /dev/null +++ b/test/tint/builtins/gen/var/select/cb9301.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_cb9301 "select_cb9301" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %15 = OpConstantNull %v2bool +%_ptr_Function_v2bool = OpTypePointer Function %v2bool + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_cb9301 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2bool Function %15 + %arg_1 = OpVariable %_ptr_Function_v2bool Function %15 + %arg_2 = OpVariable %_ptr_Function_v2bool Function %15 + %res = OpVariable %_ptr_Function_v2bool Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %15 + %21 = OpLoad %v2bool %arg_2 + %22 = OpLoad %v2bool %arg_1 + %23 = OpLoad %v2bool %arg_0 + %20 = OpSelect %v2bool %21 %22 %23 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %select_cb9301 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %select_cb9301 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %select_cb9301 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/select/cb9301.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/cb9301.wgsl.expected.wgsl new file mode 100644 index 0000000000..aa7f2a3ad8 --- /dev/null +++ b/test/tint/builtins/gen/var/select/cb9301.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn select_cb9301() { + var arg_0 = vec2(); + var arg_1 = vec2(); + var arg_2 = vec2(); + var res : vec2 = select(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + select_cb9301(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + select_cb9301(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + select_cb9301(); +} diff --git a/test/tint/builtins/gen/var/select/e3e028.wgsl b/test/tint/builtins/gen/var/select/e3e028.wgsl new file mode 100644 index 0000000000..f0ed31ac3b --- /dev/null +++ b/test/tint/builtins/gen/var/select/e3e028.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<4, bool>, vec<4, bool>, vec<4, bool>) -> vec<4, bool> +fn select_e3e028() { + var arg_0 = vec4(); + var arg_1 = vec4(); + var arg_2 = vec4(); + var res: vec4 = select(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + select_e3e028(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + select_e3e028(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + select_e3e028(); +} diff --git a/test/tint/builtins/gen/var/select/e3e028.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/e3e028.wgsl.expected.glsl new file mode 100644 index 0000000000..f7c42e3ba8 --- /dev/null +++ b/test/tint/builtins/gen/var/select/e3e028.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void select_e3e028() { + bvec4 arg_0 = bvec4(false); + bvec4 arg_1 = bvec4(false); + bvec4 arg_2 = bvec4(false); + bvec4 res = mix(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + select_e3e028(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_e3e028() { + bvec4 arg_0 = bvec4(false); + bvec4 arg_1 = bvec4(false); + bvec4 arg_2 = bvec4(false); + bvec4 res = mix(arg_0, arg_1, arg_2); +} + +void fragment_main() { + select_e3e028(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_e3e028() { + bvec4 arg_0 = bvec4(false); + bvec4 arg_1 = bvec4(false); + bvec4 arg_2 = bvec4(false); + bvec4 res = mix(arg_0, arg_1, arg_2); +} + +void compute_main() { + select_e3e028(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/select/e3e028.wgsl.expected.hlsl b/test/tint/builtins/gen/var/select/e3e028.wgsl.expected.hlsl new file mode 100644 index 0000000000..1f55573525 --- /dev/null +++ b/test/tint/builtins/gen/var/select/e3e028.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +void select_e3e028() { + bool4 arg_0 = (false).xxxx; + bool4 arg_1 = (false).xxxx; + bool4 arg_2 = (false).xxxx; + bool4 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_e3e028(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_e3e028(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_e3e028(); + return; +} diff --git a/test/tint/builtins/gen/var/select/e3e028.wgsl.expected.msl b/test/tint/builtins/gen/var/select/e3e028.wgsl.expected.msl new file mode 100644 index 0000000000..ad607f72dd --- /dev/null +++ b/test/tint/builtins/gen/var/select/e3e028.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void select_e3e028() { + bool4 arg_0 = bool4(false); + bool4 arg_1 = bool4(false); + bool4 arg_2 = bool4(false); + bool4 res = select(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_e3e028(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_e3e028(); + return; +} + +kernel void compute_main() { + select_e3e028(); + return; +} + diff --git a/test/tint/builtins/gen/var/select/e3e028.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/e3e028.wgsl.expected.spvasm new file mode 100644 index 0000000000..7397e7d2d1 --- /dev/null +++ b/test/tint/builtins/gen/var/select/e3e028.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_e3e028 "select_e3e028" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %15 = OpConstantNull %v4bool +%_ptr_Function_v4bool = OpTypePointer Function %v4bool + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_e3e028 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4bool Function %15 + %arg_1 = OpVariable %_ptr_Function_v4bool Function %15 + %arg_2 = OpVariable %_ptr_Function_v4bool Function %15 + %res = OpVariable %_ptr_Function_v4bool Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %15 + %21 = OpLoad %v4bool %arg_2 + %22 = OpLoad %v4bool %arg_1 + %23 = OpLoad %v4bool %arg_0 + %20 = OpSelect %v4bool %21 %22 %23 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %select_e3e028 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %select_e3e028 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %select_e3e028 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/select/e3e028.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/e3e028.wgsl.expected.wgsl new file mode 100644 index 0000000000..fa2243ab8b --- /dev/null +++ b/test/tint/builtins/gen/var/select/e3e028.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn select_e3e028() { + var arg_0 = vec4(); + var arg_1 = vec4(); + var arg_2 = vec4(); + var res : vec4 = select(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + select_e3e028(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + select_e3e028(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + select_e3e028(); +} diff --git a/test/tint/builtins/gen/var/select/ebfea2.wgsl b/test/tint/builtins/gen/var/select/ebfea2.wgsl new file mode 100644 index 0000000000..8ca2585716 --- /dev/null +++ b/test/tint/builtins/gen/var/select/ebfea2.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<3, f32>, vec<3, f32>, vec<3, bool>) -> vec<3, f32> +fn select_ebfea2() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var arg_2 = vec3(); + var res: vec3 = select(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + select_ebfea2(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + select_ebfea2(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + select_ebfea2(); +} diff --git a/test/tint/builtins/gen/var/select/ebfea2.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/ebfea2.wgsl.expected.glsl new file mode 100644 index 0000000000..de4df3c393 --- /dev/null +++ b/test/tint/builtins/gen/var/select/ebfea2.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void select_ebfea2() { + vec3 arg_0 = vec3(0.0f); + vec3 arg_1 = vec3(0.0f); + bvec3 arg_2 = bvec3(false); + vec3 res = mix(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + select_ebfea2(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_ebfea2() { + vec3 arg_0 = vec3(0.0f); + vec3 arg_1 = vec3(0.0f); + bvec3 arg_2 = bvec3(false); + vec3 res = mix(arg_0, arg_1, arg_2); +} + +void fragment_main() { + select_ebfea2(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_ebfea2() { + vec3 arg_0 = vec3(0.0f); + vec3 arg_1 = vec3(0.0f); + bvec3 arg_2 = bvec3(false); + vec3 res = mix(arg_0, arg_1, arg_2); +} + +void compute_main() { + select_ebfea2(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/select/ebfea2.wgsl.expected.hlsl b/test/tint/builtins/gen/var/select/ebfea2.wgsl.expected.hlsl new file mode 100644 index 0000000000..e7f7af298c --- /dev/null +++ b/test/tint/builtins/gen/var/select/ebfea2.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +void select_ebfea2() { + float3 arg_0 = (0.0f).xxx; + float3 arg_1 = (0.0f).xxx; + bool3 arg_2 = (false).xxx; + float3 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_ebfea2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_ebfea2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_ebfea2(); + return; +} diff --git a/test/tint/builtins/gen/var/select/ebfea2.wgsl.expected.msl b/test/tint/builtins/gen/var/select/ebfea2.wgsl.expected.msl new file mode 100644 index 0000000000..a4bf7954c4 --- /dev/null +++ b/test/tint/builtins/gen/var/select/ebfea2.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void select_ebfea2() { + float3 arg_0 = float3(0.0f); + float3 arg_1 = float3(0.0f); + bool3 arg_2 = bool3(false); + float3 res = select(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_ebfea2(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_ebfea2(); + return; +} + +kernel void compute_main() { + select_ebfea2(); + return; +} + diff --git a/test/tint/builtins/gen/var/select/ebfea2.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/ebfea2.wgsl.expected.spvasm new file mode 100644 index 0000000000..17e6912e8a --- /dev/null +++ b/test/tint/builtins/gen/var/select/ebfea2.wgsl.expected.spvasm @@ -0,0 +1,82 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 42 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_ebfea2 "select_ebfea2" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %14 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %20 = OpConstantNull %v3bool +%_ptr_Function_v3bool = OpTypePointer Function %v3bool + %28 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_ebfea2 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %14 + %arg_1 = OpVariable %_ptr_Function_v3float Function %14 + %arg_2 = OpVariable %_ptr_Function_v3bool Function %20 + %res = OpVariable %_ptr_Function_v3float Function %14 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + OpStore %arg_2 %20 + %24 = OpLoad %v3bool %arg_2 + %25 = OpLoad %v3float %arg_1 + %26 = OpLoad %v3float %arg_0 + %23 = OpSelect %v3float %24 %25 %26 + OpStore %res %23 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %28 + %30 = OpLabel + %31 = OpFunctionCall %void %select_ebfea2 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %34 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %select_ebfea2 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %40 = OpLabel + %41 = OpFunctionCall %void %select_ebfea2 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/select/ebfea2.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/ebfea2.wgsl.expected.wgsl new file mode 100644 index 0000000000..e6ab17b86c --- /dev/null +++ b/test/tint/builtins/gen/var/select/ebfea2.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn select_ebfea2() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var arg_2 = vec3(); + var res : vec3 = select(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + select_ebfea2(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + select_ebfea2(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + select_ebfea2(); +} diff --git a/test/tint/builtins/gen/var/select/ed8a15.wgsl b/test/tint/builtins/gen/var/select/ed8a15.wgsl new file mode 100644 index 0000000000..450eac3817 --- /dev/null +++ b/test/tint/builtins/gen/var/select/ed8a15.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(i32, i32, bool) -> i32 +fn select_ed8a15() { + var arg_0 = 1; + var arg_1 = 1; + var arg_2 = bool(); + var res: i32 = select(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + select_ed8a15(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + select_ed8a15(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + select_ed8a15(); +} diff --git a/test/tint/builtins/gen/var/select/ed8a15.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/ed8a15.wgsl.expected.glsl new file mode 100644 index 0000000000..b8a1787872 --- /dev/null +++ b/test/tint/builtins/gen/var/select/ed8a15.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void select_ed8a15() { + int arg_0 = 1; + int arg_1 = 1; + bool arg_2 = false; + int res = (arg_2 ? arg_1 : arg_0); +} + +vec4 vertex_main() { + select_ed8a15(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_ed8a15() { + int arg_0 = 1; + int arg_1 = 1; + bool arg_2 = false; + int res = (arg_2 ? arg_1 : arg_0); +} + +void fragment_main() { + select_ed8a15(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_ed8a15() { + int arg_0 = 1; + int arg_1 = 1; + bool arg_2 = false; + int res = (arg_2 ? arg_1 : arg_0); +} + +void compute_main() { + select_ed8a15(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/select/ed8a15.wgsl.expected.hlsl b/test/tint/builtins/gen/var/select/ed8a15.wgsl.expected.hlsl new file mode 100644 index 0000000000..9c3ec95a49 --- /dev/null +++ b/test/tint/builtins/gen/var/select/ed8a15.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +void select_ed8a15() { + int arg_0 = 1; + int arg_1 = 1; + bool arg_2 = false; + int res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_ed8a15(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_ed8a15(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_ed8a15(); + return; +} diff --git a/test/tint/builtins/gen/var/select/ed8a15.wgsl.expected.msl b/test/tint/builtins/gen/var/select/ed8a15.wgsl.expected.msl new file mode 100644 index 0000000000..f28caa9814 --- /dev/null +++ b/test/tint/builtins/gen/var/select/ed8a15.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void select_ed8a15() { + int arg_0 = 1; + int arg_1 = 1; + bool arg_2 = false; + int res = select(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_ed8a15(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_ed8a15(); + return; +} + +kernel void compute_main() { + select_ed8a15(); + return; +} + diff --git a/test/tint/builtins/gen/var/select/ed8a15.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/ed8a15.wgsl.expected.spvasm new file mode 100644 index 0000000000..1479e66ce8 --- /dev/null +++ b/test/tint/builtins/gen/var/select/ed8a15.wgsl.expected.spvasm @@ -0,0 +1,82 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 42 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_ed8a15 "select_ed8a15" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %17 = OpConstantNull %int + %bool = OpTypeBool + %20 = OpConstantNull %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %28 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_ed8a15 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_int Function %17 + %arg_1 = OpVariable %_ptr_Function_int Function %17 + %arg_2 = OpVariable %_ptr_Function_bool Function %20 + %res = OpVariable %_ptr_Function_int Function %17 + OpStore %arg_0 %int_1 + OpStore %arg_1 %int_1 + OpStore %arg_2 %20 + %24 = OpLoad %bool %arg_2 + %25 = OpLoad %int %arg_1 + %26 = OpLoad %int %arg_0 + %23 = OpSelect %int %24 %25 %26 + OpStore %res %23 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %28 + %30 = OpLabel + %31 = OpFunctionCall %void %select_ed8a15 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %34 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %select_ed8a15 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %40 = OpLabel + %41 = OpFunctionCall %void %select_ed8a15 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/select/ed8a15.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/ed8a15.wgsl.expected.wgsl new file mode 100644 index 0000000000..7f1c4d1ab8 --- /dev/null +++ b/test/tint/builtins/gen/var/select/ed8a15.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn select_ed8a15() { + var arg_0 = 1; + var arg_1 = 1; + var arg_2 = bool(); + var res : i32 = select(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + select_ed8a15(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + select_ed8a15(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + select_ed8a15(); +} diff --git a/test/tint/builtins/gen/var/select/fb7e53.wgsl b/test/tint/builtins/gen/var/select/fb7e53.wgsl new file mode 100644 index 0000000000..14fc5b3656 --- /dev/null +++ b/test/tint/builtins/gen/var/select/fb7e53.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<2, bool>, vec<2, bool>, bool) -> vec<2, bool> +fn select_fb7e53() { + var arg_0 = vec2(); + var arg_1 = vec2(); + var arg_2 = bool(); + var res: vec2 = select(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + select_fb7e53(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + select_fb7e53(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + select_fb7e53(); +} diff --git a/test/tint/builtins/gen/var/select/fb7e53.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/fb7e53.wgsl.expected.glsl new file mode 100644 index 0000000000..af24c0081d --- /dev/null +++ b/test/tint/builtins/gen/var/select/fb7e53.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void select_fb7e53() { + bvec2 arg_0 = bvec2(false); + bvec2 arg_1 = bvec2(false); + bool arg_2 = false; + bvec2 res = (arg_2 ? arg_1 : arg_0); +} + +vec4 vertex_main() { + select_fb7e53(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_fb7e53() { + bvec2 arg_0 = bvec2(false); + bvec2 arg_1 = bvec2(false); + bool arg_2 = false; + bvec2 res = (arg_2 ? arg_1 : arg_0); +} + +void fragment_main() { + select_fb7e53(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_fb7e53() { + bvec2 arg_0 = bvec2(false); + bvec2 arg_1 = bvec2(false); + bool arg_2 = false; + bvec2 res = (arg_2 ? arg_1 : arg_0); +} + +void compute_main() { + select_fb7e53(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/select/fb7e53.wgsl.expected.hlsl b/test/tint/builtins/gen/var/select/fb7e53.wgsl.expected.hlsl new file mode 100644 index 0000000000..c5056e4117 --- /dev/null +++ b/test/tint/builtins/gen/var/select/fb7e53.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +void select_fb7e53() { + bool2 arg_0 = (false).xx; + bool2 arg_1 = (false).xx; + bool arg_2 = false; + bool2 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_fb7e53(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_fb7e53(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_fb7e53(); + return; +} diff --git a/test/tint/builtins/gen/var/select/fb7e53.wgsl.expected.msl b/test/tint/builtins/gen/var/select/fb7e53.wgsl.expected.msl new file mode 100644 index 0000000000..f5c62b7eca --- /dev/null +++ b/test/tint/builtins/gen/var/select/fb7e53.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void select_fb7e53() { + bool2 arg_0 = bool2(false); + bool2 arg_1 = bool2(false); + bool arg_2 = false; + bool2 res = select(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_fb7e53(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_fb7e53(); + return; +} + +kernel void compute_main() { + select_fb7e53(); + return; +} + diff --git a/test/tint/builtins/gen/var/select/fb7e53.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/fb7e53.wgsl.expected.spvasm new file mode 100644 index 0000000000..ea49de4824 --- /dev/null +++ b/test/tint/builtins/gen/var/select/fb7e53.wgsl.expected.spvasm @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_fb7e53 "select_fb7e53" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %15 = OpConstantNull %v2bool +%_ptr_Function_v2bool = OpTypePointer Function %v2bool + %19 = OpConstantNull %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %29 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_fb7e53 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2bool Function %15 + %arg_1 = OpVariable %_ptr_Function_v2bool Function %15 + %arg_2 = OpVariable %_ptr_Function_bool Function %19 + %26 = OpVariable %_ptr_Function_v2bool Function %15 + %res = OpVariable %_ptr_Function_v2bool Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %19 + %23 = OpLoad %bool %arg_2 + %24 = OpLoad %v2bool %arg_1 + %25 = OpLoad %v2bool %arg_0 + %27 = OpCompositeConstruct %v2bool %23 %23 + %22 = OpSelect %v2bool %27 %24 %25 + OpStore %res %22 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %29 + %31 = OpLabel + %32 = OpFunctionCall %void %select_fb7e53 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %35 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %select_fb7e53 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %41 = OpLabel + %42 = OpFunctionCall %void %select_fb7e53 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/select/fb7e53.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/fb7e53.wgsl.expected.wgsl new file mode 100644 index 0000000000..125fabfe2b --- /dev/null +++ b/test/tint/builtins/gen/var/select/fb7e53.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn select_fb7e53() { + var arg_0 = vec2(); + var arg_1 = vec2(); + var arg_2 = bool(); + var res : vec2 = select(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + select_fb7e53(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + select_fb7e53(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + select_fb7e53(); +} diff --git a/test/tint/builtins/gen/var/sign/159665.wgsl b/test/tint/builtins/gen/var/sign/159665.wgsl new file mode 100644 index 0000000000..9b02104884 --- /dev/null +++ b/test/tint/builtins/gen/var/sign/159665.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn sign(vec<3, f32>) -> vec<3, f32> +fn sign_159665() { + var arg_0 = vec3(); + var res: vec3 = sign(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + sign_159665(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + sign_159665(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + sign_159665(); +} diff --git a/test/tint/builtins/gen/var/sign/159665.wgsl.expected.glsl b/test/tint/builtins/gen/var/sign/159665.wgsl.expected.glsl new file mode 100644 index 0000000000..9427bed115 --- /dev/null +++ b/test/tint/builtins/gen/var/sign/159665.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void sign_159665() { + vec3 arg_0 = vec3(0.0f); + vec3 res = sign(arg_0); +} + +vec4 vertex_main() { + sign_159665(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void sign_159665() { + vec3 arg_0 = vec3(0.0f); + vec3 res = sign(arg_0); +} + +void fragment_main() { + sign_159665(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void sign_159665() { + vec3 arg_0 = vec3(0.0f); + vec3 res = sign(arg_0); +} + +void compute_main() { + sign_159665(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/sign/159665.wgsl.expected.hlsl b/test/tint/builtins/gen/var/sign/159665.wgsl.expected.hlsl new file mode 100644 index 0000000000..6c8fde0111 --- /dev/null +++ b/test/tint/builtins/gen/var/sign/159665.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void sign_159665() { + float3 arg_0 = (0.0f).xxx; + float3 res = sign(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sign_159665(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sign_159665(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sign_159665(); + return; +} diff --git a/test/tint/builtins/gen/var/sign/159665.wgsl.expected.msl b/test/tint/builtins/gen/var/sign/159665.wgsl.expected.msl new file mode 100644 index 0000000000..38383b4865 --- /dev/null +++ b/test/tint/builtins/gen/var/sign/159665.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void sign_159665() { + float3 arg_0 = float3(0.0f); + float3 res = sign(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sign_159665(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sign_159665(); + return; +} + +kernel void compute_main() { + sign_159665(); + return; +} + diff --git a/test/tint/builtins/gen/var/sign/159665.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sign/159665.wgsl.expected.spvasm new file mode 100644 index 0000000000..9bc6977c60 --- /dev/null +++ b/test/tint/builtins/gen/var/sign/159665.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sign_159665 "sign_159665" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %14 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%sign_159665 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %14 + %res = OpVariable %_ptr_Function_v3float Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %v3float %arg_0 + %17 = OpExtInst %v3float %18 FSign %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %sign_159665 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %sign_159665 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %sign_159665 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/sign/159665.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sign/159665.wgsl.expected.wgsl new file mode 100644 index 0000000000..139cee0ce3 --- /dev/null +++ b/test/tint/builtins/gen/var/sign/159665.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn sign_159665() { + var arg_0 = vec3(); + var res : vec3 = sign(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + sign_159665(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + sign_159665(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + sign_159665(); +} diff --git a/test/tint/builtins/gen/var/sign/b8f634.wgsl b/test/tint/builtins/gen/var/sign/b8f634.wgsl new file mode 100644 index 0000000000..f4473c64c5 --- /dev/null +++ b/test/tint/builtins/gen/var/sign/b8f634.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn sign(vec<4, f32>) -> vec<4, f32> +fn sign_b8f634() { + var arg_0 = vec4(); + var res: vec4 = sign(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + sign_b8f634(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + sign_b8f634(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + sign_b8f634(); +} diff --git a/test/tint/builtins/gen/var/sign/b8f634.wgsl.expected.glsl b/test/tint/builtins/gen/var/sign/b8f634.wgsl.expected.glsl new file mode 100644 index 0000000000..18bb2b050a --- /dev/null +++ b/test/tint/builtins/gen/var/sign/b8f634.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void sign_b8f634() { + vec4 arg_0 = vec4(0.0f); + vec4 res = sign(arg_0); +} + +vec4 vertex_main() { + sign_b8f634(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void sign_b8f634() { + vec4 arg_0 = vec4(0.0f); + vec4 res = sign(arg_0); +} + +void fragment_main() { + sign_b8f634(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void sign_b8f634() { + vec4 arg_0 = vec4(0.0f); + vec4 res = sign(arg_0); +} + +void compute_main() { + sign_b8f634(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/sign/b8f634.wgsl.expected.hlsl b/test/tint/builtins/gen/var/sign/b8f634.wgsl.expected.hlsl new file mode 100644 index 0000000000..19c3470a89 --- /dev/null +++ b/test/tint/builtins/gen/var/sign/b8f634.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void sign_b8f634() { + float4 arg_0 = (0.0f).xxxx; + float4 res = sign(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sign_b8f634(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sign_b8f634(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sign_b8f634(); + return; +} diff --git a/test/tint/builtins/gen/var/sign/b8f634.wgsl.expected.msl b/test/tint/builtins/gen/var/sign/b8f634.wgsl.expected.msl new file mode 100644 index 0000000000..3dc447320f --- /dev/null +++ b/test/tint/builtins/gen/var/sign/b8f634.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void sign_b8f634() { + float4 arg_0 = float4(0.0f); + float4 res = sign(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sign_b8f634(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sign_b8f634(); + return; +} + +kernel void compute_main() { + sign_b8f634(); + return; +} + diff --git a/test/tint/builtins/gen/var/sign/b8f634.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sign/b8f634.wgsl.expected.spvasm new file mode 100644 index 0000000000..27635d8abc --- /dev/null +++ b/test/tint/builtins/gen/var/sign/b8f634.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sign_b8f634 "sign_b8f634" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%sign_b8f634 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %5 + %17 = OpLoad %v4float %arg_0 + %15 = OpExtInst %v4float %16 FSign %17 + OpStore %res %15 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %sign_b8f634 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %sign_b8f634 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %sign_b8f634 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/sign/b8f634.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sign/b8f634.wgsl.expected.wgsl new file mode 100644 index 0000000000..cd37c6cf35 --- /dev/null +++ b/test/tint/builtins/gen/var/sign/b8f634.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn sign_b8f634() { + var arg_0 = vec4(); + var res : vec4 = sign(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + sign_b8f634(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + sign_b8f634(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + sign_b8f634(); +} diff --git a/test/tint/builtins/gen/var/sign/d065d8.wgsl b/test/tint/builtins/gen/var/sign/d065d8.wgsl new file mode 100644 index 0000000000..ad538d3279 --- /dev/null +++ b/test/tint/builtins/gen/var/sign/d065d8.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn sign(vec<2, f32>) -> vec<2, f32> +fn sign_d065d8() { + var arg_0 = vec2(); + var res: vec2 = sign(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + sign_d065d8(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + sign_d065d8(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + sign_d065d8(); +} diff --git a/test/tint/builtins/gen/var/sign/d065d8.wgsl.expected.glsl b/test/tint/builtins/gen/var/sign/d065d8.wgsl.expected.glsl new file mode 100644 index 0000000000..e98d5e32cd --- /dev/null +++ b/test/tint/builtins/gen/var/sign/d065d8.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void sign_d065d8() { + vec2 arg_0 = vec2(0.0f); + vec2 res = sign(arg_0); +} + +vec4 vertex_main() { + sign_d065d8(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void sign_d065d8() { + vec2 arg_0 = vec2(0.0f); + vec2 res = sign(arg_0); +} + +void fragment_main() { + sign_d065d8(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void sign_d065d8() { + vec2 arg_0 = vec2(0.0f); + vec2 res = sign(arg_0); +} + +void compute_main() { + sign_d065d8(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/sign/d065d8.wgsl.expected.hlsl b/test/tint/builtins/gen/var/sign/d065d8.wgsl.expected.hlsl new file mode 100644 index 0000000000..9abf6c402c --- /dev/null +++ b/test/tint/builtins/gen/var/sign/d065d8.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void sign_d065d8() { + float2 arg_0 = (0.0f).xx; + float2 res = sign(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sign_d065d8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sign_d065d8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sign_d065d8(); + return; +} diff --git a/test/tint/builtins/gen/var/sign/d065d8.wgsl.expected.msl b/test/tint/builtins/gen/var/sign/d065d8.wgsl.expected.msl new file mode 100644 index 0000000000..ddcf6210f3 --- /dev/null +++ b/test/tint/builtins/gen/var/sign/d065d8.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void sign_d065d8() { + float2 arg_0 = float2(0.0f); + float2 res = sign(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sign_d065d8(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sign_d065d8(); + return; +} + +kernel void compute_main() { + sign_d065d8(); + return; +} + diff --git a/test/tint/builtins/gen/var/sign/d065d8.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sign/d065d8.wgsl.expected.spvasm new file mode 100644 index 0000000000..dfdb7fc24f --- /dev/null +++ b/test/tint/builtins/gen/var/sign/d065d8.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sign_d065d8 "sign_d065d8" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %14 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%sign_d065d8 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %14 + %res = OpVariable %_ptr_Function_v2float Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %v2float %arg_0 + %17 = OpExtInst %v2float %18 FSign %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %sign_d065d8 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %sign_d065d8 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %sign_d065d8 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/sign/d065d8.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sign/d065d8.wgsl.expected.wgsl new file mode 100644 index 0000000000..9b3d127361 --- /dev/null +++ b/test/tint/builtins/gen/var/sign/d065d8.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn sign_d065d8() { + var arg_0 = vec2(); + var res : vec2 = sign(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + sign_d065d8(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + sign_d065d8(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + sign_d065d8(); +} diff --git a/test/tint/builtins/gen/var/sign/dd790e.wgsl b/test/tint/builtins/gen/var/sign/dd790e.wgsl new file mode 100644 index 0000000000..f381540c60 --- /dev/null +++ b/test/tint/builtins/gen/var/sign/dd790e.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn sign(f32) -> f32 +fn sign_dd790e() { + var arg_0 = 1.0; + var res: f32 = sign(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + sign_dd790e(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + sign_dd790e(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + sign_dd790e(); +} diff --git a/test/tint/builtins/gen/var/sign/dd790e.wgsl.expected.glsl b/test/tint/builtins/gen/var/sign/dd790e.wgsl.expected.glsl new file mode 100644 index 0000000000..a34767000c --- /dev/null +++ b/test/tint/builtins/gen/var/sign/dd790e.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void sign_dd790e() { + float arg_0 = 1.0f; + float res = sign(arg_0); +} + +vec4 vertex_main() { + sign_dd790e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void sign_dd790e() { + float arg_0 = 1.0f; + float res = sign(arg_0); +} + +void fragment_main() { + sign_dd790e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void sign_dd790e() { + float arg_0 = 1.0f; + float res = sign(arg_0); +} + +void compute_main() { + sign_dd790e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/sign/dd790e.wgsl.expected.hlsl b/test/tint/builtins/gen/var/sign/dd790e.wgsl.expected.hlsl new file mode 100644 index 0000000000..d0ef005da9 --- /dev/null +++ b/test/tint/builtins/gen/var/sign/dd790e.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void sign_dd790e() { + float arg_0 = 1.0f; + float res = sign(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sign_dd790e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sign_dd790e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sign_dd790e(); + return; +} diff --git a/test/tint/builtins/gen/var/sign/dd790e.wgsl.expected.msl b/test/tint/builtins/gen/var/sign/dd790e.wgsl.expected.msl new file mode 100644 index 0000000000..8f79ad2df9 --- /dev/null +++ b/test/tint/builtins/gen/var/sign/dd790e.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void sign_dd790e() { + float arg_0 = 1.0f; + float res = sign(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sign_dd790e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sign_dd790e(); + return; +} + +kernel void compute_main() { + sign_dd790e(); + return; +} + diff --git a/test/tint/builtins/gen/var/sign/dd790e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sign/dd790e.wgsl.expected.spvasm new file mode 100644 index 0000000000..8ef69f029c --- /dev/null +++ b/test/tint/builtins/gen/var/sign/dd790e.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sign_dd790e "sign_dd790e" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %20 = OpTypeFunction %v4float +%sign_dd790e = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + %18 = OpLoad %float %arg_0 + %16 = OpExtInst %float %17 FSign %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %sign_dd790e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %sign_dd790e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %sign_dd790e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/sign/dd790e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sign/dd790e.wgsl.expected.wgsl new file mode 100644 index 0000000000..b6b8bb21f5 --- /dev/null +++ b/test/tint/builtins/gen/var/sign/dd790e.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn sign_dd790e() { + var arg_0 = 1.0; + var res : f32 = sign(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + sign_dd790e(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + sign_dd790e(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + sign_dd790e(); +} diff --git a/test/tint/builtins/gen/var/sin/01f241.wgsl b/test/tint/builtins/gen/var/sin/01f241.wgsl new file mode 100644 index 0000000000..533a83a471 --- /dev/null +++ b/test/tint/builtins/gen/var/sin/01f241.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn sin(vec<3, f32>) -> vec<3, f32> +fn sin_01f241() { + var arg_0 = vec3(); + var res: vec3 = sin(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + sin_01f241(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + sin_01f241(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + sin_01f241(); +} diff --git a/test/tint/builtins/gen/var/sin/01f241.wgsl.expected.glsl b/test/tint/builtins/gen/var/sin/01f241.wgsl.expected.glsl new file mode 100644 index 0000000000..f9b89812e0 --- /dev/null +++ b/test/tint/builtins/gen/var/sin/01f241.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void sin_01f241() { + vec3 arg_0 = vec3(0.0f); + vec3 res = sin(arg_0); +} + +vec4 vertex_main() { + sin_01f241(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void sin_01f241() { + vec3 arg_0 = vec3(0.0f); + vec3 res = sin(arg_0); +} + +void fragment_main() { + sin_01f241(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void sin_01f241() { + vec3 arg_0 = vec3(0.0f); + vec3 res = sin(arg_0); +} + +void compute_main() { + sin_01f241(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/sin/01f241.wgsl.expected.hlsl b/test/tint/builtins/gen/var/sin/01f241.wgsl.expected.hlsl new file mode 100644 index 0000000000..d2419e7827 --- /dev/null +++ b/test/tint/builtins/gen/var/sin/01f241.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void sin_01f241() { + float3 arg_0 = (0.0f).xxx; + float3 res = sin(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sin_01f241(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sin_01f241(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sin_01f241(); + return; +} diff --git a/test/tint/builtins/gen/var/sin/01f241.wgsl.expected.msl b/test/tint/builtins/gen/var/sin/01f241.wgsl.expected.msl new file mode 100644 index 0000000000..4beab98e37 --- /dev/null +++ b/test/tint/builtins/gen/var/sin/01f241.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void sin_01f241() { + float3 arg_0 = float3(0.0f); + float3 res = sin(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sin_01f241(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sin_01f241(); + return; +} + +kernel void compute_main() { + sin_01f241(); + return; +} + diff --git a/test/tint/builtins/gen/var/sin/01f241.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sin/01f241.wgsl.expected.spvasm new file mode 100644 index 0000000000..53fbcbd436 --- /dev/null +++ b/test/tint/builtins/gen/var/sin/01f241.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sin_01f241 "sin_01f241" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %14 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %sin_01f241 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %14 + %res = OpVariable %_ptr_Function_v3float Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %v3float %arg_0 + %17 = OpExtInst %v3float %18 Sin %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %sin_01f241 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %sin_01f241 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %sin_01f241 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/sin/01f241.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sin/01f241.wgsl.expected.wgsl new file mode 100644 index 0000000000..dac1cf6e79 --- /dev/null +++ b/test/tint/builtins/gen/var/sin/01f241.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn sin_01f241() { + var arg_0 = vec3(); + var res : vec3 = sin(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + sin_01f241(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + sin_01f241(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + sin_01f241(); +} diff --git a/test/tint/builtins/gen/var/sin/4e3979.wgsl b/test/tint/builtins/gen/var/sin/4e3979.wgsl new file mode 100644 index 0000000000..5ae4b3db28 --- /dev/null +++ b/test/tint/builtins/gen/var/sin/4e3979.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn sin(vec<4, f32>) -> vec<4, f32> +fn sin_4e3979() { + var arg_0 = vec4(); + var res: vec4 = sin(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + sin_4e3979(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + sin_4e3979(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + sin_4e3979(); +} diff --git a/test/tint/builtins/gen/var/sin/4e3979.wgsl.expected.glsl b/test/tint/builtins/gen/var/sin/4e3979.wgsl.expected.glsl new file mode 100644 index 0000000000..201e133c6e --- /dev/null +++ b/test/tint/builtins/gen/var/sin/4e3979.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void sin_4e3979() { + vec4 arg_0 = vec4(0.0f); + vec4 res = sin(arg_0); +} + +vec4 vertex_main() { + sin_4e3979(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void sin_4e3979() { + vec4 arg_0 = vec4(0.0f); + vec4 res = sin(arg_0); +} + +void fragment_main() { + sin_4e3979(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void sin_4e3979() { + vec4 arg_0 = vec4(0.0f); + vec4 res = sin(arg_0); +} + +void compute_main() { + sin_4e3979(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/sin/4e3979.wgsl.expected.hlsl b/test/tint/builtins/gen/var/sin/4e3979.wgsl.expected.hlsl new file mode 100644 index 0000000000..17d1855ce3 --- /dev/null +++ b/test/tint/builtins/gen/var/sin/4e3979.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void sin_4e3979() { + float4 arg_0 = (0.0f).xxxx; + float4 res = sin(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sin_4e3979(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sin_4e3979(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sin_4e3979(); + return; +} diff --git a/test/tint/builtins/gen/var/sin/4e3979.wgsl.expected.msl b/test/tint/builtins/gen/var/sin/4e3979.wgsl.expected.msl new file mode 100644 index 0000000000..5d7e8fa43f --- /dev/null +++ b/test/tint/builtins/gen/var/sin/4e3979.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void sin_4e3979() { + float4 arg_0 = float4(0.0f); + float4 res = sin(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sin_4e3979(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sin_4e3979(); + return; +} + +kernel void compute_main() { + sin_4e3979(); + return; +} + diff --git a/test/tint/builtins/gen/var/sin/4e3979.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sin/4e3979.wgsl.expected.spvasm new file mode 100644 index 0000000000..f8e43b0af9 --- /dev/null +++ b/test/tint/builtins/gen/var/sin/4e3979.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sin_4e3979 "sin_4e3979" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %sin_4e3979 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %5 + %17 = OpLoad %v4float %arg_0 + %15 = OpExtInst %v4float %16 Sin %17 + OpStore %res %15 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %sin_4e3979 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %sin_4e3979 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %sin_4e3979 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/sin/4e3979.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sin/4e3979.wgsl.expected.wgsl new file mode 100644 index 0000000000..b588d0e1be --- /dev/null +++ b/test/tint/builtins/gen/var/sin/4e3979.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn sin_4e3979() { + var arg_0 = vec4(); + var res : vec4 = sin(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + sin_4e3979(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + sin_4e3979(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + sin_4e3979(); +} diff --git a/test/tint/builtins/gen/var/sin/b78c91.wgsl b/test/tint/builtins/gen/var/sin/b78c91.wgsl new file mode 100644 index 0000000000..23a08d5a38 --- /dev/null +++ b/test/tint/builtins/gen/var/sin/b78c91.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn sin(f32) -> f32 +fn sin_b78c91() { + var arg_0 = 1.0; + var res: f32 = sin(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + sin_b78c91(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + sin_b78c91(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + sin_b78c91(); +} diff --git a/test/tint/builtins/gen/var/sin/b78c91.wgsl.expected.glsl b/test/tint/builtins/gen/var/sin/b78c91.wgsl.expected.glsl new file mode 100644 index 0000000000..97f9d76d56 --- /dev/null +++ b/test/tint/builtins/gen/var/sin/b78c91.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void sin_b78c91() { + float arg_0 = 1.0f; + float res = sin(arg_0); +} + +vec4 vertex_main() { + sin_b78c91(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void sin_b78c91() { + float arg_0 = 1.0f; + float res = sin(arg_0); +} + +void fragment_main() { + sin_b78c91(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void sin_b78c91() { + float arg_0 = 1.0f; + float res = sin(arg_0); +} + +void compute_main() { + sin_b78c91(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/sin/b78c91.wgsl.expected.hlsl b/test/tint/builtins/gen/var/sin/b78c91.wgsl.expected.hlsl new file mode 100644 index 0000000000..001dc1b9fd --- /dev/null +++ b/test/tint/builtins/gen/var/sin/b78c91.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void sin_b78c91() { + float arg_0 = 1.0f; + float res = sin(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sin_b78c91(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sin_b78c91(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sin_b78c91(); + return; +} diff --git a/test/tint/builtins/gen/var/sin/b78c91.wgsl.expected.msl b/test/tint/builtins/gen/var/sin/b78c91.wgsl.expected.msl new file mode 100644 index 0000000000..8aaa9f7787 --- /dev/null +++ b/test/tint/builtins/gen/var/sin/b78c91.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void sin_b78c91() { + float arg_0 = 1.0f; + float res = sin(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sin_b78c91(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sin_b78c91(); + return; +} + +kernel void compute_main() { + sin_b78c91(); + return; +} + diff --git a/test/tint/builtins/gen/var/sin/b78c91.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sin/b78c91.wgsl.expected.spvasm new file mode 100644 index 0000000000..4b311132f2 --- /dev/null +++ b/test/tint/builtins/gen/var/sin/b78c91.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sin_b78c91 "sin_b78c91" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %20 = OpTypeFunction %v4float + %sin_b78c91 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + %18 = OpLoad %float %arg_0 + %16 = OpExtInst %float %17 Sin %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %sin_b78c91 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %sin_b78c91 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %sin_b78c91 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/sin/b78c91.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sin/b78c91.wgsl.expected.wgsl new file mode 100644 index 0000000000..b736ea8a06 --- /dev/null +++ b/test/tint/builtins/gen/var/sin/b78c91.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn sin_b78c91() { + var arg_0 = 1.0; + var res : f32 = sin(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + sin_b78c91(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + sin_b78c91(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + sin_b78c91(); +} diff --git a/test/tint/builtins/gen/var/sin/fc8bc4.wgsl b/test/tint/builtins/gen/var/sin/fc8bc4.wgsl new file mode 100644 index 0000000000..66ad20ac8d --- /dev/null +++ b/test/tint/builtins/gen/var/sin/fc8bc4.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn sin(vec<2, f32>) -> vec<2, f32> +fn sin_fc8bc4() { + var arg_0 = vec2(); + var res: vec2 = sin(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + sin_fc8bc4(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + sin_fc8bc4(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + sin_fc8bc4(); +} diff --git a/test/tint/builtins/gen/var/sin/fc8bc4.wgsl.expected.glsl b/test/tint/builtins/gen/var/sin/fc8bc4.wgsl.expected.glsl new file mode 100644 index 0000000000..d5071ce6a1 --- /dev/null +++ b/test/tint/builtins/gen/var/sin/fc8bc4.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void sin_fc8bc4() { + vec2 arg_0 = vec2(0.0f); + vec2 res = sin(arg_0); +} + +vec4 vertex_main() { + sin_fc8bc4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void sin_fc8bc4() { + vec2 arg_0 = vec2(0.0f); + vec2 res = sin(arg_0); +} + +void fragment_main() { + sin_fc8bc4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void sin_fc8bc4() { + vec2 arg_0 = vec2(0.0f); + vec2 res = sin(arg_0); +} + +void compute_main() { + sin_fc8bc4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/sin/fc8bc4.wgsl.expected.hlsl b/test/tint/builtins/gen/var/sin/fc8bc4.wgsl.expected.hlsl new file mode 100644 index 0000000000..a06c569dce --- /dev/null +++ b/test/tint/builtins/gen/var/sin/fc8bc4.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void sin_fc8bc4() { + float2 arg_0 = (0.0f).xx; + float2 res = sin(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sin_fc8bc4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sin_fc8bc4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sin_fc8bc4(); + return; +} diff --git a/test/tint/builtins/gen/var/sin/fc8bc4.wgsl.expected.msl b/test/tint/builtins/gen/var/sin/fc8bc4.wgsl.expected.msl new file mode 100644 index 0000000000..602c0050f0 --- /dev/null +++ b/test/tint/builtins/gen/var/sin/fc8bc4.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void sin_fc8bc4() { + float2 arg_0 = float2(0.0f); + float2 res = sin(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sin_fc8bc4(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sin_fc8bc4(); + return; +} + +kernel void compute_main() { + sin_fc8bc4(); + return; +} + diff --git a/test/tint/builtins/gen/var/sin/fc8bc4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sin/fc8bc4.wgsl.expected.spvasm new file mode 100644 index 0000000000..e7dff32bba --- /dev/null +++ b/test/tint/builtins/gen/var/sin/fc8bc4.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sin_fc8bc4 "sin_fc8bc4" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %14 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %sin_fc8bc4 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %14 + %res = OpVariable %_ptr_Function_v2float Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %v2float %arg_0 + %17 = OpExtInst %v2float %18 Sin %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %sin_fc8bc4 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %sin_fc8bc4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %sin_fc8bc4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/sin/fc8bc4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sin/fc8bc4.wgsl.expected.wgsl new file mode 100644 index 0000000000..0168f26375 --- /dev/null +++ b/test/tint/builtins/gen/var/sin/fc8bc4.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn sin_fc8bc4() { + var arg_0 = vec2(); + var res : vec2 = sin(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + sin_fc8bc4(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + sin_fc8bc4(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + sin_fc8bc4(); +} diff --git a/test/tint/builtins/gen/var/sinh/445e33.wgsl b/test/tint/builtins/gen/var/sinh/445e33.wgsl new file mode 100644 index 0000000000..aedfe3b60b --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/445e33.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn sinh(vec<4, f32>) -> vec<4, f32> +fn sinh_445e33() { + var arg_0 = vec4(); + var res: vec4 = sinh(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + sinh_445e33(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + sinh_445e33(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + sinh_445e33(); +} diff --git a/test/tint/builtins/gen/var/sinh/445e33.wgsl.expected.glsl b/test/tint/builtins/gen/var/sinh/445e33.wgsl.expected.glsl new file mode 100644 index 0000000000..474189b165 --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/445e33.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void sinh_445e33() { + vec4 arg_0 = vec4(0.0f); + vec4 res = sinh(arg_0); +} + +vec4 vertex_main() { + sinh_445e33(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void sinh_445e33() { + vec4 arg_0 = vec4(0.0f); + vec4 res = sinh(arg_0); +} + +void fragment_main() { + sinh_445e33(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void sinh_445e33() { + vec4 arg_0 = vec4(0.0f); + vec4 res = sinh(arg_0); +} + +void compute_main() { + sinh_445e33(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/sinh/445e33.wgsl.expected.hlsl b/test/tint/builtins/gen/var/sinh/445e33.wgsl.expected.hlsl new file mode 100644 index 0000000000..7ae5522f15 --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/445e33.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void sinh_445e33() { + float4 arg_0 = (0.0f).xxxx; + float4 res = sinh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sinh_445e33(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sinh_445e33(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sinh_445e33(); + return; +} diff --git a/test/tint/builtins/gen/var/sinh/445e33.wgsl.expected.msl b/test/tint/builtins/gen/var/sinh/445e33.wgsl.expected.msl new file mode 100644 index 0000000000..20a5830ce4 --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/445e33.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void sinh_445e33() { + float4 arg_0 = float4(0.0f); + float4 res = sinh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sinh_445e33(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sinh_445e33(); + return; +} + +kernel void compute_main() { + sinh_445e33(); + return; +} + diff --git a/test/tint/builtins/gen/var/sinh/445e33.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sinh/445e33.wgsl.expected.spvasm new file mode 100644 index 0000000000..0bf452a3d3 --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/445e33.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sinh_445e33 "sinh_445e33" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%sinh_445e33 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %5 + %17 = OpLoad %v4float %arg_0 + %15 = OpExtInst %v4float %16 Sinh %17 + OpStore %res %15 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %sinh_445e33 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %sinh_445e33 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %sinh_445e33 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/sinh/445e33.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sinh/445e33.wgsl.expected.wgsl new file mode 100644 index 0000000000..5b1e2a603c --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/445e33.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn sinh_445e33() { + var arg_0 = vec4(); + var res : vec4 = sinh(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + sinh_445e33(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + sinh_445e33(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + sinh_445e33(); +} diff --git a/test/tint/builtins/gen/var/sinh/7bb598.wgsl b/test/tint/builtins/gen/var/sinh/7bb598.wgsl new file mode 100644 index 0000000000..0075c04fb9 --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/7bb598.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn sinh(f32) -> f32 +fn sinh_7bb598() { + var arg_0 = 1.0; + var res: f32 = sinh(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + sinh_7bb598(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + sinh_7bb598(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + sinh_7bb598(); +} diff --git a/test/tint/builtins/gen/var/sinh/7bb598.wgsl.expected.glsl b/test/tint/builtins/gen/var/sinh/7bb598.wgsl.expected.glsl new file mode 100644 index 0000000000..90e559743a --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/7bb598.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void sinh_7bb598() { + float arg_0 = 1.0f; + float res = sinh(arg_0); +} + +vec4 vertex_main() { + sinh_7bb598(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void sinh_7bb598() { + float arg_0 = 1.0f; + float res = sinh(arg_0); +} + +void fragment_main() { + sinh_7bb598(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void sinh_7bb598() { + float arg_0 = 1.0f; + float res = sinh(arg_0); +} + +void compute_main() { + sinh_7bb598(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/sinh/7bb598.wgsl.expected.hlsl b/test/tint/builtins/gen/var/sinh/7bb598.wgsl.expected.hlsl new file mode 100644 index 0000000000..1aeb0cdadb --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/7bb598.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void sinh_7bb598() { + float arg_0 = 1.0f; + float res = sinh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sinh_7bb598(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sinh_7bb598(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sinh_7bb598(); + return; +} diff --git a/test/tint/builtins/gen/var/sinh/7bb598.wgsl.expected.msl b/test/tint/builtins/gen/var/sinh/7bb598.wgsl.expected.msl new file mode 100644 index 0000000000..f78c11ebd8 --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/7bb598.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void sinh_7bb598() { + float arg_0 = 1.0f; + float res = sinh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sinh_7bb598(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sinh_7bb598(); + return; +} + +kernel void compute_main() { + sinh_7bb598(); + return; +} + diff --git a/test/tint/builtins/gen/var/sinh/7bb598.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sinh/7bb598.wgsl.expected.spvasm new file mode 100644 index 0000000000..bd605b4b2c --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/7bb598.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sinh_7bb598 "sinh_7bb598" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %20 = OpTypeFunction %v4float +%sinh_7bb598 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + %18 = OpLoad %float %arg_0 + %16 = OpExtInst %float %17 Sinh %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %sinh_7bb598 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %sinh_7bb598 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %sinh_7bb598 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/sinh/7bb598.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sinh/7bb598.wgsl.expected.wgsl new file mode 100644 index 0000000000..1d5be8c19f --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/7bb598.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn sinh_7bb598() { + var arg_0 = 1.0; + var res : f32 = sinh(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + sinh_7bb598(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + sinh_7bb598(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + sinh_7bb598(); +} diff --git a/test/tint/builtins/gen/var/sinh/b9860e.wgsl b/test/tint/builtins/gen/var/sinh/b9860e.wgsl new file mode 100644 index 0000000000..530c4231b2 --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/b9860e.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn sinh(vec<2, f32>) -> vec<2, f32> +fn sinh_b9860e() { + var arg_0 = vec2(); + var res: vec2 = sinh(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + sinh_b9860e(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + sinh_b9860e(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + sinh_b9860e(); +} diff --git a/test/tint/builtins/gen/var/sinh/b9860e.wgsl.expected.glsl b/test/tint/builtins/gen/var/sinh/b9860e.wgsl.expected.glsl new file mode 100644 index 0000000000..ad6e3fb073 --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/b9860e.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void sinh_b9860e() { + vec2 arg_0 = vec2(0.0f); + vec2 res = sinh(arg_0); +} + +vec4 vertex_main() { + sinh_b9860e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void sinh_b9860e() { + vec2 arg_0 = vec2(0.0f); + vec2 res = sinh(arg_0); +} + +void fragment_main() { + sinh_b9860e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void sinh_b9860e() { + vec2 arg_0 = vec2(0.0f); + vec2 res = sinh(arg_0); +} + +void compute_main() { + sinh_b9860e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/sinh/b9860e.wgsl.expected.hlsl b/test/tint/builtins/gen/var/sinh/b9860e.wgsl.expected.hlsl new file mode 100644 index 0000000000..f1a64f6965 --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/b9860e.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void sinh_b9860e() { + float2 arg_0 = (0.0f).xx; + float2 res = sinh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sinh_b9860e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sinh_b9860e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sinh_b9860e(); + return; +} diff --git a/test/tint/builtins/gen/var/sinh/b9860e.wgsl.expected.msl b/test/tint/builtins/gen/var/sinh/b9860e.wgsl.expected.msl new file mode 100644 index 0000000000..13cb06a33f --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/b9860e.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void sinh_b9860e() { + float2 arg_0 = float2(0.0f); + float2 res = sinh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sinh_b9860e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sinh_b9860e(); + return; +} + +kernel void compute_main() { + sinh_b9860e(); + return; +} + diff --git a/test/tint/builtins/gen/var/sinh/b9860e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sinh/b9860e.wgsl.expected.spvasm new file mode 100644 index 0000000000..5dbdbeb9c0 --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/b9860e.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sinh_b9860e "sinh_b9860e" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %14 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%sinh_b9860e = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %14 + %res = OpVariable %_ptr_Function_v2float Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %v2float %arg_0 + %17 = OpExtInst %v2float %18 Sinh %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %sinh_b9860e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %sinh_b9860e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %sinh_b9860e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/sinh/b9860e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sinh/b9860e.wgsl.expected.wgsl new file mode 100644 index 0000000000..d1153b7e81 --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/b9860e.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn sinh_b9860e() { + var arg_0 = vec2(); + var res : vec2 = sinh(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + sinh_b9860e(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + sinh_b9860e(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + sinh_b9860e(); +} diff --git a/test/tint/builtins/gen/var/sinh/c9a5eb.wgsl b/test/tint/builtins/gen/var/sinh/c9a5eb.wgsl new file mode 100644 index 0000000000..94f38dd336 --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/c9a5eb.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn sinh(vec<3, f32>) -> vec<3, f32> +fn sinh_c9a5eb() { + var arg_0 = vec3(); + var res: vec3 = sinh(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + sinh_c9a5eb(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + sinh_c9a5eb(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + sinh_c9a5eb(); +} diff --git a/test/tint/builtins/gen/var/sinh/c9a5eb.wgsl.expected.glsl b/test/tint/builtins/gen/var/sinh/c9a5eb.wgsl.expected.glsl new file mode 100644 index 0000000000..d8de41d991 --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/c9a5eb.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void sinh_c9a5eb() { + vec3 arg_0 = vec3(0.0f); + vec3 res = sinh(arg_0); +} + +vec4 vertex_main() { + sinh_c9a5eb(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void sinh_c9a5eb() { + vec3 arg_0 = vec3(0.0f); + vec3 res = sinh(arg_0); +} + +void fragment_main() { + sinh_c9a5eb(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void sinh_c9a5eb() { + vec3 arg_0 = vec3(0.0f); + vec3 res = sinh(arg_0); +} + +void compute_main() { + sinh_c9a5eb(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/sinh/c9a5eb.wgsl.expected.hlsl b/test/tint/builtins/gen/var/sinh/c9a5eb.wgsl.expected.hlsl new file mode 100644 index 0000000000..b600a69bf7 --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/c9a5eb.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void sinh_c9a5eb() { + float3 arg_0 = (0.0f).xxx; + float3 res = sinh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sinh_c9a5eb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sinh_c9a5eb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sinh_c9a5eb(); + return; +} diff --git a/test/tint/builtins/gen/var/sinh/c9a5eb.wgsl.expected.msl b/test/tint/builtins/gen/var/sinh/c9a5eb.wgsl.expected.msl new file mode 100644 index 0000000000..6903d34869 --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/c9a5eb.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void sinh_c9a5eb() { + float3 arg_0 = float3(0.0f); + float3 res = sinh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sinh_c9a5eb(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sinh_c9a5eb(); + return; +} + +kernel void compute_main() { + sinh_c9a5eb(); + return; +} + diff --git a/test/tint/builtins/gen/var/sinh/c9a5eb.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sinh/c9a5eb.wgsl.expected.spvasm new file mode 100644 index 0000000000..06720a1bbc --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/c9a5eb.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sinh_c9a5eb "sinh_c9a5eb" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %14 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%sinh_c9a5eb = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %14 + %res = OpVariable %_ptr_Function_v3float Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %v3float %arg_0 + %17 = OpExtInst %v3float %18 Sinh %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %sinh_c9a5eb + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %sinh_c9a5eb + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %sinh_c9a5eb + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/sinh/c9a5eb.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sinh/c9a5eb.wgsl.expected.wgsl new file mode 100644 index 0000000000..bd5b007e90 --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/c9a5eb.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn sinh_c9a5eb() { + var arg_0 = vec3(); + var res : vec3 = sinh(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + sinh_c9a5eb(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + sinh_c9a5eb(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + sinh_c9a5eb(); +} diff --git a/test/tint/builtins/gen/var/smoothstep/392c19.wgsl b/test/tint/builtins/gen/var/smoothstep/392c19.wgsl new file mode 100644 index 0000000000..3b00111847 --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/392c19.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn smoothstep(vec<2, f32>, vec<2, f32>, vec<2, f32>) -> vec<2, f32> +fn smoothstep_392c19() { + var arg_0 = vec2(); + var arg_1 = vec2(); + var arg_2 = vec2(); + var res: vec2 = smoothstep(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + smoothstep_392c19(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + smoothstep_392c19(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + smoothstep_392c19(); +} diff --git a/test/tint/builtins/gen/var/smoothstep/392c19.wgsl.expected.glsl b/test/tint/builtins/gen/var/smoothstep/392c19.wgsl.expected.glsl new file mode 100644 index 0000000000..37a5da962a --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/392c19.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void smoothstep_392c19() { + vec2 arg_0 = vec2(0.0f); + vec2 arg_1 = vec2(0.0f); + vec2 arg_2 = vec2(0.0f); + vec2 res = smoothstep(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + smoothstep_392c19(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void smoothstep_392c19() { + vec2 arg_0 = vec2(0.0f); + vec2 arg_1 = vec2(0.0f); + vec2 arg_2 = vec2(0.0f); + vec2 res = smoothstep(arg_0, arg_1, arg_2); +} + +void fragment_main() { + smoothstep_392c19(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void smoothstep_392c19() { + vec2 arg_0 = vec2(0.0f); + vec2 arg_1 = vec2(0.0f); + vec2 arg_2 = vec2(0.0f); + vec2 res = smoothstep(arg_0, arg_1, arg_2); +} + +void compute_main() { + smoothstep_392c19(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/smoothstep/392c19.wgsl.expected.hlsl b/test/tint/builtins/gen/var/smoothstep/392c19.wgsl.expected.hlsl new file mode 100644 index 0000000000..1d57c73c96 --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/392c19.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +void smoothstep_392c19() { + float2 arg_0 = (0.0f).xx; + float2 arg_1 = (0.0f).xx; + float2 arg_2 = (0.0f).xx; + float2 res = smoothstep(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + smoothstep_392c19(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + smoothstep_392c19(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + smoothstep_392c19(); + return; +} diff --git a/test/tint/builtins/gen/var/smoothstep/392c19.wgsl.expected.msl b/test/tint/builtins/gen/var/smoothstep/392c19.wgsl.expected.msl new file mode 100644 index 0000000000..38ba87cd3b --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/392c19.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void smoothstep_392c19() { + float2 arg_0 = float2(0.0f); + float2 arg_1 = float2(0.0f); + float2 arg_2 = float2(0.0f); + float2 res = smoothstep(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + smoothstep_392c19(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + smoothstep_392c19(); + return; +} + +kernel void compute_main() { + smoothstep_392c19(); + return; +} + diff --git a/test/tint/builtins/gen/var/smoothstep/392c19.wgsl.expected.spvasm b/test/tint/builtins/gen/var/smoothstep/392c19.wgsl.expected.spvasm new file mode 100644 index 0000000000..b41e51a15d --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/392c19.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %smoothstep_392c19 "smoothstep_392c19" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %14 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%smoothstep_392c19 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %14 + %arg_1 = OpVariable %_ptr_Function_v2float Function %14 + %arg_2 = OpVariable %_ptr_Function_v2float Function %14 + %res = OpVariable %_ptr_Function_v2float Function %14 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + OpStore %arg_2 %14 + %21 = OpLoad %v2float %arg_0 + %22 = OpLoad %v2float %arg_1 + %23 = OpLoad %v2float %arg_2 + %19 = OpExtInst %v2float %20 SmoothStep %21 %22 %23 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %smoothstep_392c19 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %smoothstep_392c19 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %smoothstep_392c19 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/smoothstep/392c19.wgsl.expected.wgsl b/test/tint/builtins/gen/var/smoothstep/392c19.wgsl.expected.wgsl new file mode 100644 index 0000000000..06beb1c382 --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/392c19.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn smoothstep_392c19() { + var arg_0 = vec2(); + var arg_1 = vec2(); + var arg_2 = vec2(); + var res : vec2 = smoothstep(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + smoothstep_392c19(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + smoothstep_392c19(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + smoothstep_392c19(); +} diff --git a/test/tint/builtins/gen/var/smoothstep/40864c.wgsl b/test/tint/builtins/gen/var/smoothstep/40864c.wgsl new file mode 100644 index 0000000000..898791a3cf --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/40864c.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn smoothstep(vec<4, f32>, vec<4, f32>, vec<4, f32>) -> vec<4, f32> +fn smoothstep_40864c() { + var arg_0 = vec4(); + var arg_1 = vec4(); + var arg_2 = vec4(); + var res: vec4 = smoothstep(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + smoothstep_40864c(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + smoothstep_40864c(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + smoothstep_40864c(); +} diff --git a/test/tint/builtins/gen/var/smoothstep/40864c.wgsl.expected.glsl b/test/tint/builtins/gen/var/smoothstep/40864c.wgsl.expected.glsl new file mode 100644 index 0000000000..1a3e2c949e --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/40864c.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void smoothstep_40864c() { + vec4 arg_0 = vec4(0.0f); + vec4 arg_1 = vec4(0.0f); + vec4 arg_2 = vec4(0.0f); + vec4 res = smoothstep(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + smoothstep_40864c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void smoothstep_40864c() { + vec4 arg_0 = vec4(0.0f); + vec4 arg_1 = vec4(0.0f); + vec4 arg_2 = vec4(0.0f); + vec4 res = smoothstep(arg_0, arg_1, arg_2); +} + +void fragment_main() { + smoothstep_40864c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void smoothstep_40864c() { + vec4 arg_0 = vec4(0.0f); + vec4 arg_1 = vec4(0.0f); + vec4 arg_2 = vec4(0.0f); + vec4 res = smoothstep(arg_0, arg_1, arg_2); +} + +void compute_main() { + smoothstep_40864c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/smoothstep/40864c.wgsl.expected.hlsl b/test/tint/builtins/gen/var/smoothstep/40864c.wgsl.expected.hlsl new file mode 100644 index 0000000000..e9f0a25760 --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/40864c.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +void smoothstep_40864c() { + float4 arg_0 = (0.0f).xxxx; + float4 arg_1 = (0.0f).xxxx; + float4 arg_2 = (0.0f).xxxx; + float4 res = smoothstep(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + smoothstep_40864c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + smoothstep_40864c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + smoothstep_40864c(); + return; +} diff --git a/test/tint/builtins/gen/var/smoothstep/40864c.wgsl.expected.msl b/test/tint/builtins/gen/var/smoothstep/40864c.wgsl.expected.msl new file mode 100644 index 0000000000..dff1a8a0a2 --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/40864c.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void smoothstep_40864c() { + float4 arg_0 = float4(0.0f); + float4 arg_1 = float4(0.0f); + float4 arg_2 = float4(0.0f); + float4 res = smoothstep(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + smoothstep_40864c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + smoothstep_40864c(); + return; +} + +kernel void compute_main() { + smoothstep_40864c(); + return; +} + diff --git a/test/tint/builtins/gen/var/smoothstep/40864c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/smoothstep/40864c.wgsl.expected.spvasm new file mode 100644 index 0000000000..b85bcafabc --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/40864c.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %smoothstep_40864c "smoothstep_40864c" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%smoothstep_40864c = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %arg_1 = OpVariable %_ptr_Function_v4float Function %5 + %arg_2 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %5 + OpStore %arg_1 %5 + OpStore %arg_2 %5 + %19 = OpLoad %v4float %arg_0 + %20 = OpLoad %v4float %arg_1 + %21 = OpLoad %v4float %arg_2 + %17 = OpExtInst %v4float %18 SmoothStep %19 %20 %21 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %smoothstep_40864c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %smoothstep_40864c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %smoothstep_40864c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/smoothstep/40864c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/smoothstep/40864c.wgsl.expected.wgsl new file mode 100644 index 0000000000..6fbfc2a183 --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/40864c.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn smoothstep_40864c() { + var arg_0 = vec4(); + var arg_1 = vec4(); + var arg_2 = vec4(); + var res : vec4 = smoothstep(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + smoothstep_40864c(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + smoothstep_40864c(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + smoothstep_40864c(); +} diff --git a/test/tint/builtins/gen/var/smoothstep/6c4975.wgsl b/test/tint/builtins/gen/var/smoothstep/6c4975.wgsl new file mode 100644 index 0000000000..c8483cc491 --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/6c4975.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn smoothstep(f32, f32, f32) -> f32 +fn smoothstep_6c4975() { + var arg_0 = 1.0; + var arg_1 = 1.0; + var arg_2 = 1.0; + var res: f32 = smoothstep(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + smoothstep_6c4975(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + smoothstep_6c4975(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + smoothstep_6c4975(); +} diff --git a/test/tint/builtins/gen/var/smoothstep/6c4975.wgsl.expected.glsl b/test/tint/builtins/gen/var/smoothstep/6c4975.wgsl.expected.glsl new file mode 100644 index 0000000000..13588501c1 --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/6c4975.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void smoothstep_6c4975() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float arg_2 = 1.0f; + float res = smoothstep(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + smoothstep_6c4975(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void smoothstep_6c4975() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float arg_2 = 1.0f; + float res = smoothstep(arg_0, arg_1, arg_2); +} + +void fragment_main() { + smoothstep_6c4975(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void smoothstep_6c4975() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float arg_2 = 1.0f; + float res = smoothstep(arg_0, arg_1, arg_2); +} + +void compute_main() { + smoothstep_6c4975(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/smoothstep/6c4975.wgsl.expected.hlsl b/test/tint/builtins/gen/var/smoothstep/6c4975.wgsl.expected.hlsl new file mode 100644 index 0000000000..b0bcfc6172 --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/6c4975.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +void smoothstep_6c4975() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float arg_2 = 1.0f; + float res = smoothstep(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + smoothstep_6c4975(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + smoothstep_6c4975(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + smoothstep_6c4975(); + return; +} diff --git a/test/tint/builtins/gen/var/smoothstep/6c4975.wgsl.expected.msl b/test/tint/builtins/gen/var/smoothstep/6c4975.wgsl.expected.msl new file mode 100644 index 0000000000..0a4293c6d0 --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/6c4975.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void smoothstep_6c4975() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float arg_2 = 1.0f; + float res = smoothstep(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + smoothstep_6c4975(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + smoothstep_6c4975(); + return; +} + +kernel void compute_main() { + smoothstep_6c4975(); + return; +} + diff --git a/test/tint/builtins/gen/var/smoothstep/6c4975.wgsl.expected.spvasm b/test/tint/builtins/gen/var/smoothstep/6c4975.wgsl.expected.spvasm new file mode 100644 index 0000000000..e82372d29a --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/6c4975.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %smoothstep_6c4975 "smoothstep_6c4975" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %24 = OpTypeFunction %v4float +%smoothstep_6c4975 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %arg_1 = OpVariable %_ptr_Function_float Function %8 + %arg_2 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + OpStore %arg_1 %float_1 + OpStore %arg_2 %float_1 + %20 = OpLoad %float %arg_0 + %21 = OpLoad %float %arg_1 + %22 = OpLoad %float %arg_2 + %18 = OpExtInst %float %19 SmoothStep %20 %21 %22 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %smoothstep_6c4975 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %smoothstep_6c4975 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %smoothstep_6c4975 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/smoothstep/6c4975.wgsl.expected.wgsl b/test/tint/builtins/gen/var/smoothstep/6c4975.wgsl.expected.wgsl new file mode 100644 index 0000000000..ce4b2bccae --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/6c4975.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn smoothstep_6c4975() { + var arg_0 = 1.0; + var arg_1 = 1.0; + var arg_2 = 1.0; + var res : f32 = smoothstep(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + smoothstep_6c4975(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + smoothstep_6c4975(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + smoothstep_6c4975(); +} diff --git a/test/tint/builtins/gen/var/smoothstep/aad1db.wgsl b/test/tint/builtins/gen/var/smoothstep/aad1db.wgsl new file mode 100644 index 0000000000..1efd98fbe5 --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/aad1db.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn smoothstep(vec<3, f32>, vec<3, f32>, vec<3, f32>) -> vec<3, f32> +fn smoothstep_aad1db() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var arg_2 = vec3(); + var res: vec3 = smoothstep(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + smoothstep_aad1db(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + smoothstep_aad1db(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + smoothstep_aad1db(); +} diff --git a/test/tint/builtins/gen/var/smoothstep/aad1db.wgsl.expected.glsl b/test/tint/builtins/gen/var/smoothstep/aad1db.wgsl.expected.glsl new file mode 100644 index 0000000000..ae71ee9c84 --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/aad1db.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void smoothstep_aad1db() { + vec3 arg_0 = vec3(0.0f); + vec3 arg_1 = vec3(0.0f); + vec3 arg_2 = vec3(0.0f); + vec3 res = smoothstep(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + smoothstep_aad1db(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void smoothstep_aad1db() { + vec3 arg_0 = vec3(0.0f); + vec3 arg_1 = vec3(0.0f); + vec3 arg_2 = vec3(0.0f); + vec3 res = smoothstep(arg_0, arg_1, arg_2); +} + +void fragment_main() { + smoothstep_aad1db(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void smoothstep_aad1db() { + vec3 arg_0 = vec3(0.0f); + vec3 arg_1 = vec3(0.0f); + vec3 arg_2 = vec3(0.0f); + vec3 res = smoothstep(arg_0, arg_1, arg_2); +} + +void compute_main() { + smoothstep_aad1db(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/smoothstep/aad1db.wgsl.expected.hlsl b/test/tint/builtins/gen/var/smoothstep/aad1db.wgsl.expected.hlsl new file mode 100644 index 0000000000..c8e7d3e18c --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/aad1db.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +void smoothstep_aad1db() { + float3 arg_0 = (0.0f).xxx; + float3 arg_1 = (0.0f).xxx; + float3 arg_2 = (0.0f).xxx; + float3 res = smoothstep(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + smoothstep_aad1db(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + smoothstep_aad1db(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + smoothstep_aad1db(); + return; +} diff --git a/test/tint/builtins/gen/var/smoothstep/aad1db.wgsl.expected.msl b/test/tint/builtins/gen/var/smoothstep/aad1db.wgsl.expected.msl new file mode 100644 index 0000000000..4f27d5d2e2 --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/aad1db.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void smoothstep_aad1db() { + float3 arg_0 = float3(0.0f); + float3 arg_1 = float3(0.0f); + float3 arg_2 = float3(0.0f); + float3 res = smoothstep(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + smoothstep_aad1db(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + smoothstep_aad1db(); + return; +} + +kernel void compute_main() { + smoothstep_aad1db(); + return; +} + diff --git a/test/tint/builtins/gen/var/smoothstep/aad1db.wgsl.expected.spvasm b/test/tint/builtins/gen/var/smoothstep/aad1db.wgsl.expected.spvasm new file mode 100644 index 0000000000..0fa50776c6 --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/aad1db.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %smoothstep_aad1db "smoothstep_aad1db" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %14 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%smoothstep_aad1db = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %14 + %arg_1 = OpVariable %_ptr_Function_v3float Function %14 + %arg_2 = OpVariable %_ptr_Function_v3float Function %14 + %res = OpVariable %_ptr_Function_v3float Function %14 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + OpStore %arg_2 %14 + %21 = OpLoad %v3float %arg_0 + %22 = OpLoad %v3float %arg_1 + %23 = OpLoad %v3float %arg_2 + %19 = OpExtInst %v3float %20 SmoothStep %21 %22 %23 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %smoothstep_aad1db + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %smoothstep_aad1db + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %smoothstep_aad1db + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/smoothstep/aad1db.wgsl.expected.wgsl b/test/tint/builtins/gen/var/smoothstep/aad1db.wgsl.expected.wgsl new file mode 100644 index 0000000000..6b730b682d --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/aad1db.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn smoothstep_aad1db() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var arg_2 = vec3(); + var res : vec3 = smoothstep(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + smoothstep_aad1db(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + smoothstep_aad1db(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + smoothstep_aad1db(); +} diff --git a/test/tint/builtins/gen/var/sqrt/20c74e.wgsl b/test/tint/builtins/gen/var/sqrt/20c74e.wgsl new file mode 100644 index 0000000000..86b17d6242 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/20c74e.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn sqrt(f32) -> f32 +fn sqrt_20c74e() { + var arg_0 = 1.0; + var res: f32 = sqrt(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + sqrt_20c74e(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + sqrt_20c74e(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + sqrt_20c74e(); +} diff --git a/test/tint/builtins/gen/var/sqrt/20c74e.wgsl.expected.glsl b/test/tint/builtins/gen/var/sqrt/20c74e.wgsl.expected.glsl new file mode 100644 index 0000000000..73ac8a5497 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/20c74e.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void sqrt_20c74e() { + float arg_0 = 1.0f; + float res = sqrt(arg_0); +} + +vec4 vertex_main() { + sqrt_20c74e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void sqrt_20c74e() { + float arg_0 = 1.0f; + float res = sqrt(arg_0); +} + +void fragment_main() { + sqrt_20c74e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void sqrt_20c74e() { + float arg_0 = 1.0f; + float res = sqrt(arg_0); +} + +void compute_main() { + sqrt_20c74e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/sqrt/20c74e.wgsl.expected.hlsl b/test/tint/builtins/gen/var/sqrt/20c74e.wgsl.expected.hlsl new file mode 100644 index 0000000000..6db93fc191 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/20c74e.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void sqrt_20c74e() { + float arg_0 = 1.0f; + float res = sqrt(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sqrt_20c74e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sqrt_20c74e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sqrt_20c74e(); + return; +} diff --git a/test/tint/builtins/gen/var/sqrt/20c74e.wgsl.expected.msl b/test/tint/builtins/gen/var/sqrt/20c74e.wgsl.expected.msl new file mode 100644 index 0000000000..7f9093d554 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/20c74e.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void sqrt_20c74e() { + float arg_0 = 1.0f; + float res = sqrt(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sqrt_20c74e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sqrt_20c74e(); + return; +} + +kernel void compute_main() { + sqrt_20c74e(); + return; +} + diff --git a/test/tint/builtins/gen/var/sqrt/20c74e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sqrt/20c74e.wgsl.expected.spvasm new file mode 100644 index 0000000000..e7b4506003 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/20c74e.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sqrt_20c74e "sqrt_20c74e" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %20 = OpTypeFunction %v4float +%sqrt_20c74e = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + %18 = OpLoad %float %arg_0 + %16 = OpExtInst %float %17 Sqrt %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %sqrt_20c74e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %sqrt_20c74e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %sqrt_20c74e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/sqrt/20c74e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sqrt/20c74e.wgsl.expected.wgsl new file mode 100644 index 0000000000..84e54f4b8d --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/20c74e.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn sqrt_20c74e() { + var arg_0 = 1.0; + var res : f32 = sqrt(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + sqrt_20c74e(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + sqrt_20c74e(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + sqrt_20c74e(); +} diff --git a/test/tint/builtins/gen/var/sqrt/8c7024.wgsl b/test/tint/builtins/gen/var/sqrt/8c7024.wgsl new file mode 100644 index 0000000000..db384b7c45 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/8c7024.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn sqrt(vec<2, f32>) -> vec<2, f32> +fn sqrt_8c7024() { + var arg_0 = vec2(); + var res: vec2 = sqrt(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + sqrt_8c7024(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + sqrt_8c7024(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + sqrt_8c7024(); +} diff --git a/test/tint/builtins/gen/var/sqrt/8c7024.wgsl.expected.glsl b/test/tint/builtins/gen/var/sqrt/8c7024.wgsl.expected.glsl new file mode 100644 index 0000000000..b0ab296793 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/8c7024.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void sqrt_8c7024() { + vec2 arg_0 = vec2(0.0f); + vec2 res = sqrt(arg_0); +} + +vec4 vertex_main() { + sqrt_8c7024(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void sqrt_8c7024() { + vec2 arg_0 = vec2(0.0f); + vec2 res = sqrt(arg_0); +} + +void fragment_main() { + sqrt_8c7024(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void sqrt_8c7024() { + vec2 arg_0 = vec2(0.0f); + vec2 res = sqrt(arg_0); +} + +void compute_main() { + sqrt_8c7024(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/sqrt/8c7024.wgsl.expected.hlsl b/test/tint/builtins/gen/var/sqrt/8c7024.wgsl.expected.hlsl new file mode 100644 index 0000000000..3d8ed56b0c --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/8c7024.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void sqrt_8c7024() { + float2 arg_0 = (0.0f).xx; + float2 res = sqrt(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sqrt_8c7024(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sqrt_8c7024(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sqrt_8c7024(); + return; +} diff --git a/test/tint/builtins/gen/var/sqrt/8c7024.wgsl.expected.msl b/test/tint/builtins/gen/var/sqrt/8c7024.wgsl.expected.msl new file mode 100644 index 0000000000..d829aec5e6 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/8c7024.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void sqrt_8c7024() { + float2 arg_0 = float2(0.0f); + float2 res = sqrt(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sqrt_8c7024(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sqrt_8c7024(); + return; +} + +kernel void compute_main() { + sqrt_8c7024(); + return; +} + diff --git a/test/tint/builtins/gen/var/sqrt/8c7024.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sqrt/8c7024.wgsl.expected.spvasm new file mode 100644 index 0000000000..dcc06b2ac4 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/8c7024.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sqrt_8c7024 "sqrt_8c7024" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %14 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%sqrt_8c7024 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %14 + %res = OpVariable %_ptr_Function_v2float Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %v2float %arg_0 + %17 = OpExtInst %v2float %18 Sqrt %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %sqrt_8c7024 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %sqrt_8c7024 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %sqrt_8c7024 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/sqrt/8c7024.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sqrt/8c7024.wgsl.expected.wgsl new file mode 100644 index 0000000000..4e6fba0a38 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/8c7024.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn sqrt_8c7024() { + var arg_0 = vec2(); + var res : vec2 = sqrt(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + sqrt_8c7024(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + sqrt_8c7024(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + sqrt_8c7024(); +} diff --git a/test/tint/builtins/gen/var/sqrt/aa0d7a.wgsl b/test/tint/builtins/gen/var/sqrt/aa0d7a.wgsl new file mode 100644 index 0000000000..84a347d0c6 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/aa0d7a.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn sqrt(vec<4, f32>) -> vec<4, f32> +fn sqrt_aa0d7a() { + var arg_0 = vec4(); + var res: vec4 = sqrt(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + sqrt_aa0d7a(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + sqrt_aa0d7a(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + sqrt_aa0d7a(); +} diff --git a/test/tint/builtins/gen/var/sqrt/aa0d7a.wgsl.expected.glsl b/test/tint/builtins/gen/var/sqrt/aa0d7a.wgsl.expected.glsl new file mode 100644 index 0000000000..52c73ff3a4 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/aa0d7a.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void sqrt_aa0d7a() { + vec4 arg_0 = vec4(0.0f); + vec4 res = sqrt(arg_0); +} + +vec4 vertex_main() { + sqrt_aa0d7a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void sqrt_aa0d7a() { + vec4 arg_0 = vec4(0.0f); + vec4 res = sqrt(arg_0); +} + +void fragment_main() { + sqrt_aa0d7a(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void sqrt_aa0d7a() { + vec4 arg_0 = vec4(0.0f); + vec4 res = sqrt(arg_0); +} + +void compute_main() { + sqrt_aa0d7a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/sqrt/aa0d7a.wgsl.expected.hlsl b/test/tint/builtins/gen/var/sqrt/aa0d7a.wgsl.expected.hlsl new file mode 100644 index 0000000000..5534c3dd07 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/aa0d7a.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void sqrt_aa0d7a() { + float4 arg_0 = (0.0f).xxxx; + float4 res = sqrt(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sqrt_aa0d7a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sqrt_aa0d7a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sqrt_aa0d7a(); + return; +} diff --git a/test/tint/builtins/gen/var/sqrt/aa0d7a.wgsl.expected.msl b/test/tint/builtins/gen/var/sqrt/aa0d7a.wgsl.expected.msl new file mode 100644 index 0000000000..25da1a7da8 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/aa0d7a.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void sqrt_aa0d7a() { + float4 arg_0 = float4(0.0f); + float4 res = sqrt(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sqrt_aa0d7a(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sqrt_aa0d7a(); + return; +} + +kernel void compute_main() { + sqrt_aa0d7a(); + return; +} + diff --git a/test/tint/builtins/gen/var/sqrt/aa0d7a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sqrt/aa0d7a.wgsl.expected.spvasm new file mode 100644 index 0000000000..62b5d48117 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/aa0d7a.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sqrt_aa0d7a "sqrt_aa0d7a" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%sqrt_aa0d7a = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %5 + %17 = OpLoad %v4float %arg_0 + %15 = OpExtInst %v4float %16 Sqrt %17 + OpStore %res %15 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %sqrt_aa0d7a + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %sqrt_aa0d7a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %sqrt_aa0d7a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/sqrt/aa0d7a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sqrt/aa0d7a.wgsl.expected.wgsl new file mode 100644 index 0000000000..7d32a517b1 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/aa0d7a.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn sqrt_aa0d7a() { + var arg_0 = vec4(); + var res : vec4 = sqrt(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + sqrt_aa0d7a(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + sqrt_aa0d7a(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + sqrt_aa0d7a(); +} diff --git a/test/tint/builtins/gen/var/sqrt/f8c59a.wgsl b/test/tint/builtins/gen/var/sqrt/f8c59a.wgsl new file mode 100644 index 0000000000..16827fbc4a --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/f8c59a.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn sqrt(vec<3, f32>) -> vec<3, f32> +fn sqrt_f8c59a() { + var arg_0 = vec3(); + var res: vec3 = sqrt(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + sqrt_f8c59a(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + sqrt_f8c59a(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + sqrt_f8c59a(); +} diff --git a/test/tint/builtins/gen/var/sqrt/f8c59a.wgsl.expected.glsl b/test/tint/builtins/gen/var/sqrt/f8c59a.wgsl.expected.glsl new file mode 100644 index 0000000000..d62a3b32bf --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/f8c59a.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void sqrt_f8c59a() { + vec3 arg_0 = vec3(0.0f); + vec3 res = sqrt(arg_0); +} + +vec4 vertex_main() { + sqrt_f8c59a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void sqrt_f8c59a() { + vec3 arg_0 = vec3(0.0f); + vec3 res = sqrt(arg_0); +} + +void fragment_main() { + sqrt_f8c59a(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void sqrt_f8c59a() { + vec3 arg_0 = vec3(0.0f); + vec3 res = sqrt(arg_0); +} + +void compute_main() { + sqrt_f8c59a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/sqrt/f8c59a.wgsl.expected.hlsl b/test/tint/builtins/gen/var/sqrt/f8c59a.wgsl.expected.hlsl new file mode 100644 index 0000000000..d57de154ee --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/f8c59a.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void sqrt_f8c59a() { + float3 arg_0 = (0.0f).xxx; + float3 res = sqrt(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sqrt_f8c59a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sqrt_f8c59a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sqrt_f8c59a(); + return; +} diff --git a/test/tint/builtins/gen/var/sqrt/f8c59a.wgsl.expected.msl b/test/tint/builtins/gen/var/sqrt/f8c59a.wgsl.expected.msl new file mode 100644 index 0000000000..4f3289a94e --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/f8c59a.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void sqrt_f8c59a() { + float3 arg_0 = float3(0.0f); + float3 res = sqrt(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sqrt_f8c59a(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sqrt_f8c59a(); + return; +} + +kernel void compute_main() { + sqrt_f8c59a(); + return; +} + diff --git a/test/tint/builtins/gen/var/sqrt/f8c59a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sqrt/f8c59a.wgsl.expected.spvasm new file mode 100644 index 0000000000..ac3f688fe1 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/f8c59a.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sqrt_f8c59a "sqrt_f8c59a" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %14 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%sqrt_f8c59a = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %14 + %res = OpVariable %_ptr_Function_v3float Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %v3float %arg_0 + %17 = OpExtInst %v3float %18 Sqrt %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %sqrt_f8c59a + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %sqrt_f8c59a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %sqrt_f8c59a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/sqrt/f8c59a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sqrt/f8c59a.wgsl.expected.wgsl new file mode 100644 index 0000000000..ff31cee66d --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/f8c59a.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn sqrt_f8c59a() { + var arg_0 = vec3(); + var res : vec3 = sqrt(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + sqrt_f8c59a(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + sqrt_f8c59a(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + sqrt_f8c59a(); +} diff --git a/test/tint/builtins/gen/var/step/0b073b.wgsl b/test/tint/builtins/gen/var/step/0b073b.wgsl new file mode 100644 index 0000000000..815380d206 --- /dev/null +++ b/test/tint/builtins/gen/var/step/0b073b.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn step(f32, f32) -> f32 +fn step_0b073b() { + var arg_0 = 1.0; + var arg_1 = 1.0; + var res: f32 = step(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + step_0b073b(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + step_0b073b(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + step_0b073b(); +} diff --git a/test/tint/builtins/gen/var/step/0b073b.wgsl.expected.glsl b/test/tint/builtins/gen/var/step/0b073b.wgsl.expected.glsl new file mode 100644 index 0000000000..3708760c51 --- /dev/null +++ b/test/tint/builtins/gen/var/step/0b073b.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void step_0b073b() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float res = step(arg_0, arg_1); +} + +vec4 vertex_main() { + step_0b073b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void step_0b073b() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float res = step(arg_0, arg_1); +} + +void fragment_main() { + step_0b073b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void step_0b073b() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float res = step(arg_0, arg_1); +} + +void compute_main() { + step_0b073b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/step/0b073b.wgsl.expected.hlsl b/test/tint/builtins/gen/var/step/0b073b.wgsl.expected.hlsl new file mode 100644 index 0000000000..19c85c99c9 --- /dev/null +++ b/test/tint/builtins/gen/var/step/0b073b.wgsl.expected.hlsl @@ -0,0 +1,32 @@ +void step_0b073b() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float res = step(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + step_0b073b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + step_0b073b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + step_0b073b(); + return; +} diff --git a/test/tint/builtins/gen/var/step/0b073b.wgsl.expected.msl b/test/tint/builtins/gen/var/step/0b073b.wgsl.expected.msl new file mode 100644 index 0000000000..275ddb6091 --- /dev/null +++ b/test/tint/builtins/gen/var/step/0b073b.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void step_0b073b() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float res = step(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + step_0b073b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + step_0b073b(); + return; +} + +kernel void compute_main() { + step_0b073b(); + return; +} + diff --git a/test/tint/builtins/gen/var/step/0b073b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/step/0b073b.wgsl.expected.spvasm new file mode 100644 index 0000000000..a9e8e76f2a --- /dev/null +++ b/test/tint/builtins/gen/var/step/0b073b.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %step_0b073b "step_0b073b" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %22 = OpTypeFunction %v4float +%step_0b073b = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %arg_1 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + OpStore %arg_1 %float_1 + %19 = OpLoad %float %arg_0 + %20 = OpLoad %float %arg_1 + %17 = OpExtInst %float %18 Step %19 %20 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %step_0b073b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %step_0b073b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %step_0b073b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/step/0b073b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/step/0b073b.wgsl.expected.wgsl new file mode 100644 index 0000000000..1c7f7e6649 --- /dev/null +++ b/test/tint/builtins/gen/var/step/0b073b.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn step_0b073b() { + var arg_0 = 1.0; + var arg_1 = 1.0; + var res : f32 = step(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + step_0b073b(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + step_0b073b(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + step_0b073b(); +} diff --git a/test/tint/builtins/gen/var/step/19accd.wgsl b/test/tint/builtins/gen/var/step/19accd.wgsl new file mode 100644 index 0000000000..57a56e2c12 --- /dev/null +++ b/test/tint/builtins/gen/var/step/19accd.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn step(vec<2, f32>, vec<2, f32>) -> vec<2, f32> +fn step_19accd() { + var arg_0 = vec2(); + var arg_1 = vec2(); + var res: vec2 = step(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + step_19accd(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + step_19accd(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + step_19accd(); +} diff --git a/test/tint/builtins/gen/var/step/19accd.wgsl.expected.glsl b/test/tint/builtins/gen/var/step/19accd.wgsl.expected.glsl new file mode 100644 index 0000000000..5d65aabb47 --- /dev/null +++ b/test/tint/builtins/gen/var/step/19accd.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void step_19accd() { + vec2 arg_0 = vec2(0.0f); + vec2 arg_1 = vec2(0.0f); + vec2 res = step(arg_0, arg_1); +} + +vec4 vertex_main() { + step_19accd(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void step_19accd() { + vec2 arg_0 = vec2(0.0f); + vec2 arg_1 = vec2(0.0f); + vec2 res = step(arg_0, arg_1); +} + +void fragment_main() { + step_19accd(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void step_19accd() { + vec2 arg_0 = vec2(0.0f); + vec2 arg_1 = vec2(0.0f); + vec2 res = step(arg_0, arg_1); +} + +void compute_main() { + step_19accd(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/step/19accd.wgsl.expected.hlsl b/test/tint/builtins/gen/var/step/19accd.wgsl.expected.hlsl new file mode 100644 index 0000000000..f94d6d23f4 --- /dev/null +++ b/test/tint/builtins/gen/var/step/19accd.wgsl.expected.hlsl @@ -0,0 +1,32 @@ +void step_19accd() { + float2 arg_0 = (0.0f).xx; + float2 arg_1 = (0.0f).xx; + float2 res = step(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + step_19accd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + step_19accd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + step_19accd(); + return; +} diff --git a/test/tint/builtins/gen/var/step/19accd.wgsl.expected.msl b/test/tint/builtins/gen/var/step/19accd.wgsl.expected.msl new file mode 100644 index 0000000000..e1fbd2dcec --- /dev/null +++ b/test/tint/builtins/gen/var/step/19accd.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void step_19accd() { + float2 arg_0 = float2(0.0f); + float2 arg_1 = float2(0.0f); + float2 res = step(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + step_19accd(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + step_19accd(); + return; +} + +kernel void compute_main() { + step_19accd(); + return; +} + diff --git a/test/tint/builtins/gen/var/step/19accd.wgsl.expected.spvasm b/test/tint/builtins/gen/var/step/19accd.wgsl.expected.spvasm new file mode 100644 index 0000000000..fd5d44919f --- /dev/null +++ b/test/tint/builtins/gen/var/step/19accd.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %step_19accd "step_19accd" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %14 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%step_19accd = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %14 + %arg_1 = OpVariable %_ptr_Function_v2float Function %14 + %res = OpVariable %_ptr_Function_v2float Function %14 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + %20 = OpLoad %v2float %arg_0 + %21 = OpLoad %v2float %arg_1 + %18 = OpExtInst %v2float %19 Step %20 %21 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %step_19accd + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %step_19accd + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %step_19accd + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/step/19accd.wgsl.expected.wgsl b/test/tint/builtins/gen/var/step/19accd.wgsl.expected.wgsl new file mode 100644 index 0000000000..bd11983b5c --- /dev/null +++ b/test/tint/builtins/gen/var/step/19accd.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn step_19accd() { + var arg_0 = vec2(); + var arg_1 = vec2(); + var res : vec2 = step(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + step_19accd(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + step_19accd(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + step_19accd(); +} diff --git a/test/tint/builtins/gen/var/step/334303.wgsl b/test/tint/builtins/gen/var/step/334303.wgsl new file mode 100644 index 0000000000..5bddc72287 --- /dev/null +++ b/test/tint/builtins/gen/var/step/334303.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn step(vec<3, f32>, vec<3, f32>) -> vec<3, f32> +fn step_334303() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var res: vec3 = step(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + step_334303(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + step_334303(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + step_334303(); +} diff --git a/test/tint/builtins/gen/var/step/334303.wgsl.expected.glsl b/test/tint/builtins/gen/var/step/334303.wgsl.expected.glsl new file mode 100644 index 0000000000..46aa17ef5c --- /dev/null +++ b/test/tint/builtins/gen/var/step/334303.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void step_334303() { + vec3 arg_0 = vec3(0.0f); + vec3 arg_1 = vec3(0.0f); + vec3 res = step(arg_0, arg_1); +} + +vec4 vertex_main() { + step_334303(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void step_334303() { + vec3 arg_0 = vec3(0.0f); + vec3 arg_1 = vec3(0.0f); + vec3 res = step(arg_0, arg_1); +} + +void fragment_main() { + step_334303(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void step_334303() { + vec3 arg_0 = vec3(0.0f); + vec3 arg_1 = vec3(0.0f); + vec3 res = step(arg_0, arg_1); +} + +void compute_main() { + step_334303(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/step/334303.wgsl.expected.hlsl b/test/tint/builtins/gen/var/step/334303.wgsl.expected.hlsl new file mode 100644 index 0000000000..df6ff2ace5 --- /dev/null +++ b/test/tint/builtins/gen/var/step/334303.wgsl.expected.hlsl @@ -0,0 +1,32 @@ +void step_334303() { + float3 arg_0 = (0.0f).xxx; + float3 arg_1 = (0.0f).xxx; + float3 res = step(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + step_334303(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + step_334303(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + step_334303(); + return; +} diff --git a/test/tint/builtins/gen/var/step/334303.wgsl.expected.msl b/test/tint/builtins/gen/var/step/334303.wgsl.expected.msl new file mode 100644 index 0000000000..8deefd84cf --- /dev/null +++ b/test/tint/builtins/gen/var/step/334303.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void step_334303() { + float3 arg_0 = float3(0.0f); + float3 arg_1 = float3(0.0f); + float3 res = step(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + step_334303(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + step_334303(); + return; +} + +kernel void compute_main() { + step_334303(); + return; +} + diff --git a/test/tint/builtins/gen/var/step/334303.wgsl.expected.spvasm b/test/tint/builtins/gen/var/step/334303.wgsl.expected.spvasm new file mode 100644 index 0000000000..37a7b9d1cf --- /dev/null +++ b/test/tint/builtins/gen/var/step/334303.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %step_334303 "step_334303" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %14 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%step_334303 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %14 + %arg_1 = OpVariable %_ptr_Function_v3float Function %14 + %res = OpVariable %_ptr_Function_v3float Function %14 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + %20 = OpLoad %v3float %arg_0 + %21 = OpLoad %v3float %arg_1 + %18 = OpExtInst %v3float %19 Step %20 %21 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %step_334303 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %step_334303 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %step_334303 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/step/334303.wgsl.expected.wgsl b/test/tint/builtins/gen/var/step/334303.wgsl.expected.wgsl new file mode 100644 index 0000000000..71667c3bb6 --- /dev/null +++ b/test/tint/builtins/gen/var/step/334303.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn step_334303() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var res : vec3 = step(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + step_334303(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + step_334303(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + step_334303(); +} diff --git a/test/tint/builtins/gen/var/step/e2b337.wgsl b/test/tint/builtins/gen/var/step/e2b337.wgsl new file mode 100644 index 0000000000..1aa6b52b92 --- /dev/null +++ b/test/tint/builtins/gen/var/step/e2b337.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn step(vec<4, f32>, vec<4, f32>) -> vec<4, f32> +fn step_e2b337() { + var arg_0 = vec4(); + var arg_1 = vec4(); + var res: vec4 = step(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + step_e2b337(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + step_e2b337(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + step_e2b337(); +} diff --git a/test/tint/builtins/gen/var/step/e2b337.wgsl.expected.glsl b/test/tint/builtins/gen/var/step/e2b337.wgsl.expected.glsl new file mode 100644 index 0000000000..ac7f19ff3c --- /dev/null +++ b/test/tint/builtins/gen/var/step/e2b337.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void step_e2b337() { + vec4 arg_0 = vec4(0.0f); + vec4 arg_1 = vec4(0.0f); + vec4 res = step(arg_0, arg_1); +} + +vec4 vertex_main() { + step_e2b337(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void step_e2b337() { + vec4 arg_0 = vec4(0.0f); + vec4 arg_1 = vec4(0.0f); + vec4 res = step(arg_0, arg_1); +} + +void fragment_main() { + step_e2b337(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void step_e2b337() { + vec4 arg_0 = vec4(0.0f); + vec4 arg_1 = vec4(0.0f); + vec4 res = step(arg_0, arg_1); +} + +void compute_main() { + step_e2b337(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/step/e2b337.wgsl.expected.hlsl b/test/tint/builtins/gen/var/step/e2b337.wgsl.expected.hlsl new file mode 100644 index 0000000000..94366a619a --- /dev/null +++ b/test/tint/builtins/gen/var/step/e2b337.wgsl.expected.hlsl @@ -0,0 +1,32 @@ +void step_e2b337() { + float4 arg_0 = (0.0f).xxxx; + float4 arg_1 = (0.0f).xxxx; + float4 res = step(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + step_e2b337(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + step_e2b337(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + step_e2b337(); + return; +} diff --git a/test/tint/builtins/gen/var/step/e2b337.wgsl.expected.msl b/test/tint/builtins/gen/var/step/e2b337.wgsl.expected.msl new file mode 100644 index 0000000000..8ec4bc3935 --- /dev/null +++ b/test/tint/builtins/gen/var/step/e2b337.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void step_e2b337() { + float4 arg_0 = float4(0.0f); + float4 arg_1 = float4(0.0f); + float4 res = step(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + step_e2b337(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + step_e2b337(); + return; +} + +kernel void compute_main() { + step_e2b337(); + return; +} + diff --git a/test/tint/builtins/gen/var/step/e2b337.wgsl.expected.spvasm b/test/tint/builtins/gen/var/step/e2b337.wgsl.expected.spvasm new file mode 100644 index 0000000000..c97dcc734d --- /dev/null +++ b/test/tint/builtins/gen/var/step/e2b337.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %step_e2b337 "step_e2b337" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%step_e2b337 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %arg_1 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %5 + OpStore %arg_1 %5 + %18 = OpLoad %v4float %arg_0 + %19 = OpLoad %v4float %arg_1 + %16 = OpExtInst %v4float %17 Step %18 %19 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %step_e2b337 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %step_e2b337 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %step_e2b337 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/step/e2b337.wgsl.expected.wgsl b/test/tint/builtins/gen/var/step/e2b337.wgsl.expected.wgsl new file mode 100644 index 0000000000..370bb45c7d --- /dev/null +++ b/test/tint/builtins/gen/var/step/e2b337.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn step_e2b337() { + var arg_0 = vec4(); + var arg_1 = vec4(); + var res : vec4 = step(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + step_e2b337(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + step_e2b337(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + step_e2b337(); +} diff --git a/test/tint/builtins/gen/var/storageBarrier/d87211.wgsl b/test/tint/builtins/gen/var/storageBarrier/d87211.wgsl new file mode 100644 index 0000000000..5306f6c3bc --- /dev/null +++ b/test/tint/builtins/gen/var/storageBarrier/d87211.wgsl @@ -0,0 +1,34 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn storageBarrier() +fn storageBarrier_d87211() { + storageBarrier(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + storageBarrier_d87211(); +} diff --git a/test/tint/builtins/gen/var/storageBarrier/d87211.wgsl.expected.glsl b/test/tint/builtins/gen/var/storageBarrier/d87211.wgsl.expected.glsl new file mode 100644 index 0000000000..025e85c90d --- /dev/null +++ b/test/tint/builtins/gen/var/storageBarrier/d87211.wgsl.expected.glsl @@ -0,0 +1,15 @@ +#version 310 es + +void storageBarrier_d87211() { + { barrier(); memoryBarrierBuffer(); }; +} + +void compute_main() { + storageBarrier_d87211(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/storageBarrier/d87211.wgsl.expected.hlsl b/test/tint/builtins/gen/var/storageBarrier/d87211.wgsl.expected.hlsl new file mode 100644 index 0000000000..8fb7cf9462 --- /dev/null +++ b/test/tint/builtins/gen/var/storageBarrier/d87211.wgsl.expected.hlsl @@ -0,0 +1,9 @@ +void storageBarrier_d87211() { + DeviceMemoryBarrierWithGroupSync(); +} + +[numthreads(1, 1, 1)] +void compute_main() { + storageBarrier_d87211(); + return; +} diff --git a/test/tint/builtins/gen/var/storageBarrier/d87211.wgsl.expected.msl b/test/tint/builtins/gen/var/storageBarrier/d87211.wgsl.expected.msl new file mode 100644 index 0000000000..53da7477a2 --- /dev/null +++ b/test/tint/builtins/gen/var/storageBarrier/d87211.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +void storageBarrier_d87211() { + threadgroup_barrier(mem_flags::mem_device); +} + +kernel void compute_main() { + storageBarrier_d87211(); + return; +} + diff --git a/test/tint/builtins/gen/var/storageBarrier/d87211.wgsl.expected.spvasm b/test/tint/builtins/gen/var/storageBarrier/d87211.wgsl.expected.spvasm new file mode 100644 index 0000000000..79f2372a0d --- /dev/null +++ b/test/tint/builtins/gen/var/storageBarrier/d87211.wgsl.expected.spvasm @@ -0,0 +1,26 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 12 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %storageBarrier_d87211 "storageBarrier_d87211" + OpName %compute_main "compute_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 + %uint_72 = OpConstant %uint 72 +%storageBarrier_d87211 = OpFunction %void None %1 + %4 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_72 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %1 + %10 = OpLabel + %11 = OpFunctionCall %void %storageBarrier_d87211 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/storageBarrier/d87211.wgsl.expected.wgsl b/test/tint/builtins/gen/var/storageBarrier/d87211.wgsl.expected.wgsl new file mode 100644 index 0000000000..4c87708134 --- /dev/null +++ b/test/tint/builtins/gen/var/storageBarrier/d87211.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +fn storageBarrier_d87211() { + storageBarrier(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + storageBarrier_d87211(); +} diff --git a/test/tint/builtins/gen/var/tan/244e2a.wgsl b/test/tint/builtins/gen/var/tan/244e2a.wgsl new file mode 100644 index 0000000000..a124869df8 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/244e2a.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn tan(vec<4, f32>) -> vec<4, f32> +fn tan_244e2a() { + var arg_0 = vec4(); + var res: vec4 = tan(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + tan_244e2a(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + tan_244e2a(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + tan_244e2a(); +} diff --git a/test/tint/builtins/gen/var/tan/244e2a.wgsl.expected.glsl b/test/tint/builtins/gen/var/tan/244e2a.wgsl.expected.glsl new file mode 100644 index 0000000000..69b815683a --- /dev/null +++ b/test/tint/builtins/gen/var/tan/244e2a.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void tan_244e2a() { + vec4 arg_0 = vec4(0.0f); + vec4 res = tan(arg_0); +} + +vec4 vertex_main() { + tan_244e2a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void tan_244e2a() { + vec4 arg_0 = vec4(0.0f); + vec4 res = tan(arg_0); +} + +void fragment_main() { + tan_244e2a(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void tan_244e2a() { + vec4 arg_0 = vec4(0.0f); + vec4 res = tan(arg_0); +} + +void compute_main() { + tan_244e2a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/tan/244e2a.wgsl.expected.hlsl b/test/tint/builtins/gen/var/tan/244e2a.wgsl.expected.hlsl new file mode 100644 index 0000000000..bec2384f9e --- /dev/null +++ b/test/tint/builtins/gen/var/tan/244e2a.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void tan_244e2a() { + float4 arg_0 = (0.0f).xxxx; + float4 res = tan(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tan_244e2a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tan_244e2a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tan_244e2a(); + return; +} diff --git a/test/tint/builtins/gen/var/tan/244e2a.wgsl.expected.msl b/test/tint/builtins/gen/var/tan/244e2a.wgsl.expected.msl new file mode 100644 index 0000000000..8d4d8a6dfa --- /dev/null +++ b/test/tint/builtins/gen/var/tan/244e2a.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void tan_244e2a() { + float4 arg_0 = float4(0.0f); + float4 res = tan(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + tan_244e2a(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + tan_244e2a(); + return; +} + +kernel void compute_main() { + tan_244e2a(); + return; +} + diff --git a/test/tint/builtins/gen/var/tan/244e2a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/tan/244e2a.wgsl.expected.spvasm new file mode 100644 index 0000000000..c36cf98572 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/244e2a.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tan_244e2a "tan_244e2a" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %tan_244e2a = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %5 + %17 = OpLoad %v4float %arg_0 + %15 = OpExtInst %v4float %16 Tan %17 + OpStore %res %15 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %tan_244e2a + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %tan_244e2a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %tan_244e2a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/tan/244e2a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/tan/244e2a.wgsl.expected.wgsl new file mode 100644 index 0000000000..35bfc66db9 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/244e2a.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn tan_244e2a() { + var arg_0 = vec4(); + var res : vec4 = tan(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + tan_244e2a(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + tan_244e2a(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + tan_244e2a(); +} diff --git a/test/tint/builtins/gen/var/tan/2f030e.wgsl b/test/tint/builtins/gen/var/tan/2f030e.wgsl new file mode 100644 index 0000000000..2cdb41f2d3 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/2f030e.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn tan(f32) -> f32 +fn tan_2f030e() { + var arg_0 = 1.0; + var res: f32 = tan(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + tan_2f030e(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + tan_2f030e(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + tan_2f030e(); +} diff --git a/test/tint/builtins/gen/var/tan/2f030e.wgsl.expected.glsl b/test/tint/builtins/gen/var/tan/2f030e.wgsl.expected.glsl new file mode 100644 index 0000000000..5075b832a7 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/2f030e.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void tan_2f030e() { + float arg_0 = 1.0f; + float res = tan(arg_0); +} + +vec4 vertex_main() { + tan_2f030e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void tan_2f030e() { + float arg_0 = 1.0f; + float res = tan(arg_0); +} + +void fragment_main() { + tan_2f030e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void tan_2f030e() { + float arg_0 = 1.0f; + float res = tan(arg_0); +} + +void compute_main() { + tan_2f030e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/tan/2f030e.wgsl.expected.hlsl b/test/tint/builtins/gen/var/tan/2f030e.wgsl.expected.hlsl new file mode 100644 index 0000000000..b3863b59f3 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/2f030e.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void tan_2f030e() { + float arg_0 = 1.0f; + float res = tan(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tan_2f030e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tan_2f030e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tan_2f030e(); + return; +} diff --git a/test/tint/builtins/gen/var/tan/2f030e.wgsl.expected.msl b/test/tint/builtins/gen/var/tan/2f030e.wgsl.expected.msl new file mode 100644 index 0000000000..ca719b5d27 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/2f030e.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void tan_2f030e() { + float arg_0 = 1.0f; + float res = tan(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + tan_2f030e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + tan_2f030e(); + return; +} + +kernel void compute_main() { + tan_2f030e(); + return; +} + diff --git a/test/tint/builtins/gen/var/tan/2f030e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/tan/2f030e.wgsl.expected.spvasm new file mode 100644 index 0000000000..57d1c9b9b4 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/2f030e.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tan_2f030e "tan_2f030e" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %20 = OpTypeFunction %v4float + %tan_2f030e = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + %18 = OpLoad %float %arg_0 + %16 = OpExtInst %float %17 Tan %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %tan_2f030e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %tan_2f030e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %tan_2f030e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/tan/2f030e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/tan/2f030e.wgsl.expected.wgsl new file mode 100644 index 0000000000..fac48492cc --- /dev/null +++ b/test/tint/builtins/gen/var/tan/2f030e.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn tan_2f030e() { + var arg_0 = 1.0; + var res : f32 = tan(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + tan_2f030e(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + tan_2f030e(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + tan_2f030e(); +} diff --git a/test/tint/builtins/gen/var/tan/7ea104.wgsl b/test/tint/builtins/gen/var/tan/7ea104.wgsl new file mode 100644 index 0000000000..220629ca55 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/7ea104.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn tan(vec<3, f32>) -> vec<3, f32> +fn tan_7ea104() { + var arg_0 = vec3(); + var res: vec3 = tan(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + tan_7ea104(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + tan_7ea104(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + tan_7ea104(); +} diff --git a/test/tint/builtins/gen/var/tan/7ea104.wgsl.expected.glsl b/test/tint/builtins/gen/var/tan/7ea104.wgsl.expected.glsl new file mode 100644 index 0000000000..61146c9de6 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/7ea104.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void tan_7ea104() { + vec3 arg_0 = vec3(0.0f); + vec3 res = tan(arg_0); +} + +vec4 vertex_main() { + tan_7ea104(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void tan_7ea104() { + vec3 arg_0 = vec3(0.0f); + vec3 res = tan(arg_0); +} + +void fragment_main() { + tan_7ea104(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void tan_7ea104() { + vec3 arg_0 = vec3(0.0f); + vec3 res = tan(arg_0); +} + +void compute_main() { + tan_7ea104(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/tan/7ea104.wgsl.expected.hlsl b/test/tint/builtins/gen/var/tan/7ea104.wgsl.expected.hlsl new file mode 100644 index 0000000000..1dec135b54 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/7ea104.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void tan_7ea104() { + float3 arg_0 = (0.0f).xxx; + float3 res = tan(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tan_7ea104(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tan_7ea104(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tan_7ea104(); + return; +} diff --git a/test/tint/builtins/gen/var/tan/7ea104.wgsl.expected.msl b/test/tint/builtins/gen/var/tan/7ea104.wgsl.expected.msl new file mode 100644 index 0000000000..8edef08595 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/7ea104.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void tan_7ea104() { + float3 arg_0 = float3(0.0f); + float3 res = tan(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + tan_7ea104(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + tan_7ea104(); + return; +} + +kernel void compute_main() { + tan_7ea104(); + return; +} + diff --git a/test/tint/builtins/gen/var/tan/7ea104.wgsl.expected.spvasm b/test/tint/builtins/gen/var/tan/7ea104.wgsl.expected.spvasm new file mode 100644 index 0000000000..da69cee76a --- /dev/null +++ b/test/tint/builtins/gen/var/tan/7ea104.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tan_7ea104 "tan_7ea104" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %14 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %tan_7ea104 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %14 + %res = OpVariable %_ptr_Function_v3float Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %v3float %arg_0 + %17 = OpExtInst %v3float %18 Tan %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %tan_7ea104 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %tan_7ea104 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %tan_7ea104 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/tan/7ea104.wgsl.expected.wgsl b/test/tint/builtins/gen/var/tan/7ea104.wgsl.expected.wgsl new file mode 100644 index 0000000000..dc85409727 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/7ea104.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn tan_7ea104() { + var arg_0 = vec3(); + var res : vec3 = tan(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + tan_7ea104(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + tan_7ea104(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + tan_7ea104(); +} diff --git a/test/tint/builtins/gen/var/tan/8ce3e9.wgsl b/test/tint/builtins/gen/var/tan/8ce3e9.wgsl new file mode 100644 index 0000000000..8a415d1301 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/8ce3e9.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn tan(vec<2, f32>) -> vec<2, f32> +fn tan_8ce3e9() { + var arg_0 = vec2(); + var res: vec2 = tan(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + tan_8ce3e9(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + tan_8ce3e9(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + tan_8ce3e9(); +} diff --git a/test/tint/builtins/gen/var/tan/8ce3e9.wgsl.expected.glsl b/test/tint/builtins/gen/var/tan/8ce3e9.wgsl.expected.glsl new file mode 100644 index 0000000000..211831f598 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/8ce3e9.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void tan_8ce3e9() { + vec2 arg_0 = vec2(0.0f); + vec2 res = tan(arg_0); +} + +vec4 vertex_main() { + tan_8ce3e9(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void tan_8ce3e9() { + vec2 arg_0 = vec2(0.0f); + vec2 res = tan(arg_0); +} + +void fragment_main() { + tan_8ce3e9(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void tan_8ce3e9() { + vec2 arg_0 = vec2(0.0f); + vec2 res = tan(arg_0); +} + +void compute_main() { + tan_8ce3e9(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/tan/8ce3e9.wgsl.expected.hlsl b/test/tint/builtins/gen/var/tan/8ce3e9.wgsl.expected.hlsl new file mode 100644 index 0000000000..935530ef2f --- /dev/null +++ b/test/tint/builtins/gen/var/tan/8ce3e9.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void tan_8ce3e9() { + float2 arg_0 = (0.0f).xx; + float2 res = tan(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tan_8ce3e9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tan_8ce3e9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tan_8ce3e9(); + return; +} diff --git a/test/tint/builtins/gen/var/tan/8ce3e9.wgsl.expected.msl b/test/tint/builtins/gen/var/tan/8ce3e9.wgsl.expected.msl new file mode 100644 index 0000000000..4584e1add8 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/8ce3e9.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void tan_8ce3e9() { + float2 arg_0 = float2(0.0f); + float2 res = tan(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + tan_8ce3e9(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + tan_8ce3e9(); + return; +} + +kernel void compute_main() { + tan_8ce3e9(); + return; +} + diff --git a/test/tint/builtins/gen/var/tan/8ce3e9.wgsl.expected.spvasm b/test/tint/builtins/gen/var/tan/8ce3e9.wgsl.expected.spvasm new file mode 100644 index 0000000000..20a817e1d5 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/8ce3e9.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tan_8ce3e9 "tan_8ce3e9" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %14 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %tan_8ce3e9 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %14 + %res = OpVariable %_ptr_Function_v2float Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %v2float %arg_0 + %17 = OpExtInst %v2float %18 Tan %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %tan_8ce3e9 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %tan_8ce3e9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %tan_8ce3e9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/tan/8ce3e9.wgsl.expected.wgsl b/test/tint/builtins/gen/var/tan/8ce3e9.wgsl.expected.wgsl new file mode 100644 index 0000000000..4fef31c88e --- /dev/null +++ b/test/tint/builtins/gen/var/tan/8ce3e9.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn tan_8ce3e9() { + var arg_0 = vec2(); + var res : vec2 = tan(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + tan_8ce3e9(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + tan_8ce3e9(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + tan_8ce3e9(); +} diff --git a/test/tint/builtins/gen/var/tanh/5663c5.wgsl b/test/tint/builtins/gen/var/tanh/5663c5.wgsl new file mode 100644 index 0000000000..f13674259c --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/5663c5.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn tanh(vec<4, f32>) -> vec<4, f32> +fn tanh_5663c5() { + var arg_0 = vec4(); + var res: vec4 = tanh(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + tanh_5663c5(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + tanh_5663c5(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + tanh_5663c5(); +} diff --git a/test/tint/builtins/gen/var/tanh/5663c5.wgsl.expected.glsl b/test/tint/builtins/gen/var/tanh/5663c5.wgsl.expected.glsl new file mode 100644 index 0000000000..cfa078331a --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/5663c5.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void tanh_5663c5() { + vec4 arg_0 = vec4(0.0f); + vec4 res = tanh(arg_0); +} + +vec4 vertex_main() { + tanh_5663c5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void tanh_5663c5() { + vec4 arg_0 = vec4(0.0f); + vec4 res = tanh(arg_0); +} + +void fragment_main() { + tanh_5663c5(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void tanh_5663c5() { + vec4 arg_0 = vec4(0.0f); + vec4 res = tanh(arg_0); +} + +void compute_main() { + tanh_5663c5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/tanh/5663c5.wgsl.expected.hlsl b/test/tint/builtins/gen/var/tanh/5663c5.wgsl.expected.hlsl new file mode 100644 index 0000000000..3860bf4586 --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/5663c5.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void tanh_5663c5() { + float4 arg_0 = (0.0f).xxxx; + float4 res = tanh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tanh_5663c5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tanh_5663c5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tanh_5663c5(); + return; +} diff --git a/test/tint/builtins/gen/var/tanh/5663c5.wgsl.expected.msl b/test/tint/builtins/gen/var/tanh/5663c5.wgsl.expected.msl new file mode 100644 index 0000000000..7e0c6cb852 --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/5663c5.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void tanh_5663c5() { + float4 arg_0 = float4(0.0f); + float4 res = tanh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + tanh_5663c5(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + tanh_5663c5(); + return; +} + +kernel void compute_main() { + tanh_5663c5(); + return; +} + diff --git a/test/tint/builtins/gen/var/tanh/5663c5.wgsl.expected.spvasm b/test/tint/builtins/gen/var/tanh/5663c5.wgsl.expected.spvasm new file mode 100644 index 0000000000..8cad240431 --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/5663c5.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tanh_5663c5 "tanh_5663c5" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tanh_5663c5 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %5 + %17 = OpLoad %v4float %arg_0 + %15 = OpExtInst %v4float %16 Tanh %17 + OpStore %res %15 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %tanh_5663c5 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %tanh_5663c5 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %tanh_5663c5 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/tanh/5663c5.wgsl.expected.wgsl b/test/tint/builtins/gen/var/tanh/5663c5.wgsl.expected.wgsl new file mode 100644 index 0000000000..68b3e225a8 --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/5663c5.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn tanh_5663c5() { + var arg_0 = vec4(); + var res : vec4 = tanh(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + tanh_5663c5(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + tanh_5663c5(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + tanh_5663c5(); +} diff --git a/test/tint/builtins/gen/var/tanh/5724b3.wgsl b/test/tint/builtins/gen/var/tanh/5724b3.wgsl new file mode 100644 index 0000000000..a09c5dc564 --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/5724b3.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn tanh(vec<2, f32>) -> vec<2, f32> +fn tanh_5724b3() { + var arg_0 = vec2(); + var res: vec2 = tanh(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + tanh_5724b3(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + tanh_5724b3(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + tanh_5724b3(); +} diff --git a/test/tint/builtins/gen/var/tanh/5724b3.wgsl.expected.glsl b/test/tint/builtins/gen/var/tanh/5724b3.wgsl.expected.glsl new file mode 100644 index 0000000000..febcb148a7 --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/5724b3.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void tanh_5724b3() { + vec2 arg_0 = vec2(0.0f); + vec2 res = tanh(arg_0); +} + +vec4 vertex_main() { + tanh_5724b3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void tanh_5724b3() { + vec2 arg_0 = vec2(0.0f); + vec2 res = tanh(arg_0); +} + +void fragment_main() { + tanh_5724b3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void tanh_5724b3() { + vec2 arg_0 = vec2(0.0f); + vec2 res = tanh(arg_0); +} + +void compute_main() { + tanh_5724b3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/tanh/5724b3.wgsl.expected.hlsl b/test/tint/builtins/gen/var/tanh/5724b3.wgsl.expected.hlsl new file mode 100644 index 0000000000..be9254c249 --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/5724b3.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void tanh_5724b3() { + float2 arg_0 = (0.0f).xx; + float2 res = tanh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tanh_5724b3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tanh_5724b3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tanh_5724b3(); + return; +} diff --git a/test/tint/builtins/gen/var/tanh/5724b3.wgsl.expected.msl b/test/tint/builtins/gen/var/tanh/5724b3.wgsl.expected.msl new file mode 100644 index 0000000000..d384399514 --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/5724b3.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void tanh_5724b3() { + float2 arg_0 = float2(0.0f); + float2 res = tanh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + tanh_5724b3(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + tanh_5724b3(); + return; +} + +kernel void compute_main() { + tanh_5724b3(); + return; +} + diff --git a/test/tint/builtins/gen/var/tanh/5724b3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/tanh/5724b3.wgsl.expected.spvasm new file mode 100644 index 0000000000..a30467b9cc --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/5724b3.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tanh_5724b3 "tanh_5724b3" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %14 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tanh_5724b3 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %14 + %res = OpVariable %_ptr_Function_v2float Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %v2float %arg_0 + %17 = OpExtInst %v2float %18 Tanh %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %tanh_5724b3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %tanh_5724b3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %tanh_5724b3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/tanh/5724b3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/tanh/5724b3.wgsl.expected.wgsl new file mode 100644 index 0000000000..4ba6039fd1 --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/5724b3.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn tanh_5724b3() { + var arg_0 = vec2(); + var res : vec2 = tanh(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + tanh_5724b3(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + tanh_5724b3(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + tanh_5724b3(); +} diff --git a/test/tint/builtins/gen/var/tanh/9f9fb9.wgsl b/test/tint/builtins/gen/var/tanh/9f9fb9.wgsl new file mode 100644 index 0000000000..3ef2e2f93f --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/9f9fb9.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn tanh(vec<3, f32>) -> vec<3, f32> +fn tanh_9f9fb9() { + var arg_0 = vec3(); + var res: vec3 = tanh(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + tanh_9f9fb9(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + tanh_9f9fb9(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + tanh_9f9fb9(); +} diff --git a/test/tint/builtins/gen/var/tanh/9f9fb9.wgsl.expected.glsl b/test/tint/builtins/gen/var/tanh/9f9fb9.wgsl.expected.glsl new file mode 100644 index 0000000000..15f66f7225 --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/9f9fb9.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void tanh_9f9fb9() { + vec3 arg_0 = vec3(0.0f); + vec3 res = tanh(arg_0); +} + +vec4 vertex_main() { + tanh_9f9fb9(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void tanh_9f9fb9() { + vec3 arg_0 = vec3(0.0f); + vec3 res = tanh(arg_0); +} + +void fragment_main() { + tanh_9f9fb9(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void tanh_9f9fb9() { + vec3 arg_0 = vec3(0.0f); + vec3 res = tanh(arg_0); +} + +void compute_main() { + tanh_9f9fb9(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/tanh/9f9fb9.wgsl.expected.hlsl b/test/tint/builtins/gen/var/tanh/9f9fb9.wgsl.expected.hlsl new file mode 100644 index 0000000000..2687494dd6 --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/9f9fb9.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void tanh_9f9fb9() { + float3 arg_0 = (0.0f).xxx; + float3 res = tanh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tanh_9f9fb9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tanh_9f9fb9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tanh_9f9fb9(); + return; +} diff --git a/test/tint/builtins/gen/var/tanh/9f9fb9.wgsl.expected.msl b/test/tint/builtins/gen/var/tanh/9f9fb9.wgsl.expected.msl new file mode 100644 index 0000000000..4e5e4a3eab --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/9f9fb9.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void tanh_9f9fb9() { + float3 arg_0 = float3(0.0f); + float3 res = tanh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + tanh_9f9fb9(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + tanh_9f9fb9(); + return; +} + +kernel void compute_main() { + tanh_9f9fb9(); + return; +} + diff --git a/test/tint/builtins/gen/var/tanh/9f9fb9.wgsl.expected.spvasm b/test/tint/builtins/gen/var/tanh/9f9fb9.wgsl.expected.spvasm new file mode 100644 index 0000000000..2e2d6bc622 --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/9f9fb9.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tanh_9f9fb9 "tanh_9f9fb9" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %14 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tanh_9f9fb9 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %14 + %res = OpVariable %_ptr_Function_v3float Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %v3float %arg_0 + %17 = OpExtInst %v3float %18 Tanh %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %tanh_9f9fb9 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %tanh_9f9fb9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %tanh_9f9fb9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/tanh/9f9fb9.wgsl.expected.wgsl b/test/tint/builtins/gen/var/tanh/9f9fb9.wgsl.expected.wgsl new file mode 100644 index 0000000000..2cf169fb2c --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/9f9fb9.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn tanh_9f9fb9() { + var arg_0 = vec3(); + var res : vec3 = tanh(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + tanh_9f9fb9(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + tanh_9f9fb9(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + tanh_9f9fb9(); +} diff --git a/test/tint/builtins/gen/var/tanh/c15fdb.wgsl b/test/tint/builtins/gen/var/tanh/c15fdb.wgsl new file mode 100644 index 0000000000..a0e4a5b60a --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/c15fdb.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn tanh(f32) -> f32 +fn tanh_c15fdb() { + var arg_0 = 1.0; + var res: f32 = tanh(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + tanh_c15fdb(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + tanh_c15fdb(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + tanh_c15fdb(); +} diff --git a/test/tint/builtins/gen/var/tanh/c15fdb.wgsl.expected.glsl b/test/tint/builtins/gen/var/tanh/c15fdb.wgsl.expected.glsl new file mode 100644 index 0000000000..5682daf5bb --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/c15fdb.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void tanh_c15fdb() { + float arg_0 = 1.0f; + float res = tanh(arg_0); +} + +vec4 vertex_main() { + tanh_c15fdb(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void tanh_c15fdb() { + float arg_0 = 1.0f; + float res = tanh(arg_0); +} + +void fragment_main() { + tanh_c15fdb(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void tanh_c15fdb() { + float arg_0 = 1.0f; + float res = tanh(arg_0); +} + +void compute_main() { + tanh_c15fdb(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/tanh/c15fdb.wgsl.expected.hlsl b/test/tint/builtins/gen/var/tanh/c15fdb.wgsl.expected.hlsl new file mode 100644 index 0000000000..38d4981b80 --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/c15fdb.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void tanh_c15fdb() { + float arg_0 = 1.0f; + float res = tanh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tanh_c15fdb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tanh_c15fdb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tanh_c15fdb(); + return; +} diff --git a/test/tint/builtins/gen/var/tanh/c15fdb.wgsl.expected.msl b/test/tint/builtins/gen/var/tanh/c15fdb.wgsl.expected.msl new file mode 100644 index 0000000000..81b49244b9 --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/c15fdb.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void tanh_c15fdb() { + float arg_0 = 1.0f; + float res = tanh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + tanh_c15fdb(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + tanh_c15fdb(); + return; +} + +kernel void compute_main() { + tanh_c15fdb(); + return; +} + diff --git a/test/tint/builtins/gen/var/tanh/c15fdb.wgsl.expected.spvasm b/test/tint/builtins/gen/var/tanh/c15fdb.wgsl.expected.spvasm new file mode 100644 index 0000000000..8722def7cc --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/c15fdb.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tanh_c15fdb "tanh_c15fdb" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %20 = OpTypeFunction %v4float +%tanh_c15fdb = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + %18 = OpLoad %float %arg_0 + %16 = OpExtInst %float %17 Tanh %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %tanh_c15fdb + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %tanh_c15fdb + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %tanh_c15fdb + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/tanh/c15fdb.wgsl.expected.wgsl b/test/tint/builtins/gen/var/tanh/c15fdb.wgsl.expected.wgsl new file mode 100644 index 0000000000..0831fee28b --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/c15fdb.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn tanh_c15fdb() { + var arg_0 = 1.0; + var res : f32 = tanh(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + tanh_c15fdb(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + tanh_c15fdb(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + tanh_c15fdb(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/002b2a.wgsl b/test/tint/builtins/gen/var/textureDimensions/002b2a.wgsl new file mode 100644 index 0000000000..b93721f74c --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/002b2a.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_1d; + +// fn textureDimensions(texture: texture_1d) -> i32 +fn textureDimensions_002b2a() { + var res: i32 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_002b2a(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_002b2a(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_002b2a(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/002b2a.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/002b2a.wgsl.expected.glsl new file mode 100644 index 0000000000..9ee3490e43 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/002b2a.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +uniform highp sampler1D arg_0_1; +void textureDimensions_002b2a() { + int res = textureSize(arg_0_1, 0); +} + +vec4 vertex_main() { + textureDimensions_002b2a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'sampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp sampler1D arg_0_1; +void textureDimensions_002b2a() { + int res = textureSize(arg_0_1, 0); +} + +void fragment_main() { + textureDimensions_002b2a(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'sampler1D' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp sampler1D arg_0_1; +void textureDimensions_002b2a() { + int res = textureSize(arg_0_1, 0); +} + +void compute_main() { + textureDimensions_002b2a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'sampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/002b2a.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/002b2a.wgsl.expected.hlsl new file mode 100644 index 0000000000..29d0c12d90 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/002b2a.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +Texture1D arg_0 : register(t0, space1); + +void textureDimensions_002b2a() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_002b2a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_002b2a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_002b2a(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/002b2a.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/002b2a.wgsl.expected.msl new file mode 100644 index 0000000000..b5b212146d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/002b2a.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_002b2a(texture1d tint_symbol_1) { + int res = int(tint_symbol_1.get_width(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureDimensions_002b2a(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureDimensions_002b2a(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureDimensions_002b2a(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/002b2a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/002b2a.wgsl.expected.spvasm new file mode 100644 index 0000000000..178d73b8ec --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/002b2a.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability Sampled1D + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_002b2a "textureDimensions_002b2a" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 1D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Function_int = OpTypePointer Function %int + %22 = OpConstantNull %int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_002b2a = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_int Function %22 + %18 = OpLoad %11 %arg_0 + %16 = OpImageQuerySizeLod %int %18 %int_0 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureDimensions_002b2a + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %void %textureDimensions_002b2a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_002b2a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/002b2a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/002b2a.wgsl.expected.wgsl new file mode 100644 index 0000000000..a21a8c0b16 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/002b2a.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_1d; + +fn textureDimensions_002b2a() { + var res : i32 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_002b2a(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_002b2a(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_002b2a(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/012b82.wgsl b/test/tint/builtins/gen/var/textureDimensions/012b82.wgsl new file mode 100644 index 0000000000..d011596a67 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/012b82.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureDimensions(texture: texture_storage_2d_array) -> vec2 +fn textureDimensions_012b82() { + var res: vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_012b82(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_012b82(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_012b82(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/012b82.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/012b82.wgsl.expected.glsl new file mode 100644 index 0000000000..9ae3c1ba4a --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/012b82.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(r32i) uniform highp writeonly iimage2DArray arg_0; +void textureDimensions_012b82() { + ivec2 res = imageSize(arg_0).xy; +} + +vec4 vertex_main() { + textureDimensions_012b82(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(r32i) uniform highp writeonly iimage2DArray arg_0; +void textureDimensions_012b82() { + ivec2 res = imageSize(arg_0).xy; +} + +void fragment_main() { + textureDimensions_012b82(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(r32i) uniform highp writeonly iimage2DArray arg_0; +void textureDimensions_012b82() { + ivec2 res = imageSize(arg_0).xy; +} + +void compute_main() { + textureDimensions_012b82(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/012b82.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/012b82.wgsl.expected.hlsl new file mode 100644 index 0000000000..56fb818a4f --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/012b82.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_012b82() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_012b82(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_012b82(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_012b82(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/012b82.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/012b82.wgsl.expected.msl new file mode 100644 index 0000000000..f53807b875 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/012b82.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_012b82(texture2d_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureDimensions_012b82(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_012b82(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_012b82(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/012b82.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/012b82.wgsl.expected.spvasm new file mode 100644 index 0000000000..4e8d502e64 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/012b82.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_012b82 "textureDimensions_012b82" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 1 0 2 R32i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %24 = OpConstantNull %v2int + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_012b82 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %24 + %21 = OpLoad %11 %arg_0 + %19 = OpImageQuerySize %v3int %21 + %17 = OpVectorShuffle %v2int %19 %19 0 1 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %textureDimensions_012b82 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %void %textureDimensions_012b82 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %37 = OpLabel + %38 = OpFunctionCall %void %textureDimensions_012b82 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/012b82.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/012b82.wgsl.expected.wgsl new file mode 100644 index 0000000000..7ebcab6b4e --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/012b82.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureDimensions_012b82() { + var res : vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_012b82(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_012b82(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_012b82(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/08753d.wgsl b/test/tint/builtins/gen/var/textureDimensions/08753d.wgsl new file mode 100644 index 0000000000..4e071a0b4f --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/08753d.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureDimensions(texture: texture_storage_1d) -> i32 +fn textureDimensions_08753d() { + var res: i32 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_08753d(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_08753d(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_08753d(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/08753d.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/08753d.wgsl.expected.glsl new file mode 100644 index 0000000000..0b0f9e39c8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/08753d.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +layout(rgba16i) uniform highp writeonly iimage1D arg_0; +void textureDimensions_08753d() { + int res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_08753d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'iimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rgba16i) uniform highp writeonly iimage1D arg_0; +void textureDimensions_08753d() { + int res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_08753d(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'iimage1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rgba16i) uniform highp writeonly iimage1D arg_0; +void textureDimensions_08753d() { + int res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_08753d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'iimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/08753d.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/08753d.wgsl.expected.hlsl new file mode 100644 index 0000000000..83011fff55 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/08753d.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_08753d() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_08753d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_08753d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_08753d(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/08753d.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/08753d.wgsl.expected.msl new file mode 100644 index 0000000000..a1fa2f3981 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/08753d.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_08753d(texture1d tint_symbol_1) { + int res = int(tint_symbol_1.get_width(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureDimensions_08753d(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureDimensions_08753d(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureDimensions_08753d(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/08753d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/08753d.wgsl.expected.spvasm new file mode 100644 index 0000000000..8854f381d1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/08753d.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Image1D + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_08753d "textureDimensions_08753d" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 1D 0 0 0 2 Rgba16i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_08753d = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %21 + %18 = OpLoad %11 %arg_0 + %17 = OpImageQuerySize %int %18 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %textureDimensions_08753d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %31 = OpLabel + %32 = OpFunctionCall %void %textureDimensions_08753d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %void %textureDimensions_08753d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/08753d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/08753d.wgsl.expected.wgsl new file mode 100644 index 0000000000..45dce4b559 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/08753d.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureDimensions_08753d() { + var res : i32 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_08753d(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_08753d(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_08753d(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/0c4772.wgsl b/test/tint/builtins/gen/var/textureDimensions/0c4772.wgsl new file mode 100644 index 0000000000..3acce510b9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0c4772.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureDimensions(texture: texture_storage_3d) -> vec3 +fn textureDimensions_0c4772() { + var res: vec3 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_0c4772(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_0c4772(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_0c4772(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/0c4772.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/0c4772.wgsl.expected.glsl new file mode 100644 index 0000000000..f58182c691 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0c4772.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba16f) uniform highp writeonly image3D arg_0; +void textureDimensions_0c4772() { + ivec3 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_0c4772(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba16f) uniform highp writeonly image3D arg_0; +void textureDimensions_0c4772() { + ivec3 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_0c4772(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba16f) uniform highp writeonly image3D arg_0; +void textureDimensions_0c4772() { + ivec3 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_0c4772(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/0c4772.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/0c4772.wgsl.expected.hlsl new file mode 100644 index 0000000000..3de620cf2c --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0c4772.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_0c4772() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_0c4772(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_0c4772(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_0c4772(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/0c4772.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/0c4772.wgsl.expected.msl new file mode 100644 index 0000000000..cc675e6c22 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0c4772.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_0c4772(texture3d tint_symbol_1) { + int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureDimensions_0c4772(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureDimensions_0c4772(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureDimensions_0c4772(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/0c4772.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/0c4772.wgsl.expected.spvasm new file mode 100644 index 0000000000..77d91d556e --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0c4772.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_0c4772 "textureDimensions_0c4772" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 3D 0 0 0 2 Rgba16f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %22 = OpConstantNull %v3int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_0c4772 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v3int Function %22 + %19 = OpLoad %11 %arg_0 + %16 = OpImageQuerySize %v3int %19 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureDimensions_0c4772 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %void %textureDimensions_0c4772 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_0c4772 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/0c4772.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/0c4772.wgsl.expected.wgsl new file mode 100644 index 0000000000..dc5fc35cb9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0c4772.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureDimensions_0c4772() { + var res : vec3 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_0c4772(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_0c4772(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_0c4772(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/0cce40.wgsl b/test/tint/builtins/gen/var/textureDimensions/0cce40.wgsl new file mode 100644 index 0000000000..410f924b2b --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0cce40.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureDimensions(texture: texture_storage_1d) -> i32 +fn textureDimensions_0cce40() { + var res: i32 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_0cce40(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_0cce40(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_0cce40(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/0cce40.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/0cce40.wgsl.expected.glsl new file mode 100644 index 0000000000..a0df901a1e --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0cce40.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +layout(r32i) uniform highp writeonly iimage1D arg_0; +void textureDimensions_0cce40() { + int res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_0cce40(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'iimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(r32i) uniform highp writeonly iimage1D arg_0; +void textureDimensions_0cce40() { + int res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_0cce40(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'iimage1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(r32i) uniform highp writeonly iimage1D arg_0; +void textureDimensions_0cce40() { + int res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_0cce40(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'iimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/0cce40.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/0cce40.wgsl.expected.hlsl new file mode 100644 index 0000000000..e10fdf6f36 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0cce40.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_0cce40() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_0cce40(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_0cce40(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_0cce40(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/0cce40.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/0cce40.wgsl.expected.msl new file mode 100644 index 0000000000..e95504846d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0cce40.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_0cce40(texture1d tint_symbol_1) { + int res = int(tint_symbol_1.get_width(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureDimensions_0cce40(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureDimensions_0cce40(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureDimensions_0cce40(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/0cce40.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/0cce40.wgsl.expected.spvasm new file mode 100644 index 0000000000..51c3c1474a --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0cce40.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Image1D + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_0cce40 "textureDimensions_0cce40" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 1D 0 0 0 2 R32i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_0cce40 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %21 + %18 = OpLoad %11 %arg_0 + %17 = OpImageQuerySize %int %18 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %textureDimensions_0cce40 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %31 = OpLabel + %32 = OpFunctionCall %void %textureDimensions_0cce40 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %void %textureDimensions_0cce40 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/0cce40.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/0cce40.wgsl.expected.wgsl new file mode 100644 index 0000000000..04b0e24fd1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0cce40.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureDimensions_0cce40() { + var res : i32 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_0cce40(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_0cce40(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_0cce40(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/0cf2ff.wgsl b/test/tint/builtins/gen/var/textureDimensions/0cf2ff.wgsl new file mode 100644 index 0000000000..4ca09283fc --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0cf2ff.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureDimensions(texture: texture_storage_2d) -> vec2 +fn textureDimensions_0cf2ff() { + var res: vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_0cf2ff(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_0cf2ff(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_0cf2ff(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/0cf2ff.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/0cf2ff.wgsl.expected.glsl new file mode 100644 index 0000000000..d91c9dbce7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0cf2ff.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba16ui) uniform highp writeonly uimage2D arg_0; +void textureDimensions_0cf2ff() { + ivec2 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_0cf2ff(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba16ui) uniform highp writeonly uimage2D arg_0; +void textureDimensions_0cf2ff() { + ivec2 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_0cf2ff(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba16ui) uniform highp writeonly uimage2D arg_0; +void textureDimensions_0cf2ff() { + ivec2 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_0cf2ff(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/0cf2ff.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/0cf2ff.wgsl.expected.hlsl new file mode 100644 index 0000000000..3b9fd521cc --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0cf2ff.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_0cf2ff() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_0cf2ff(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_0cf2ff(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_0cf2ff(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/0cf2ff.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/0cf2ff.wgsl.expected.msl new file mode 100644 index 0000000000..875a38898b --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0cf2ff.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_0cf2ff(texture2d tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureDimensions_0cf2ff(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_0cf2ff(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_0cf2ff(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/0cf2ff.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/0cf2ff.wgsl.expected.spvasm new file mode 100644 index 0000000000..aece995648 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0cf2ff.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_0cf2ff "textureDimensions_0cf2ff" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 0 0 2 Rgba16ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %23 = OpConstantNull %v2int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_0cf2ff = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %23 + %20 = OpLoad %11 %arg_0 + %17 = OpImageQuerySize %v2int %20 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureDimensions_0cf2ff + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %33 = OpLabel + %34 = OpFunctionCall %void %textureDimensions_0cf2ff + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_0cf2ff + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/0cf2ff.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/0cf2ff.wgsl.expected.wgsl new file mode 100644 index 0000000000..36e3e6109f --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0cf2ff.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureDimensions_0cf2ff() { + var res : vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_0cf2ff(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_0cf2ff(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_0cf2ff(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/0d8b7e.wgsl b/test/tint/builtins/gen/var/textureDimensions/0d8b7e.wgsl new file mode 100644 index 0000000000..69277768d9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0d8b7e.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureDimensions(texture: texture_storage_2d_array) -> vec2 +fn textureDimensions_0d8b7e() { + var res: vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_0d8b7e(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_0d8b7e(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_0d8b7e(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/0d8b7e.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/0d8b7e.wgsl.expected.glsl new file mode 100644 index 0000000000..19bb91aa0d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0d8b7e.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(r32ui) uniform highp writeonly uimage2DArray arg_0; +void textureDimensions_0d8b7e() { + ivec2 res = imageSize(arg_0).xy; +} + +vec4 vertex_main() { + textureDimensions_0d8b7e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(r32ui) uniform highp writeonly uimage2DArray arg_0; +void textureDimensions_0d8b7e() { + ivec2 res = imageSize(arg_0).xy; +} + +void fragment_main() { + textureDimensions_0d8b7e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(r32ui) uniform highp writeonly uimage2DArray arg_0; +void textureDimensions_0d8b7e() { + ivec2 res = imageSize(arg_0).xy; +} + +void compute_main() { + textureDimensions_0d8b7e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/0d8b7e.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/0d8b7e.wgsl.expected.hlsl new file mode 100644 index 0000000000..848d8b7dae --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0d8b7e.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_0d8b7e() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_0d8b7e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_0d8b7e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_0d8b7e(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/0d8b7e.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/0d8b7e.wgsl.expected.msl new file mode 100644 index 0000000000..d07d72a409 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0d8b7e.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_0d8b7e(texture2d_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureDimensions_0d8b7e(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_0d8b7e(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_0d8b7e(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/0d8b7e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/0d8b7e.wgsl.expected.spvasm new file mode 100644 index 0000000000..c5406d7f5f --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0d8b7e.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_0d8b7e "textureDimensions_0d8b7e" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 1 0 2 R32ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %25 = OpConstantNull %v2int + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_0d8b7e = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %25 + %22 = OpLoad %11 %arg_0 + %20 = OpImageQuerySize %v3int %22 + %17 = OpVectorShuffle %v2int %20 %20 0 1 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %textureDimensions_0d8b7e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_0d8b7e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %38 = OpLabel + %39 = OpFunctionCall %void %textureDimensions_0d8b7e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/0d8b7e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/0d8b7e.wgsl.expected.wgsl new file mode 100644 index 0000000000..b4a1350a3b --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0d8b7e.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureDimensions_0d8b7e() { + var res : vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_0d8b7e(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_0d8b7e(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_0d8b7e(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/0e32ee.wgsl b/test/tint/builtins/gen/var/textureDimensions/0e32ee.wgsl new file mode 100644 index 0000000000..60d2aa3469 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0e32ee.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureDimensions(texture: texture_storage_3d) -> vec3 +fn textureDimensions_0e32ee() { + var res: vec3 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_0e32ee(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_0e32ee(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_0e32ee(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/0e32ee.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/0e32ee.wgsl.expected.glsl new file mode 100644 index 0000000000..3b004866e0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0e32ee.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba16ui) uniform highp writeonly uimage3D arg_0; +void textureDimensions_0e32ee() { + ivec3 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_0e32ee(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba16ui) uniform highp writeonly uimage3D arg_0; +void textureDimensions_0e32ee() { + ivec3 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_0e32ee(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba16ui) uniform highp writeonly uimage3D arg_0; +void textureDimensions_0e32ee() { + ivec3 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_0e32ee(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/0e32ee.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/0e32ee.wgsl.expected.hlsl new file mode 100644 index 0000000000..0f338cc3fc --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0e32ee.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_0e32ee() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_0e32ee(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_0e32ee(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_0e32ee(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/0e32ee.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/0e32ee.wgsl.expected.msl new file mode 100644 index 0000000000..376e7b1473 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0e32ee.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_0e32ee(texture3d tint_symbol_1) { + int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureDimensions_0e32ee(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureDimensions_0e32ee(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureDimensions_0e32ee(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/0e32ee.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/0e32ee.wgsl.expected.spvasm new file mode 100644 index 0000000000..c045a1aeb6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0e32ee.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_0e32ee "textureDimensions_0e32ee" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 3D 0 0 0 2 Rgba16ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %23 = OpConstantNull %v3int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_0e32ee = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v3int Function %23 + %20 = OpLoad %11 %arg_0 + %17 = OpImageQuerySize %v3int %20 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureDimensions_0e32ee + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %33 = OpLabel + %34 = OpFunctionCall %void %textureDimensions_0e32ee + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_0e32ee + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/0e32ee.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/0e32ee.wgsl.expected.wgsl new file mode 100644 index 0000000000..9f0e1d1347 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0e32ee.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureDimensions_0e32ee() { + var res : vec3 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_0e32ee(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_0e32ee(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_0e32ee(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/0f3c50.wgsl b/test/tint/builtins/gen/var/textureDimensions/0f3c50.wgsl new file mode 100644 index 0000000000..c8010cbe59 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0f3c50.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; + +// fn textureDimensions(texture: texture_2d_array) -> vec2 +fn textureDimensions_0f3c50() { + var res: vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_0f3c50(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_0f3c50(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_0f3c50(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/0f3c50.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/0f3c50.wgsl.expected.glsl new file mode 100644 index 0000000000..da53ee88db --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0f3c50.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp isampler2DArray arg_0_1; +void textureDimensions_0f3c50() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +vec4 vertex_main() { + textureDimensions_0f3c50(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp isampler2DArray arg_0_1; +void textureDimensions_0f3c50() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +void fragment_main() { + textureDimensions_0f3c50(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp isampler2DArray arg_0_1; +void textureDimensions_0f3c50() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +void compute_main() { + textureDimensions_0f3c50(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/0f3c50.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/0f3c50.wgsl.expected.hlsl new file mode 100644 index 0000000000..5bef2982da --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0f3c50.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureDimensions_0f3c50() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_0f3c50(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_0f3c50(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_0f3c50(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/0f3c50.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/0f3c50.wgsl.expected.msl new file mode 100644 index 0000000000..9e6f6ab279 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0f3c50.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_0f3c50(texture2d_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureDimensions_0f3c50(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_0f3c50(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_0f3c50(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/0f3c50.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/0f3c50.wgsl.expected.spvasm new file mode 100644 index 0000000000..53a9a618c4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0f3c50.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_0f3c50 "textureDimensions_0f3c50" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 + %int_0 = OpConstant %int 0 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %25 = OpConstantNull %v2int + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_0f3c50 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %25 + %21 = OpLoad %11 %arg_0 + %19 = OpImageQuerySizeLod %v3int %21 %int_0 + %17 = OpVectorShuffle %v2int %19 %19 0 1 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %textureDimensions_0f3c50 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_0f3c50 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %38 = OpLabel + %39 = OpFunctionCall %void %textureDimensions_0f3c50 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/0f3c50.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/0f3c50.wgsl.expected.wgsl new file mode 100644 index 0000000000..553f57ea88 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0f3c50.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +fn textureDimensions_0f3c50() { + var res : vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_0f3c50(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_0f3c50(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_0f3c50(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/1191a5.wgsl b/test/tint/builtins/gen/var/textureDimensions/1191a5.wgsl new file mode 100644 index 0000000000..172d0496ae --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/1191a5.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d; + +// fn textureDimensions(texture: texture_2d) -> vec2 +fn textureDimensions_1191a5() { + var res: vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_1191a5(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_1191a5(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_1191a5(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/1191a5.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/1191a5.wgsl.expected.glsl new file mode 100644 index 0000000000..0514b2e300 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/1191a5.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp usampler2D arg_0_1; +void textureDimensions_1191a5() { + ivec2 res = textureSize(arg_0_1, 0); +} + +vec4 vertex_main() { + textureDimensions_1191a5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp usampler2D arg_0_1; +void textureDimensions_1191a5() { + ivec2 res = textureSize(arg_0_1, 0); +} + +void fragment_main() { + textureDimensions_1191a5(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp usampler2D arg_0_1; +void textureDimensions_1191a5() { + ivec2 res = textureSize(arg_0_1, 0); +} + +void compute_main() { + textureDimensions_1191a5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/1191a5.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/1191a5.wgsl.expected.hlsl new file mode 100644 index 0000000000..cedbfad032 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/1191a5.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_0 : register(t0, space1); + +void textureDimensions_1191a5() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_1191a5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_1191a5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_1191a5(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/1191a5.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/1191a5.wgsl.expected.msl new file mode 100644 index 0000000000..c08c723d33 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/1191a5.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_1191a5(texture2d tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureDimensions_1191a5(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_1191a5(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_1191a5(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/1191a5.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/1191a5.wgsl.expected.spvasm new file mode 100644 index 0000000000..1cc88e1923 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/1191a5.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_1191a5 "textureDimensions_1191a5" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %int_0 = OpConstant %int 0 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %24 = OpConstantNull %v2int + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_1191a5 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %24 + %20 = OpLoad %11 %arg_0 + %17 = OpImageQuerySizeLod %v2int %20 %int_0 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %textureDimensions_1191a5 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %void %textureDimensions_1191a5 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %37 = OpLabel + %38 = OpFunctionCall %void %textureDimensions_1191a5 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/1191a5.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/1191a5.wgsl.expected.wgsl new file mode 100644 index 0000000000..2131304dac --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/1191a5.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_2d; + +fn textureDimensions_1191a5() { + var res : vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_1191a5(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_1191a5(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_1191a5(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/12c9bb.wgsl b/test/tint/builtins/gen/var/textureDimensions/12c9bb.wgsl new file mode 100644 index 0000000000..f235441dc5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/12c9bb.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d; + +// fn textureDimensions(texture: texture_depth_2d, level: i32) -> vec2 +fn textureDimensions_12c9bb() { + var arg_1 = 0; + var res: vec2 = textureDimensions(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_12c9bb(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_12c9bb(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_12c9bb(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/12c9bb.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/12c9bb.wgsl.expected.glsl new file mode 100644 index 0000000000..c64c5eb66a --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/12c9bb.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp sampler2D arg_0_1; +void textureDimensions_12c9bb() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1); +} + +vec4 vertex_main() { + textureDimensions_12c9bb(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2D arg_0_1; +void textureDimensions_12c9bb() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1); +} + +void fragment_main() { + textureDimensions_12c9bb(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2D arg_0_1; +void textureDimensions_12c9bb() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1); +} + +void compute_main() { + textureDimensions_12c9bb(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/12c9bb.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/12c9bb.wgsl.expected.hlsl new file mode 100644 index 0000000000..6ae5d7780f --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/12c9bb.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +Texture2D arg_0 : register(t0, space1); + +void textureDimensions_12c9bb() { + int arg_1 = 0; + int3 tint_tmp; + arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_12c9bb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_12c9bb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_12c9bb(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/12c9bb.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/12c9bb.wgsl.expected.msl new file mode 100644 index 0000000000..2fb2f57aef --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/12c9bb.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void textureDimensions_12c9bb(depth2d tint_symbol_1) { + int arg_1 = 0; + int2 res = int2(tint_symbol_1.get_width(arg_1), tint_symbol_1.get_height(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d tint_symbol_2) { + textureDimensions_12c9bb(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_12c9bb(tint_symbol_4); + return; +} + +kernel void compute_main(depth2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_12c9bb(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/12c9bb.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/12c9bb.wgsl.expected.spvasm new file mode 100644 index 0000000000..72881d5f4a --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/12c9bb.wgsl.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_12c9bb "textureDimensions_12c9bb" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %17 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %26 = OpConstantNull %v2int + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_12c9bb = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %17 + %res = OpVariable %_ptr_Function_v2int Function %26 + OpStore %arg_1 %17 + %22 = OpLoad %11 %arg_0 + %23 = OpLoad %int %arg_1 + %20 = OpImageQuerySizeLod %v2int %22 %23 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %textureDimensions_12c9bb + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_12c9bb + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %39 = OpLabel + %40 = OpFunctionCall %void %textureDimensions_12c9bb + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/12c9bb.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/12c9bb.wgsl.expected.wgsl new file mode 100644 index 0000000000..d61d60295e --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/12c9bb.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d; + +fn textureDimensions_12c9bb() { + var arg_1 = 0; + var res : vec2 = textureDimensions(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_12c9bb(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_12c9bb(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_12c9bb(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/147998.wgsl b/test/tint/builtins/gen/var/textureDimensions/147998.wgsl new file mode 100644 index 0000000000..17e2e21255 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/147998.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureDimensions(texture: texture_storage_2d) -> vec2 +fn textureDimensions_147998() { + var res: vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_147998(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_147998(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_147998(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/147998.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/147998.wgsl.expected.glsl new file mode 100644 index 0000000000..90d19e81e0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/147998.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32f) uniform highp writeonly image2D arg_0; +void textureDimensions_147998() { + ivec2 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_147998(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32f) uniform highp writeonly image2D arg_0; +void textureDimensions_147998() { + ivec2 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_147998(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32f) uniform highp writeonly image2D arg_0; +void textureDimensions_147998() { + ivec2 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_147998(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/147998.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/147998.wgsl.expected.hlsl new file mode 100644 index 0000000000..af1e9bd856 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/147998.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_147998() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_147998(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_147998(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_147998(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/147998.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/147998.wgsl.expected.msl new file mode 100644 index 0000000000..25431038ea --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/147998.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_147998(texture2d tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureDimensions_147998(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_147998(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_147998(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/147998.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/147998.wgsl.expected.spvasm new file mode 100644 index 0000000000..9e80b7d798 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/147998.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability StorageImageExtendedFormats + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_147998 "textureDimensions_147998" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 2 Rg32f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %22 = OpConstantNull %v2int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_147998 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %22 + %19 = OpLoad %11 %arg_0 + %16 = OpImageQuerySize %v2int %19 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureDimensions_147998 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %void %textureDimensions_147998 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_147998 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/147998.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/147998.wgsl.expected.wgsl new file mode 100644 index 0000000000..3cd6855640 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/147998.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureDimensions_147998() { + var res : vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_147998(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_147998(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_147998(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/16036c.wgsl b/test/tint/builtins/gen/var/textureDimensions/16036c.wgsl new file mode 100644 index 0000000000..84ce99813b --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/16036c.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureDimensions(texture: texture_storage_2d_array) -> vec2 +fn textureDimensions_16036c() { + var res: vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_16036c(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_16036c(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_16036c(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/16036c.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/16036c.wgsl.expected.glsl new file mode 100644 index 0000000000..5e4d6923f0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/16036c.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba8i) uniform highp writeonly iimage2DArray arg_0; +void textureDimensions_16036c() { + ivec2 res = imageSize(arg_0).xy; +} + +vec4 vertex_main() { + textureDimensions_16036c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8i) uniform highp writeonly iimage2DArray arg_0; +void textureDimensions_16036c() { + ivec2 res = imageSize(arg_0).xy; +} + +void fragment_main() { + textureDimensions_16036c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8i) uniform highp writeonly iimage2DArray arg_0; +void textureDimensions_16036c() { + ivec2 res = imageSize(arg_0).xy; +} + +void compute_main() { + textureDimensions_16036c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/16036c.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/16036c.wgsl.expected.hlsl new file mode 100644 index 0000000000..02565baa5f --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/16036c.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_16036c() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_16036c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_16036c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_16036c(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/16036c.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/16036c.wgsl.expected.msl new file mode 100644 index 0000000000..4872c899f6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/16036c.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_16036c(texture2d_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureDimensions_16036c(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_16036c(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_16036c(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/16036c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/16036c.wgsl.expected.spvasm new file mode 100644 index 0000000000..af24793179 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/16036c.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_16036c "textureDimensions_16036c" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 1 0 2 Rgba8i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %24 = OpConstantNull %v2int + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_16036c = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %24 + %21 = OpLoad %11 %arg_0 + %19 = OpImageQuerySize %v3int %21 + %17 = OpVectorShuffle %v2int %19 %19 0 1 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %textureDimensions_16036c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %void %textureDimensions_16036c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %37 = OpLabel + %38 = OpFunctionCall %void %textureDimensions_16036c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/16036c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/16036c.wgsl.expected.wgsl new file mode 100644 index 0000000000..072b71e684 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/16036c.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureDimensions_16036c() { + var res : vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_16036c(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_16036c(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_16036c(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/1b71f0.wgsl b/test/tint/builtins/gen/var/textureDimensions/1b71f0.wgsl new file mode 100644 index 0000000000..77f345dd70 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/1b71f0.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureDimensions(texture: texture_storage_3d) -> vec3 +fn textureDimensions_1b71f0() { + var res: vec3 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_1b71f0(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_1b71f0(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_1b71f0(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/1b71f0.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/1b71f0.wgsl.expected.glsl new file mode 100644 index 0000000000..16bd5b604e --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/1b71f0.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba16i) uniform highp writeonly iimage3D arg_0; +void textureDimensions_1b71f0() { + ivec3 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_1b71f0(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba16i) uniform highp writeonly iimage3D arg_0; +void textureDimensions_1b71f0() { + ivec3 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_1b71f0(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba16i) uniform highp writeonly iimage3D arg_0; +void textureDimensions_1b71f0() { + ivec3 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_1b71f0(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/1b71f0.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/1b71f0.wgsl.expected.hlsl new file mode 100644 index 0000000000..1ffa3d3b90 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/1b71f0.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_1b71f0() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_1b71f0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_1b71f0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_1b71f0(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/1b71f0.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/1b71f0.wgsl.expected.msl new file mode 100644 index 0000000000..9ef7f55bb6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/1b71f0.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_1b71f0(texture3d tint_symbol_1) { + int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureDimensions_1b71f0(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureDimensions_1b71f0(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureDimensions_1b71f0(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/1b71f0.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/1b71f0.wgsl.expected.spvasm new file mode 100644 index 0000000000..ba6dd6a703 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/1b71f0.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_1b71f0 "textureDimensions_1b71f0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 3D 0 0 0 2 Rgba16i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v3int = OpTypeVector %int 3 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %22 = OpConstantNull %v3int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_1b71f0 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v3int Function %22 + %19 = OpLoad %11 %arg_0 + %17 = OpImageQuerySize %v3int %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureDimensions_1b71f0 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %32 = OpLabel + %33 = OpFunctionCall %void %textureDimensions_1b71f0 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_1b71f0 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/1b71f0.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/1b71f0.wgsl.expected.wgsl new file mode 100644 index 0000000000..8fedb781ff --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/1b71f0.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureDimensions_1b71f0() { + var res : vec3 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_1b71f0(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_1b71f0(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_1b71f0(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/1d6c26.wgsl b/test/tint/builtins/gen/var/textureDimensions/1d6c26.wgsl new file mode 100644 index 0000000000..0b5857db45 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/1d6c26.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureDimensions(texture: texture_storage_2d_array) -> vec2 +fn textureDimensions_1d6c26() { + var res: vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_1d6c26(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_1d6c26(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_1d6c26(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/1d6c26.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/1d6c26.wgsl.expected.glsl new file mode 100644 index 0000000000..bea79ae702 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/1d6c26.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba8) uniform highp writeonly image2DArray arg_0; +void textureDimensions_1d6c26() { + ivec2 res = imageSize(arg_0).xy; +} + +vec4 vertex_main() { + textureDimensions_1d6c26(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8) uniform highp writeonly image2DArray arg_0; +void textureDimensions_1d6c26() { + ivec2 res = imageSize(arg_0).xy; +} + +void fragment_main() { + textureDimensions_1d6c26(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8) uniform highp writeonly image2DArray arg_0; +void textureDimensions_1d6c26() { + ivec2 res = imageSize(arg_0).xy; +} + +void compute_main() { + textureDimensions_1d6c26(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/1d6c26.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/1d6c26.wgsl.expected.hlsl new file mode 100644 index 0000000000..26140a05d7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/1d6c26.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_1d6c26() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_1d6c26(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_1d6c26(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_1d6c26(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/1d6c26.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/1d6c26.wgsl.expected.msl new file mode 100644 index 0000000000..65d506dd62 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/1d6c26.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_1d6c26(texture2d_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureDimensions_1d6c26(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_1d6c26(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_1d6c26(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/1d6c26.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/1d6c26.wgsl.expected.spvasm new file mode 100644 index 0000000000..f0feca547e --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/1d6c26.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_1d6c26 "textureDimensions_1d6c26" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 2 Rgba8 +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %24 = OpConstantNull %v2int + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_1d6c26 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %24 + %21 = OpLoad %11 %arg_0 + %19 = OpImageQuerySize %v3int %21 + %16 = OpVectorShuffle %v2int %19 %19 0 1 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %textureDimensions_1d6c26 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %34 = OpLabel + %35 = OpFunctionCall %void %textureDimensions_1d6c26 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %37 = OpLabel + %38 = OpFunctionCall %void %textureDimensions_1d6c26 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/1d6c26.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/1d6c26.wgsl.expected.wgsl new file mode 100644 index 0000000000..1ca754c28d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/1d6c26.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureDimensions_1d6c26() { + var res : vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_1d6c26(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_1d6c26(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_1d6c26(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/1e9e39.wgsl b/test/tint/builtins/gen/var/textureDimensions/1e9e39.wgsl new file mode 100644 index 0000000000..c40f9c0e1c --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/1e9e39.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureDimensions(texture: texture_storage_1d) -> i32 +fn textureDimensions_1e9e39() { + var res: i32 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_1e9e39(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_1e9e39(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_1e9e39(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/1e9e39.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/1e9e39.wgsl.expected.glsl new file mode 100644 index 0000000000..067bc8bce7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/1e9e39.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +layout(rgba16f) uniform highp writeonly image1D arg_0; +void textureDimensions_1e9e39() { + int res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_1e9e39(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rgba16f) uniform highp writeonly image1D arg_0; +void textureDimensions_1e9e39() { + int res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_1e9e39(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rgba16f) uniform highp writeonly image1D arg_0; +void textureDimensions_1e9e39() { + int res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_1e9e39(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/1e9e39.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/1e9e39.wgsl.expected.hlsl new file mode 100644 index 0000000000..16444c0f2a --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/1e9e39.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_1e9e39() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_1e9e39(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_1e9e39(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_1e9e39(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/1e9e39.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/1e9e39.wgsl.expected.msl new file mode 100644 index 0000000000..352d58df65 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/1e9e39.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_1e9e39(texture1d tint_symbol_1) { + int res = int(tint_symbol_1.get_width(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureDimensions_1e9e39(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureDimensions_1e9e39(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureDimensions_1e9e39(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/1e9e39.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/1e9e39.wgsl.expected.spvasm new file mode 100644 index 0000000000..c83aa50543 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/1e9e39.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Image1D + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_1e9e39 "textureDimensions_1e9e39" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 1D 0 0 0 2 Rgba16f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_1e9e39 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_int Function %21 + %18 = OpLoad %11 %arg_0 + %16 = OpImageQuerySize %int %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %textureDimensions_1e9e39 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %31 = OpLabel + %32 = OpFunctionCall %void %textureDimensions_1e9e39 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %34 = OpLabel + %35 = OpFunctionCall %void %textureDimensions_1e9e39 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/1e9e39.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/1e9e39.wgsl.expected.wgsl new file mode 100644 index 0000000000..938b1048a4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/1e9e39.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureDimensions_1e9e39() { + var res : i32 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_1e9e39(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_1e9e39(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_1e9e39(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/1f20c5.wgsl b/test/tint/builtins/gen/var/textureDimensions/1f20c5.wgsl new file mode 100644 index 0000000000..8301b57d00 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/1f20c5.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; + +// fn textureDimensions(texture: texture_2d_array) -> vec2 +fn textureDimensions_1f20c5() { + var res: vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_1f20c5(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_1f20c5(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_1f20c5(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/1f20c5.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/1f20c5.wgsl.expected.glsl new file mode 100644 index 0000000000..ac742c2d81 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/1f20c5.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp usampler2DArray arg_0_1; +void textureDimensions_1f20c5() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +vec4 vertex_main() { + textureDimensions_1f20c5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp usampler2DArray arg_0_1; +void textureDimensions_1f20c5() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +void fragment_main() { + textureDimensions_1f20c5(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp usampler2DArray arg_0_1; +void textureDimensions_1f20c5() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +void compute_main() { + textureDimensions_1f20c5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/1f20c5.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/1f20c5.wgsl.expected.hlsl new file mode 100644 index 0000000000..e453d42df6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/1f20c5.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureDimensions_1f20c5() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_1f20c5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_1f20c5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_1f20c5(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/1f20c5.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/1f20c5.wgsl.expected.msl new file mode 100644 index 0000000000..d35a456705 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/1f20c5.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_1f20c5(texture2d_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureDimensions_1f20c5(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_1f20c5(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_1f20c5(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/1f20c5.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/1f20c5.wgsl.expected.spvasm new file mode 100644 index 0000000000..83e1fb4af4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/1f20c5.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_1f20c5 "textureDimensions_1f20c5" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 + %int_0 = OpConstant %int 0 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %26 = OpConstantNull %v2int + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_1f20c5 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %26 + %22 = OpLoad %11 %arg_0 + %20 = OpImageQuerySizeLod %v3int %22 %int_0 + %17 = OpVectorShuffle %v2int %20 %20 0 1 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %textureDimensions_1f20c5 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_1f20c5 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %39 = OpLabel + %40 = OpFunctionCall %void %textureDimensions_1f20c5 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/1f20c5.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/1f20c5.wgsl.expected.wgsl new file mode 100644 index 0000000000..2cbde3e854 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/1f20c5.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +fn textureDimensions_1f20c5() { + var res : vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_1f20c5(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_1f20c5(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_1f20c5(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/214dd4.wgsl b/test/tint/builtins/gen/var/textureDimensions/214dd4.wgsl new file mode 100644 index 0000000000..e3ac96cdb7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/214dd4.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureDimensions(texture: texture_storage_3d) -> vec3 +fn textureDimensions_214dd4() { + var res: vec3 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_214dd4(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_214dd4(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_214dd4(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/214dd4.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/214dd4.wgsl.expected.glsl new file mode 100644 index 0000000000..d7f534f801 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/214dd4.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba8i) uniform highp writeonly iimage3D arg_0; +void textureDimensions_214dd4() { + ivec3 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_214dd4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8i) uniform highp writeonly iimage3D arg_0; +void textureDimensions_214dd4() { + ivec3 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_214dd4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8i) uniform highp writeonly iimage3D arg_0; +void textureDimensions_214dd4() { + ivec3 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_214dd4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/214dd4.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/214dd4.wgsl.expected.hlsl new file mode 100644 index 0000000000..c91423eba6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/214dd4.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_214dd4() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_214dd4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_214dd4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_214dd4(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/214dd4.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/214dd4.wgsl.expected.msl new file mode 100644 index 0000000000..169ee329ac --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/214dd4.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_214dd4(texture3d tint_symbol_1) { + int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureDimensions_214dd4(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureDimensions_214dd4(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureDimensions_214dd4(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/214dd4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/214dd4.wgsl.expected.spvasm new file mode 100644 index 0000000000..8210ce8f60 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/214dd4.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_214dd4 "textureDimensions_214dd4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 3D 0 0 0 2 Rgba8i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v3int = OpTypeVector %int 3 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %22 = OpConstantNull %v3int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_214dd4 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v3int Function %22 + %19 = OpLoad %11 %arg_0 + %17 = OpImageQuerySize %v3int %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureDimensions_214dd4 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %32 = OpLabel + %33 = OpFunctionCall %void %textureDimensions_214dd4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_214dd4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/214dd4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/214dd4.wgsl.expected.wgsl new file mode 100644 index 0000000000..a6e1919e1b --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/214dd4.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureDimensions_214dd4() { + var res : vec3 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_214dd4(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_214dd4(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_214dd4(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/221f22.wgsl b/test/tint/builtins/gen/var/textureDimensions/221f22.wgsl new file mode 100644 index 0000000000..4af29a21df --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/221f22.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube_array; + +// fn textureDimensions(texture: texture_cube_array, level: i32) -> vec2 +fn textureDimensions_221f22() { + var arg_1 = 0; + var res: vec2 = textureDimensions(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_221f22(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_221f22(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_221f22(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/221f22.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/221f22.wgsl.expected.glsl new file mode 100644 index 0000000000..ba1d23a9f6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/221f22.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp isamplerCubeArray arg_0_1; +void textureDimensions_221f22() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1).xy; +} + +vec4 vertex_main() { + textureDimensions_221f22(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'isamplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp isamplerCubeArray arg_0_1; +void textureDimensions_221f22() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1).xy; +} + +void fragment_main() { + textureDimensions_221f22(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'isamplerCubeArray' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp isamplerCubeArray arg_0_1; +void textureDimensions_221f22() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1).xy; +} + +void compute_main() { + textureDimensions_221f22(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'isamplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/221f22.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/221f22.wgsl.expected.hlsl new file mode 100644 index 0000000000..6e40306be9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/221f22.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureDimensions_221f22() { + int arg_1 = 0; + int4 tint_tmp; + arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_221f22(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_221f22(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_221f22(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/221f22.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/221f22.wgsl.expected.msl new file mode 100644 index 0000000000..0a75edb922 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/221f22.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void textureDimensions_221f22(texturecube_array tint_symbol_1) { + int arg_1 = 0; + int2 res = int2(tint_symbol_1.get_width(arg_1), tint_symbol_1.get_height(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube_array tint_symbol_2) { + textureDimensions_221f22(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_221f22(tint_symbol_4); + return; +} + +kernel void compute_main(texturecube_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_221f22(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/221f22.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/221f22.wgsl.expected.spvasm new file mode 100644 index 0000000000..d4ab8e0159 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/221f22.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_221f22 "textureDimensions_221f22" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %17 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %28 = OpConstantNull %v2int + %29 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_221f22 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %17 + %res = OpVariable %_ptr_Function_v2int Function %28 + OpStore %arg_1 %17 + %24 = OpLoad %11 %arg_0 + %25 = OpLoad %int %arg_1 + %22 = OpImageQuerySizeLod %v3int %24 %25 + %20 = OpVectorShuffle %v2int %22 %22 0 1 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %29 + %31 = OpLabel + %32 = OpFunctionCall %void %textureDimensions_221f22 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %35 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %38 = OpLabel + %39 = OpFunctionCall %void %textureDimensions_221f22 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %41 = OpLabel + %42 = OpFunctionCall %void %textureDimensions_221f22 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/221f22.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/221f22.wgsl.expected.wgsl new file mode 100644 index 0000000000..b7afc404af --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/221f22.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +@group(1) @binding(0) var arg_0 : texture_cube_array; + +fn textureDimensions_221f22() { + var arg_1 = 0; + var res : vec2 = textureDimensions(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_221f22(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_221f22(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_221f22(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/267788.wgsl b/test/tint/builtins/gen/var/textureDimensions/267788.wgsl new file mode 100644 index 0000000000..1fca259117 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/267788.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; + +// fn textureDimensions(texture: texture_2d_array, level: i32) -> vec2 +fn textureDimensions_267788() { + var arg_1 = 0; + var res: vec2 = textureDimensions(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_267788(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_267788(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_267788(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/267788.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/267788.wgsl.expected.glsl new file mode 100644 index 0000000000..5ab45ccbdb --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/267788.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp usampler2DArray arg_0_1; +void textureDimensions_267788() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1).xy; +} + +vec4 vertex_main() { + textureDimensions_267788(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp usampler2DArray arg_0_1; +void textureDimensions_267788() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1).xy; +} + +void fragment_main() { + textureDimensions_267788(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp usampler2DArray arg_0_1; +void textureDimensions_267788() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1).xy; +} + +void compute_main() { + textureDimensions_267788(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/267788.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/267788.wgsl.expected.hlsl new file mode 100644 index 0000000000..43ab14cb2f --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/267788.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureDimensions_267788() { + int arg_1 = 0; + int4 tint_tmp; + arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_267788(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_267788(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_267788(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/267788.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/267788.wgsl.expected.msl new file mode 100644 index 0000000000..3f22f32cb2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/267788.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void textureDimensions_267788(texture2d_array tint_symbol_1) { + int arg_1 = 0; + int2 res = int2(tint_symbol_1.get_width(arg_1), tint_symbol_1.get_height(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureDimensions_267788(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_267788(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_267788(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/267788.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/267788.wgsl.expected.spvasm new file mode 100644 index 0000000000..43de7d3c52 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/267788.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_267788 "textureDimensions_267788" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %18 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %29 = OpConstantNull %v2int + %30 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_267788 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %18 + %res = OpVariable %_ptr_Function_v2int Function %29 + OpStore %arg_1 %18 + %25 = OpLoad %11 %arg_0 + %26 = OpLoad %int %arg_1 + %23 = OpImageQuerySizeLod %v3int %25 %26 + %21 = OpVectorShuffle %v2int %23 %23 0 1 + OpStore %res %21 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %textureDimensions_267788 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %36 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %39 = OpLabel + %40 = OpFunctionCall %void %textureDimensions_267788 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %42 = OpLabel + %43 = OpFunctionCall %void %textureDimensions_267788 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/267788.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/267788.wgsl.expected.wgsl new file mode 100644 index 0000000000..b3c7d0e608 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/267788.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +fn textureDimensions_267788() { + var arg_1 = 0; + var res : vec2 = textureDimensions(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_267788(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_267788(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_267788(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/26bdfa.wgsl b/test/tint/builtins/gen/var/textureDimensions/26bdfa.wgsl new file mode 100644 index 0000000000..46faf7535e --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/26bdfa.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_3d; + +// fn textureDimensions(texture: texture_3d, level: i32) -> vec3 +fn textureDimensions_26bdfa() { + var arg_1 = 0; + var res: vec3 = textureDimensions(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_26bdfa(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_26bdfa(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_26bdfa(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/26bdfa.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/26bdfa.wgsl.expected.glsl new file mode 100644 index 0000000000..cc8ce41851 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/26bdfa.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp sampler3D arg_0_1; +void textureDimensions_26bdfa() { + int arg_1 = 0; + ivec3 res = textureSize(arg_0_1, arg_1); +} + +vec4 vertex_main() { + textureDimensions_26bdfa(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler3D arg_0_1; +void textureDimensions_26bdfa() { + int arg_1 = 0; + ivec3 res = textureSize(arg_0_1, arg_1); +} + +void fragment_main() { + textureDimensions_26bdfa(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler3D arg_0_1; +void textureDimensions_26bdfa() { + int arg_1 = 0; + ivec3 res = textureSize(arg_0_1, arg_1); +} + +void compute_main() { + textureDimensions_26bdfa(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/26bdfa.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/26bdfa.wgsl.expected.hlsl new file mode 100644 index 0000000000..4d66e9077c --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/26bdfa.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +Texture3D arg_0 : register(t0, space1); + +void textureDimensions_26bdfa() { + int arg_1 = 0; + int4 tint_tmp; + arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int3 res = tint_tmp.xyz; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_26bdfa(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_26bdfa(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_26bdfa(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/26bdfa.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/26bdfa.wgsl.expected.msl new file mode 100644 index 0000000000..67861526c7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/26bdfa.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void textureDimensions_26bdfa(texture3d tint_symbol_1) { + int arg_1 = 0; + int3 res = int3(tint_symbol_1.get_width(arg_1), tint_symbol_1.get_height(arg_1), tint_symbol_1.get_depth(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureDimensions_26bdfa(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureDimensions_26bdfa(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureDimensions_26bdfa(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/26bdfa.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/26bdfa.wgsl.expected.spvasm new file mode 100644 index 0000000000..99be9549d4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/26bdfa.wgsl.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_26bdfa "textureDimensions_26bdfa" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 3D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %17 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %v3int = OpTypeVector %int 3 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %26 = OpConstantNull %v3int + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_26bdfa = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %17 + %res = OpVariable %_ptr_Function_v3int Function %26 + OpStore %arg_1 %17 + %22 = OpLoad %11 %arg_0 + %23 = OpLoad %int %arg_1 + %20 = OpImageQuerySizeLod %v3int %22 %23 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %textureDimensions_26bdfa + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_26bdfa + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %39 = OpLabel + %40 = OpFunctionCall %void %textureDimensions_26bdfa + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/26bdfa.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/26bdfa.wgsl.expected.wgsl new file mode 100644 index 0000000000..99aeee2c0e --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/26bdfa.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +@group(1) @binding(0) var arg_0 : texture_3d; + +fn textureDimensions_26bdfa() { + var arg_1 = 0; + var res : vec3 = textureDimensions(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_26bdfa(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_26bdfa(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_26bdfa(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/26ef6c.wgsl b/test/tint/builtins/gen/var/textureDimensions/26ef6c.wgsl new file mode 100644 index 0000000000..ccf3250e86 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/26ef6c.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureDimensions(texture: texture_storage_2d_array) -> vec2 +fn textureDimensions_26ef6c() { + var res: vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_26ef6c(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_26ef6c(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_26ef6c(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/26ef6c.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/26ef6c.wgsl.expected.glsl new file mode 100644 index 0000000000..dbdb178ec8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/26ef6c.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba8ui) uniform highp writeonly uimage2DArray arg_0; +void textureDimensions_26ef6c() { + ivec2 res = imageSize(arg_0).xy; +} + +vec4 vertex_main() { + textureDimensions_26ef6c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8ui) uniform highp writeonly uimage2DArray arg_0; +void textureDimensions_26ef6c() { + ivec2 res = imageSize(arg_0).xy; +} + +void fragment_main() { + textureDimensions_26ef6c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8ui) uniform highp writeonly uimage2DArray arg_0; +void textureDimensions_26ef6c() { + ivec2 res = imageSize(arg_0).xy; +} + +void compute_main() { + textureDimensions_26ef6c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/26ef6c.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/26ef6c.wgsl.expected.hlsl new file mode 100644 index 0000000000..7ccf32f5db --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/26ef6c.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_26ef6c() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_26ef6c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_26ef6c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_26ef6c(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/26ef6c.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/26ef6c.wgsl.expected.msl new file mode 100644 index 0000000000..ba9013a8ad --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/26ef6c.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_26ef6c(texture2d_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureDimensions_26ef6c(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_26ef6c(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_26ef6c(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/26ef6c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/26ef6c.wgsl.expected.spvasm new file mode 100644 index 0000000000..bd40e121a9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/26ef6c.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_26ef6c "textureDimensions_26ef6c" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 1 0 2 Rgba8ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %25 = OpConstantNull %v2int + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_26ef6c = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %25 + %22 = OpLoad %11 %arg_0 + %20 = OpImageQuerySize %v3int %22 + %17 = OpVectorShuffle %v2int %20 %20 0 1 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %textureDimensions_26ef6c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_26ef6c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %38 = OpLabel + %39 = OpFunctionCall %void %textureDimensions_26ef6c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/26ef6c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/26ef6c.wgsl.expected.wgsl new file mode 100644 index 0000000000..960c66d5b8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/26ef6c.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureDimensions_26ef6c() { + var res : vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_26ef6c(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_26ef6c(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_26ef6c(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/2ad087.wgsl b/test/tint/builtins/gen/var/textureDimensions/2ad087.wgsl new file mode 100644 index 0000000000..25a8b28efd --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/2ad087.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureDimensions(texture: texture_storage_2d) -> vec2 +fn textureDimensions_2ad087() { + var res: vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_2ad087(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_2ad087(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_2ad087(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/2ad087.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/2ad087.wgsl.expected.glsl new file mode 100644 index 0000000000..90289b322c --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/2ad087.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba16i) uniform highp writeonly iimage2D arg_0; +void textureDimensions_2ad087() { + ivec2 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_2ad087(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba16i) uniform highp writeonly iimage2D arg_0; +void textureDimensions_2ad087() { + ivec2 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_2ad087(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba16i) uniform highp writeonly iimage2D arg_0; +void textureDimensions_2ad087() { + ivec2 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_2ad087(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/2ad087.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/2ad087.wgsl.expected.hlsl new file mode 100644 index 0000000000..33dee501da --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/2ad087.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_2ad087() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_2ad087(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_2ad087(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_2ad087(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/2ad087.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/2ad087.wgsl.expected.msl new file mode 100644 index 0000000000..011b3cb465 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/2ad087.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_2ad087(texture2d tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureDimensions_2ad087(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_2ad087(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_2ad087(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/2ad087.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/2ad087.wgsl.expected.spvasm new file mode 100644 index 0000000000..cb89db590a --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/2ad087.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_2ad087 "textureDimensions_2ad087" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 0 0 2 Rgba16i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %22 = OpConstantNull %v2int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_2ad087 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %22 + %19 = OpLoad %11 %arg_0 + %17 = OpImageQuerySize %v2int %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureDimensions_2ad087 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %32 = OpLabel + %33 = OpFunctionCall %void %textureDimensions_2ad087 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_2ad087 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/2ad087.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/2ad087.wgsl.expected.wgsl new file mode 100644 index 0000000000..c2b8327fa5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/2ad087.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureDimensions_2ad087() { + var res : vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_2ad087(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_2ad087(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_2ad087(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/2efa05.wgsl b/test/tint/builtins/gen/var/textureDimensions/2efa05.wgsl new file mode 100644 index 0000000000..9d16f9609a --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/2efa05.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_3d; + +// fn textureDimensions(texture: texture_3d, level: i32) -> vec3 +fn textureDimensions_2efa05() { + var arg_1 = 0; + var res: vec3 = textureDimensions(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_2efa05(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_2efa05(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_2efa05(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/2efa05.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/2efa05.wgsl.expected.glsl new file mode 100644 index 0000000000..8b2360281d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/2efa05.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp usampler3D arg_0_1; +void textureDimensions_2efa05() { + int arg_1 = 0; + ivec3 res = textureSize(arg_0_1, arg_1); +} + +vec4 vertex_main() { + textureDimensions_2efa05(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp usampler3D arg_0_1; +void textureDimensions_2efa05() { + int arg_1 = 0; + ivec3 res = textureSize(arg_0_1, arg_1); +} + +void fragment_main() { + textureDimensions_2efa05(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp usampler3D arg_0_1; +void textureDimensions_2efa05() { + int arg_1 = 0; + ivec3 res = textureSize(arg_0_1, arg_1); +} + +void compute_main() { + textureDimensions_2efa05(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/2efa05.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/2efa05.wgsl.expected.hlsl new file mode 100644 index 0000000000..fd507fafcb --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/2efa05.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +Texture3D arg_0 : register(t0, space1); + +void textureDimensions_2efa05() { + int arg_1 = 0; + int4 tint_tmp; + arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int3 res = tint_tmp.xyz; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_2efa05(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_2efa05(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_2efa05(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/2efa05.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/2efa05.wgsl.expected.msl new file mode 100644 index 0000000000..3f1b9a431f --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/2efa05.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void textureDimensions_2efa05(texture3d tint_symbol_1) { + int arg_1 = 0; + int3 res = int3(tint_symbol_1.get_width(arg_1), tint_symbol_1.get_height(arg_1), tint_symbol_1.get_depth(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureDimensions_2efa05(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureDimensions_2efa05(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureDimensions_2efa05(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/2efa05.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/2efa05.wgsl.expected.spvasm new file mode 100644 index 0000000000..8d162f11f6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/2efa05.wgsl.expected.spvasm @@ -0,0 +1,82 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 42 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_2efa05 "textureDimensions_2efa05" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 3D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %18 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %v3int = OpTypeVector %int 3 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %27 = OpConstantNull %v3int + %28 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_2efa05 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %18 + %res = OpVariable %_ptr_Function_v3int Function %27 + OpStore %arg_1 %18 + %23 = OpLoad %11 %arg_0 + %24 = OpLoad %int %arg_1 + %21 = OpImageQuerySizeLod %v3int %23 %24 + OpStore %res %21 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %28 + %30 = OpLabel + %31 = OpFunctionCall %void %textureDimensions_2efa05 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %33 = OpLabel + %34 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %34 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %37 = OpLabel + %38 = OpFunctionCall %void %textureDimensions_2efa05 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %40 = OpLabel + %41 = OpFunctionCall %void %textureDimensions_2efa05 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/2efa05.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/2efa05.wgsl.expected.wgsl new file mode 100644 index 0000000000..ac7a3e2bea --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/2efa05.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +@group(1) @binding(0) var arg_0 : texture_3d; + +fn textureDimensions_2efa05() { + var arg_1 = 0; + var res : vec3 = textureDimensions(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_2efa05(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_2efa05(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_2efa05(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/2f289f.wgsl b/test/tint/builtins/gen/var/textureDimensions/2f289f.wgsl new file mode 100644 index 0000000000..63835a1d8c --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/2f289f.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureDimensions(texture: texture_storage_3d) -> vec3 +fn textureDimensions_2f289f() { + var res: vec3 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_2f289f(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_2f289f(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_2f289f(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/2f289f.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/2f289f.wgsl.expected.glsl new file mode 100644 index 0000000000..ecf5ce00b5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/2f289f.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(r32i) uniform highp writeonly iimage3D arg_0; +void textureDimensions_2f289f() { + ivec3 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_2f289f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(r32i) uniform highp writeonly iimage3D arg_0; +void textureDimensions_2f289f() { + ivec3 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_2f289f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(r32i) uniform highp writeonly iimage3D arg_0; +void textureDimensions_2f289f() { + ivec3 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_2f289f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/2f289f.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/2f289f.wgsl.expected.hlsl new file mode 100644 index 0000000000..b84004a0c3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/2f289f.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_2f289f() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_2f289f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_2f289f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_2f289f(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/2f289f.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/2f289f.wgsl.expected.msl new file mode 100644 index 0000000000..a61bafeb5d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/2f289f.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_2f289f(texture3d tint_symbol_1) { + int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureDimensions_2f289f(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureDimensions_2f289f(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureDimensions_2f289f(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/2f289f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/2f289f.wgsl.expected.spvasm new file mode 100644 index 0000000000..ae04243b13 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/2f289f.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_2f289f "textureDimensions_2f289f" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 3D 0 0 0 2 R32i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v3int = OpTypeVector %int 3 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %22 = OpConstantNull %v3int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_2f289f = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v3int Function %22 + %19 = OpLoad %11 %arg_0 + %17 = OpImageQuerySize %v3int %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureDimensions_2f289f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %32 = OpLabel + %33 = OpFunctionCall %void %textureDimensions_2f289f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_2f289f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/2f289f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/2f289f.wgsl.expected.wgsl new file mode 100644 index 0000000000..7ffc030342 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/2f289f.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureDimensions_2f289f() { + var res : vec3 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_2f289f(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_2f289f(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_2f289f(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/2fe1cc.wgsl b/test/tint/builtins/gen/var/textureDimensions/2fe1cc.wgsl new file mode 100644 index 0000000000..1d4350ba06 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/2fe1cc.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d; + +// fn textureDimensions(texture: texture_2d, level: i32) -> vec2 +fn textureDimensions_2fe1cc() { + var arg_1 = 0; + var res: vec2 = textureDimensions(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_2fe1cc(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_2fe1cc(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_2fe1cc(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/2fe1cc.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/2fe1cc.wgsl.expected.glsl new file mode 100644 index 0000000000..20bbd86217 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/2fe1cc.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp sampler2D arg_0_1; +void textureDimensions_2fe1cc() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1); +} + +vec4 vertex_main() { + textureDimensions_2fe1cc(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2D arg_0_1; +void textureDimensions_2fe1cc() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1); +} + +void fragment_main() { + textureDimensions_2fe1cc(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2D arg_0_1; +void textureDimensions_2fe1cc() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1); +} + +void compute_main() { + textureDimensions_2fe1cc(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/2fe1cc.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/2fe1cc.wgsl.expected.hlsl new file mode 100644 index 0000000000..723a757349 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/2fe1cc.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +Texture2D arg_0 : register(t0, space1); + +void textureDimensions_2fe1cc() { + int arg_1 = 0; + int3 tint_tmp; + arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_2fe1cc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_2fe1cc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_2fe1cc(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/2fe1cc.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/2fe1cc.wgsl.expected.msl new file mode 100644 index 0000000000..38413c00f8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/2fe1cc.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void textureDimensions_2fe1cc(texture2d tint_symbol_1) { + int arg_1 = 0; + int2 res = int2(tint_symbol_1.get_width(arg_1), tint_symbol_1.get_height(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureDimensions_2fe1cc(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_2fe1cc(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_2fe1cc(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/2fe1cc.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/2fe1cc.wgsl.expected.spvasm new file mode 100644 index 0000000000..3dcda16c4e --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/2fe1cc.wgsl.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_2fe1cc "textureDimensions_2fe1cc" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %17 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %26 = OpConstantNull %v2int + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_2fe1cc = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %17 + %res = OpVariable %_ptr_Function_v2int Function %26 + OpStore %arg_1 %17 + %22 = OpLoad %11 %arg_0 + %23 = OpLoad %int %arg_1 + %20 = OpImageQuerySizeLod %v2int %22 %23 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %textureDimensions_2fe1cc + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_2fe1cc + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %39 = OpLabel + %40 = OpFunctionCall %void %textureDimensions_2fe1cc + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/2fe1cc.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/2fe1cc.wgsl.expected.wgsl new file mode 100644 index 0000000000..148b19956f --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/2fe1cc.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +@group(1) @binding(0) var arg_0 : texture_2d; + +fn textureDimensions_2fe1cc() { + var arg_1 = 0; + var res : vec2 = textureDimensions(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_2fe1cc(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_2fe1cc(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_2fe1cc(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/318ecc.wgsl b/test/tint/builtins/gen/var/textureDimensions/318ecc.wgsl new file mode 100644 index 0000000000..4563fc8955 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/318ecc.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureDimensions(texture: texture_storage_1d) -> i32 +fn textureDimensions_318ecc() { + var res: i32 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_318ecc(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_318ecc(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_318ecc(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/318ecc.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/318ecc.wgsl.expected.glsl new file mode 100644 index 0000000000..078e8b3968 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/318ecc.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +layout(rgba16ui) uniform highp writeonly uimage1D arg_0; +void textureDimensions_318ecc() { + int res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_318ecc(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'uimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rgba16ui) uniform highp writeonly uimage1D arg_0; +void textureDimensions_318ecc() { + int res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_318ecc(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'uimage1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rgba16ui) uniform highp writeonly uimage1D arg_0; +void textureDimensions_318ecc() { + int res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_318ecc(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'uimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/318ecc.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/318ecc.wgsl.expected.hlsl new file mode 100644 index 0000000000..bc9b732479 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/318ecc.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_318ecc() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_318ecc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_318ecc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_318ecc(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/318ecc.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/318ecc.wgsl.expected.msl new file mode 100644 index 0000000000..a9655f52bf --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/318ecc.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_318ecc(texture1d tint_symbol_1) { + int res = int(tint_symbol_1.get_width(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureDimensions_318ecc(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureDimensions_318ecc(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureDimensions_318ecc(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/318ecc.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/318ecc.wgsl.expected.spvasm new file mode 100644 index 0000000000..c65dba980d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/318ecc.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability Image1D + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_318ecc "textureDimensions_318ecc" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 1D 0 0 0 2 Rgba16ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %22 = OpConstantNull %int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_318ecc = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %22 + %19 = OpLoad %11 %arg_0 + %17 = OpImageQuerySize %int %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureDimensions_318ecc + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %32 = OpLabel + %33 = OpFunctionCall %void %textureDimensions_318ecc + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_318ecc + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/318ecc.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/318ecc.wgsl.expected.wgsl new file mode 100644 index 0000000000..d1c53d49be --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/318ecc.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureDimensions_318ecc() { + var res : i32 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_318ecc(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_318ecc(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_318ecc(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/340d06.wgsl b/test/tint/builtins/gen/var/textureDimensions/340d06.wgsl new file mode 100644 index 0000000000..801a81e511 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/340d06.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureDimensions(texture: texture_storage_3d) -> vec3 +fn textureDimensions_340d06() { + var res: vec3 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_340d06(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_340d06(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_340d06(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/340d06.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/340d06.wgsl.expected.glsl new file mode 100644 index 0000000000..78d4994be5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/340d06.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(r32ui) uniform highp writeonly uimage3D arg_0; +void textureDimensions_340d06() { + ivec3 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_340d06(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(r32ui) uniform highp writeonly uimage3D arg_0; +void textureDimensions_340d06() { + ivec3 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_340d06(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(r32ui) uniform highp writeonly uimage3D arg_0; +void textureDimensions_340d06() { + ivec3 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_340d06(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/340d06.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/340d06.wgsl.expected.hlsl new file mode 100644 index 0000000000..db01f68004 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/340d06.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_340d06() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_340d06(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_340d06(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_340d06(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/340d06.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/340d06.wgsl.expected.msl new file mode 100644 index 0000000000..eb04eb88e7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/340d06.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_340d06(texture3d tint_symbol_1) { + int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureDimensions_340d06(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureDimensions_340d06(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureDimensions_340d06(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/340d06.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/340d06.wgsl.expected.spvasm new file mode 100644 index 0000000000..c58da9bd7b --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/340d06.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_340d06 "textureDimensions_340d06" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 3D 0 0 0 2 R32ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %23 = OpConstantNull %v3int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_340d06 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v3int Function %23 + %20 = OpLoad %11 %arg_0 + %17 = OpImageQuerySize %v3int %20 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureDimensions_340d06 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %33 = OpLabel + %34 = OpFunctionCall %void %textureDimensions_340d06 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_340d06 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/340d06.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/340d06.wgsl.expected.wgsl new file mode 100644 index 0000000000..7ae21b4ce9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/340d06.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureDimensions_340d06() { + var res : vec3 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_340d06(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_340d06(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_340d06(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/398e30.wgsl b/test/tint/builtins/gen/var/textureDimensions/398e30.wgsl new file mode 100644 index 0000000000..d8a22e3716 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/398e30.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureDimensions(texture: texture_storage_2d_array) -> vec2 +fn textureDimensions_398e30() { + var res: vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_398e30(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_398e30(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_398e30(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/398e30.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/398e30.wgsl.expected.glsl new file mode 100644 index 0000000000..6db635123c --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/398e30.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba32ui) uniform highp writeonly uimage2DArray arg_0; +void textureDimensions_398e30() { + ivec2 res = imageSize(arg_0).xy; +} + +vec4 vertex_main() { + textureDimensions_398e30(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba32ui) uniform highp writeonly uimage2DArray arg_0; +void textureDimensions_398e30() { + ivec2 res = imageSize(arg_0).xy; +} + +void fragment_main() { + textureDimensions_398e30(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba32ui) uniform highp writeonly uimage2DArray arg_0; +void textureDimensions_398e30() { + ivec2 res = imageSize(arg_0).xy; +} + +void compute_main() { + textureDimensions_398e30(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/398e30.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/398e30.wgsl.expected.hlsl new file mode 100644 index 0000000000..ee95c58978 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/398e30.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_398e30() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_398e30(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_398e30(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_398e30(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/398e30.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/398e30.wgsl.expected.msl new file mode 100644 index 0000000000..8de5617137 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/398e30.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_398e30(texture2d_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureDimensions_398e30(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_398e30(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_398e30(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/398e30.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/398e30.wgsl.expected.spvasm new file mode 100644 index 0000000000..933984155b --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/398e30.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_398e30 "textureDimensions_398e30" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 1 0 2 Rgba32ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %25 = OpConstantNull %v2int + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_398e30 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %25 + %22 = OpLoad %11 %arg_0 + %20 = OpImageQuerySize %v3int %22 + %17 = OpVectorShuffle %v2int %20 %20 0 1 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %textureDimensions_398e30 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_398e30 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %38 = OpLabel + %39 = OpFunctionCall %void %textureDimensions_398e30 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/398e30.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/398e30.wgsl.expected.wgsl new file mode 100644 index 0000000000..457ff70cff --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/398e30.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureDimensions_398e30() { + var res : vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_398e30(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_398e30(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_398e30(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/3a94ea.wgsl b/test/tint/builtins/gen/var/textureDimensions/3a94ea.wgsl new file mode 100644 index 0000000000..d00adb2a00 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/3a94ea.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureDimensions(texture: texture_storage_2d) -> vec2 +fn textureDimensions_3a94ea() { + var res: vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_3a94ea(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_3a94ea(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_3a94ea(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/3a94ea.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/3a94ea.wgsl.expected.glsl new file mode 100644 index 0000000000..4e7d2639ab --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/3a94ea.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32ui) uniform highp writeonly uimage2D arg_0; +void textureDimensions_3a94ea() { + ivec2 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_3a94ea(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32ui) uniform highp writeonly uimage2D arg_0; +void textureDimensions_3a94ea() { + ivec2 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_3a94ea(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32ui) uniform highp writeonly uimage2D arg_0; +void textureDimensions_3a94ea() { + ivec2 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_3a94ea(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/3a94ea.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/3a94ea.wgsl.expected.hlsl new file mode 100644 index 0000000000..347c92e0ac --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/3a94ea.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_3a94ea() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_3a94ea(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_3a94ea(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_3a94ea(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/3a94ea.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/3a94ea.wgsl.expected.msl new file mode 100644 index 0000000000..7dd2f6b70b --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/3a94ea.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_3a94ea(texture2d tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureDimensions_3a94ea(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_3a94ea(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_3a94ea(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/3a94ea.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/3a94ea.wgsl.expected.spvasm new file mode 100644 index 0000000000..1ef266d1e5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/3a94ea.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability StorageImageExtendedFormats + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_3a94ea "textureDimensions_3a94ea" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 0 0 2 Rg32ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %23 = OpConstantNull %v2int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_3a94ea = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %23 + %20 = OpLoad %11 %arg_0 + %17 = OpImageQuerySize %v2int %20 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureDimensions_3a94ea + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %33 = OpLabel + %34 = OpFunctionCall %void %textureDimensions_3a94ea + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_3a94ea + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/3a94ea.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/3a94ea.wgsl.expected.wgsl new file mode 100644 index 0000000000..29d95790f2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/3a94ea.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureDimensions_3a94ea() { + var res : vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_3a94ea(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_3a94ea(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_3a94ea(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/3aca08.wgsl b/test/tint/builtins/gen/var/textureDimensions/3aca08.wgsl new file mode 100644 index 0000000000..01a56a9e53 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/3aca08.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureDimensions(texture: texture_storage_1d) -> i32 +fn textureDimensions_3aca08() { + var res: i32 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_3aca08(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_3aca08(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_3aca08(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/3aca08.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/3aca08.wgsl.expected.glsl new file mode 100644 index 0000000000..e9c16564df --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/3aca08.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +layout(rgba32f) uniform highp writeonly image1D arg_0; +void textureDimensions_3aca08() { + int res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_3aca08(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rgba32f) uniform highp writeonly image1D arg_0; +void textureDimensions_3aca08() { + int res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_3aca08(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rgba32f) uniform highp writeonly image1D arg_0; +void textureDimensions_3aca08() { + int res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_3aca08(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/3aca08.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/3aca08.wgsl.expected.hlsl new file mode 100644 index 0000000000..05eedf3b92 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/3aca08.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_3aca08() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_3aca08(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_3aca08(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_3aca08(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/3aca08.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/3aca08.wgsl.expected.msl new file mode 100644 index 0000000000..765771f8f8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/3aca08.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_3aca08(texture1d tint_symbol_1) { + int res = int(tint_symbol_1.get_width(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureDimensions_3aca08(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureDimensions_3aca08(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureDimensions_3aca08(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/3aca08.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/3aca08.wgsl.expected.spvasm new file mode 100644 index 0000000000..faf0effc03 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/3aca08.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Image1D + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_3aca08 "textureDimensions_3aca08" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 1D 0 0 0 2 Rgba32f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_3aca08 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_int Function %21 + %18 = OpLoad %11 %arg_0 + %16 = OpImageQuerySize %int %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %textureDimensions_3aca08 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %31 = OpLabel + %32 = OpFunctionCall %void %textureDimensions_3aca08 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %34 = OpLabel + %35 = OpFunctionCall %void %textureDimensions_3aca08 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/3aca08.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/3aca08.wgsl.expected.wgsl new file mode 100644 index 0000000000..ba8e34f7ca --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/3aca08.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureDimensions_3aca08() { + var res : i32 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_3aca08(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_3aca08(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_3aca08(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/3c5ad8.wgsl b/test/tint/builtins/gen/var/textureDimensions/3c5ad8.wgsl new file mode 100644 index 0000000000..9d72673e4d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/3c5ad8.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureDimensions(texture: texture_storage_2d) -> vec2 +fn textureDimensions_3c5ad8() { + var res: vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_3c5ad8(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_3c5ad8(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_3c5ad8(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/3c5ad8.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/3c5ad8.wgsl.expected.glsl new file mode 100644 index 0000000000..b27ab3b6af --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/3c5ad8.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba8i) uniform highp writeonly iimage2D arg_0; +void textureDimensions_3c5ad8() { + ivec2 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_3c5ad8(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8i) uniform highp writeonly iimage2D arg_0; +void textureDimensions_3c5ad8() { + ivec2 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_3c5ad8(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8i) uniform highp writeonly iimage2D arg_0; +void textureDimensions_3c5ad8() { + ivec2 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_3c5ad8(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/3c5ad8.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/3c5ad8.wgsl.expected.hlsl new file mode 100644 index 0000000000..78cd91bd88 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/3c5ad8.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_3c5ad8() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_3c5ad8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_3c5ad8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_3c5ad8(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/3c5ad8.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/3c5ad8.wgsl.expected.msl new file mode 100644 index 0000000000..ba7e47a6a7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/3c5ad8.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_3c5ad8(texture2d tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureDimensions_3c5ad8(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_3c5ad8(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_3c5ad8(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/3c5ad8.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/3c5ad8.wgsl.expected.spvasm new file mode 100644 index 0000000000..f91c033b1a --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/3c5ad8.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_3c5ad8 "textureDimensions_3c5ad8" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 0 0 2 Rgba8i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %22 = OpConstantNull %v2int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_3c5ad8 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %22 + %19 = OpLoad %11 %arg_0 + %17 = OpImageQuerySize %v2int %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureDimensions_3c5ad8 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %32 = OpLabel + %33 = OpFunctionCall %void %textureDimensions_3c5ad8 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_3c5ad8 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/3c5ad8.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/3c5ad8.wgsl.expected.wgsl new file mode 100644 index 0000000000..dc42b19d97 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/3c5ad8.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureDimensions_3c5ad8() { + var res : vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_3c5ad8(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_3c5ad8(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_3c5ad8(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/4152a6.wgsl b/test/tint/builtins/gen/var/textureDimensions/4152a6.wgsl new file mode 100644 index 0000000000..52a3a0760a --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/4152a6.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube_array; + +// fn textureDimensions(texture: texture_cube_array) -> vec2 +fn textureDimensions_4152a6() { + var res: vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_4152a6(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_4152a6(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_4152a6(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/4152a6.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/4152a6.wgsl.expected.glsl new file mode 100644 index 0000000000..d3120a3cc5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/4152a6.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +uniform highp usamplerCubeArray arg_0_1; +void textureDimensions_4152a6() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +vec4 vertex_main() { + textureDimensions_4152a6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'usamplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp usamplerCubeArray arg_0_1; +void textureDimensions_4152a6() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +void fragment_main() { + textureDimensions_4152a6(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'usamplerCubeArray' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp usamplerCubeArray arg_0_1; +void textureDimensions_4152a6() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +void compute_main() { + textureDimensions_4152a6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'usamplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/4152a6.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/4152a6.wgsl.expected.hlsl new file mode 100644 index 0000000000..ae5eb3529e --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/4152a6.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureDimensions_4152a6() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_4152a6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_4152a6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_4152a6(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/4152a6.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/4152a6.wgsl.expected.msl new file mode 100644 index 0000000000..ac8d43dac9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/4152a6.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_4152a6(texturecube_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube_array tint_symbol_2) { + textureDimensions_4152a6(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_4152a6(tint_symbol_4); + return; +} + +kernel void compute_main(texturecube_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_4152a6(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/4152a6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/4152a6.wgsl.expected.spvasm new file mode 100644 index 0000000000..e092546124 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/4152a6.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_4152a6 "textureDimensions_4152a6" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 + %int_0 = OpConstant %int 0 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %26 = OpConstantNull %v2int + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_4152a6 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %26 + %22 = OpLoad %11 %arg_0 + %20 = OpImageQuerySizeLod %v3int %22 %int_0 + %17 = OpVectorShuffle %v2int %20 %20 0 1 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %textureDimensions_4152a6 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_4152a6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %39 = OpLabel + %40 = OpFunctionCall %void %textureDimensions_4152a6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/4152a6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/4152a6.wgsl.expected.wgsl new file mode 100644 index 0000000000..f9ec8d52a2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/4152a6.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_cube_array; + +fn textureDimensions_4152a6() { + var res : vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_4152a6(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_4152a6(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_4152a6(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/423f99.wgsl b/test/tint/builtins/gen/var/textureDimensions/423f99.wgsl new file mode 100644 index 0000000000..3fd9d7b0a8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/423f99.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_1d; + +// fn textureDimensions(texture: texture_1d) -> i32 +fn textureDimensions_423f99() { + var res: i32 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_423f99(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_423f99(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_423f99(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/423f99.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/423f99.wgsl.expected.glsl new file mode 100644 index 0000000000..08f2e2498f --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/423f99.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +uniform highp isampler1D arg_0_1; +void textureDimensions_423f99() { + int res = textureSize(arg_0_1, 0); +} + +vec4 vertex_main() { + textureDimensions_423f99(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'isampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp isampler1D arg_0_1; +void textureDimensions_423f99() { + int res = textureSize(arg_0_1, 0); +} + +void fragment_main() { + textureDimensions_423f99(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'isampler1D' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp isampler1D arg_0_1; +void textureDimensions_423f99() { + int res = textureSize(arg_0_1, 0); +} + +void compute_main() { + textureDimensions_423f99(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'isampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/423f99.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/423f99.wgsl.expected.hlsl new file mode 100644 index 0000000000..d6a4e4bc97 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/423f99.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +Texture1D arg_0 : register(t0, space1); + +void textureDimensions_423f99() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_423f99(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_423f99(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_423f99(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/423f99.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/423f99.wgsl.expected.msl new file mode 100644 index 0000000000..77b610faab --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/423f99.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_423f99(texture1d tint_symbol_1) { + int res = int(tint_symbol_1.get_width(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureDimensions_423f99(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureDimensions_423f99(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureDimensions_423f99(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/423f99.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/423f99.wgsl.expected.spvasm new file mode 100644 index 0000000000..807bc78654 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/423f99.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability Sampled1D + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_423f99 "textureDimensions_423f99" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 1D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int_0 = OpConstant %int 0 +%_ptr_Function_int = OpTypePointer Function %int + %22 = OpConstantNull %int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_423f99 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %22 + %18 = OpLoad %11 %arg_0 + %17 = OpImageQuerySizeLod %int %18 %int_0 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureDimensions_423f99 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %32 = OpLabel + %33 = OpFunctionCall %void %textureDimensions_423f99 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_423f99 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/423f99.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/423f99.wgsl.expected.wgsl new file mode 100644 index 0000000000..b84b03300c --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/423f99.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_1d; + +fn textureDimensions_423f99() { + var res : i32 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_423f99(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_423f99(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_423f99(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/4267ee.wgsl b/test/tint/builtins/gen/var/textureDimensions/4267ee.wgsl new file mode 100644 index 0000000000..1c849b8130 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/4267ee.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureDimensions(texture: texture_storage_2d) -> vec2 +fn textureDimensions_4267ee() { + var res: vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_4267ee(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_4267ee(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_4267ee(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/4267ee.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/4267ee.wgsl.expected.glsl new file mode 100644 index 0000000000..c1f09faf0d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/4267ee.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba32f) uniform highp writeonly image2D arg_0; +void textureDimensions_4267ee() { + ivec2 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_4267ee(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba32f) uniform highp writeonly image2D arg_0; +void textureDimensions_4267ee() { + ivec2 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_4267ee(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba32f) uniform highp writeonly image2D arg_0; +void textureDimensions_4267ee() { + ivec2 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_4267ee(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/4267ee.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/4267ee.wgsl.expected.hlsl new file mode 100644 index 0000000000..aab581e07d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/4267ee.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_4267ee() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_4267ee(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_4267ee(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_4267ee(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/4267ee.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/4267ee.wgsl.expected.msl new file mode 100644 index 0000000000..177015d0ad --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/4267ee.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_4267ee(texture2d tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureDimensions_4267ee(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_4267ee(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_4267ee(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/4267ee.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/4267ee.wgsl.expected.spvasm new file mode 100644 index 0000000000..a93a79d04a --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/4267ee.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_4267ee "textureDimensions_4267ee" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 2 Rgba32f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %22 = OpConstantNull %v2int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_4267ee = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %22 + %19 = OpLoad %11 %arg_0 + %16 = OpImageQuerySize %v2int %19 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureDimensions_4267ee + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %void %textureDimensions_4267ee + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_4267ee + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/4267ee.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/4267ee.wgsl.expected.wgsl new file mode 100644 index 0000000000..909269f2bc --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/4267ee.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureDimensions_4267ee() { + var res : vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_4267ee(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_4267ee(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_4267ee(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/42d4e6.wgsl b/test/tint/builtins/gen/var/textureDimensions/42d4e6.wgsl new file mode 100644 index 0000000000..ac087c5e62 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/42d4e6.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureDimensions(texture: texture_storage_1d) -> i32 +fn textureDimensions_42d4e6() { + var res: i32 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_42d4e6(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_42d4e6(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_42d4e6(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/42d4e6.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/42d4e6.wgsl.expected.glsl new file mode 100644 index 0000000000..f59d1757c9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/42d4e6.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +layout(rgba8) uniform highp writeonly image1D arg_0; +void textureDimensions_42d4e6() { + int res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_42d4e6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rgba8) uniform highp writeonly image1D arg_0; +void textureDimensions_42d4e6() { + int res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_42d4e6(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rgba8) uniform highp writeonly image1D arg_0; +void textureDimensions_42d4e6() { + int res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_42d4e6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/42d4e6.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/42d4e6.wgsl.expected.hlsl new file mode 100644 index 0000000000..7c818175b1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/42d4e6.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_42d4e6() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_42d4e6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_42d4e6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_42d4e6(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/42d4e6.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/42d4e6.wgsl.expected.msl new file mode 100644 index 0000000000..cc3fa542ff --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/42d4e6.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_42d4e6(texture1d tint_symbol_1) { + int res = int(tint_symbol_1.get_width(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureDimensions_42d4e6(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureDimensions_42d4e6(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureDimensions_42d4e6(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/42d4e6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/42d4e6.wgsl.expected.spvasm new file mode 100644 index 0000000000..4127ab000e --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/42d4e6.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Image1D + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_42d4e6 "textureDimensions_42d4e6" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 1D 0 0 0 2 Rgba8 +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_42d4e6 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_int Function %21 + %18 = OpLoad %11 %arg_0 + %16 = OpImageQuerySize %int %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %textureDimensions_42d4e6 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %31 = OpLabel + %32 = OpFunctionCall %void %textureDimensions_42d4e6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %34 = OpLabel + %35 = OpFunctionCall %void %textureDimensions_42d4e6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/42d4e6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/42d4e6.wgsl.expected.wgsl new file mode 100644 index 0000000000..bc98490a9e --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/42d4e6.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureDimensions_42d4e6() { + var res : i32 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_42d4e6(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_42d4e6(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_42d4e6(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/48cb89.wgsl b/test/tint/builtins/gen/var/textureDimensions/48cb89.wgsl new file mode 100644 index 0000000000..c278ed8e5b --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/48cb89.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureDimensions(texture: texture_storage_2d) -> vec2 +fn textureDimensions_48cb89() { + var res: vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_48cb89(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_48cb89(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_48cb89(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/48cb89.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/48cb89.wgsl.expected.glsl new file mode 100644 index 0000000000..026fcaef19 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/48cb89.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba16f) uniform highp writeonly image2D arg_0; +void textureDimensions_48cb89() { + ivec2 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_48cb89(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba16f) uniform highp writeonly image2D arg_0; +void textureDimensions_48cb89() { + ivec2 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_48cb89(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba16f) uniform highp writeonly image2D arg_0; +void textureDimensions_48cb89() { + ivec2 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_48cb89(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/48cb89.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/48cb89.wgsl.expected.hlsl new file mode 100644 index 0000000000..9ec64be6c1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/48cb89.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_48cb89() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_48cb89(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_48cb89(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_48cb89(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/48cb89.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/48cb89.wgsl.expected.msl new file mode 100644 index 0000000000..5f475e25fe --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/48cb89.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_48cb89(texture2d tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureDimensions_48cb89(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_48cb89(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_48cb89(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/48cb89.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/48cb89.wgsl.expected.spvasm new file mode 100644 index 0000000000..9a887dcb64 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/48cb89.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_48cb89 "textureDimensions_48cb89" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 2 Rgba16f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %22 = OpConstantNull %v2int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_48cb89 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %22 + %19 = OpLoad %11 %arg_0 + %16 = OpImageQuerySize %v2int %19 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureDimensions_48cb89 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %void %textureDimensions_48cb89 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_48cb89 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/48cb89.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/48cb89.wgsl.expected.wgsl new file mode 100644 index 0000000000..cdc0578bd2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/48cb89.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureDimensions_48cb89() { + var res : vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_48cb89(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_48cb89(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_48cb89(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/49d274.wgsl b/test/tint/builtins/gen/var/textureDimensions/49d274.wgsl new file mode 100644 index 0000000000..dd8592605d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/49d274.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureDimensions(texture: texture_storage_2d_array) -> vec2 +fn textureDimensions_49d274() { + var res: vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_49d274(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_49d274(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_49d274(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/49d274.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/49d274.wgsl.expected.glsl new file mode 100644 index 0000000000..70347a6ef3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/49d274.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32i) uniform highp writeonly iimage2DArray arg_0; +void textureDimensions_49d274() { + ivec2 res = imageSize(arg_0).xy; +} + +vec4 vertex_main() { + textureDimensions_49d274(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32i) uniform highp writeonly iimage2DArray arg_0; +void textureDimensions_49d274() { + ivec2 res = imageSize(arg_0).xy; +} + +void fragment_main() { + textureDimensions_49d274(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32i) uniform highp writeonly iimage2DArray arg_0; +void textureDimensions_49d274() { + ivec2 res = imageSize(arg_0).xy; +} + +void compute_main() { + textureDimensions_49d274(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/49d274.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/49d274.wgsl.expected.hlsl new file mode 100644 index 0000000000..9ceff5070d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/49d274.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_49d274() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_49d274(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_49d274(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_49d274(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/49d274.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/49d274.wgsl.expected.msl new file mode 100644 index 0000000000..4ca4453d84 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/49d274.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_49d274(texture2d_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureDimensions_49d274(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_49d274(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_49d274(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/49d274.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/49d274.wgsl.expected.spvasm new file mode 100644 index 0000000000..9a63680bd7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/49d274.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability StorageImageExtendedFormats + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_49d274 "textureDimensions_49d274" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 1 0 2 Rg32i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %24 = OpConstantNull %v2int + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_49d274 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %24 + %21 = OpLoad %11 %arg_0 + %19 = OpImageQuerySize %v3int %21 + %17 = OpVectorShuffle %v2int %19 %19 0 1 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %textureDimensions_49d274 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %void %textureDimensions_49d274 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %37 = OpLabel + %38 = OpFunctionCall %void %textureDimensions_49d274 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/49d274.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/49d274.wgsl.expected.wgsl new file mode 100644 index 0000000000..00ebf3628e --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/49d274.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureDimensions_49d274() { + var res : vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_49d274(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_49d274(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_49d274(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/4df9a8.wgsl b/test/tint/builtins/gen/var/textureDimensions/4df9a8.wgsl new file mode 100644 index 0000000000..c95dd96fa5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/4df9a8.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureDimensions(texture: texture_storage_1d) -> i32 +fn textureDimensions_4df9a8() { + var res: i32 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_4df9a8(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_4df9a8(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_4df9a8(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/4df9a8.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/4df9a8.wgsl.expected.glsl new file mode 100644 index 0000000000..7871ed7d01 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/4df9a8.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32ui) uniform highp writeonly uimage1D arg_0; +void textureDimensions_4df9a8() { + int res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_4df9a8(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32ui) uniform highp writeonly uimage1D arg_0; +void textureDimensions_4df9a8() { + int res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_4df9a8(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32ui) uniform highp writeonly uimage1D arg_0; +void textureDimensions_4df9a8() { + int res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_4df9a8(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/4df9a8.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/4df9a8.wgsl.expected.hlsl new file mode 100644 index 0000000000..8541c75d63 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/4df9a8.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_4df9a8() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_4df9a8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_4df9a8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_4df9a8(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/4df9a8.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/4df9a8.wgsl.expected.msl new file mode 100644 index 0000000000..54723cb4de --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/4df9a8.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_4df9a8(texture1d tint_symbol_1) { + int res = int(tint_symbol_1.get_width(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureDimensions_4df9a8(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureDimensions_4df9a8(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureDimensions_4df9a8(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/4df9a8.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/4df9a8.wgsl.expected.spvasm new file mode 100644 index 0000000000..c4be2a728d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/4df9a8.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability Image1D + OpCapability StorageImageExtendedFormats + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_4df9a8 "textureDimensions_4df9a8" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 1D 0 0 0 2 Rg32ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %22 = OpConstantNull %int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_4df9a8 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %22 + %19 = OpLoad %11 %arg_0 + %17 = OpImageQuerySize %int %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureDimensions_4df9a8 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %32 = OpLabel + %33 = OpFunctionCall %void %textureDimensions_4df9a8 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_4df9a8 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/4df9a8.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/4df9a8.wgsl.expected.wgsl new file mode 100644 index 0000000000..4078aa2b55 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/4df9a8.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureDimensions_4df9a8() { + var res : i32 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_4df9a8(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_4df9a8(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_4df9a8(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/50a9ee.wgsl b/test/tint/builtins/gen/var/textureDimensions/50a9ee.wgsl new file mode 100644 index 0000000000..1a5c087a83 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/50a9ee.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube_array; + +// fn textureDimensions(texture: texture_cube_array, level: i32) -> vec2 +fn textureDimensions_50a9ee() { + var arg_1 = 0; + var res: vec2 = textureDimensions(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_50a9ee(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_50a9ee(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_50a9ee(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/50a9ee.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/50a9ee.wgsl.expected.glsl new file mode 100644 index 0000000000..e06d866cc4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/50a9ee.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp samplerCubeArray arg_0_1; +void textureDimensions_50a9ee() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1).xy; +} + +vec4 vertex_main() { + textureDimensions_50a9ee(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp samplerCubeArray arg_0_1; +void textureDimensions_50a9ee() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1).xy; +} + +void fragment_main() { + textureDimensions_50a9ee(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'samplerCubeArray' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp samplerCubeArray arg_0_1; +void textureDimensions_50a9ee() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1).xy; +} + +void compute_main() { + textureDimensions_50a9ee(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/50a9ee.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/50a9ee.wgsl.expected.hlsl new file mode 100644 index 0000000000..e5b311bc1d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/50a9ee.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureDimensions_50a9ee() { + int arg_1 = 0; + int4 tint_tmp; + arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_50a9ee(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_50a9ee(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_50a9ee(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/50a9ee.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/50a9ee.wgsl.expected.msl new file mode 100644 index 0000000000..109f854190 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/50a9ee.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void textureDimensions_50a9ee(texturecube_array tint_symbol_1) { + int arg_1 = 0; + int2 res = int2(tint_symbol_1.get_width(arg_1), tint_symbol_1.get_height(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube_array tint_symbol_2) { + textureDimensions_50a9ee(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_50a9ee(tint_symbol_4); + return; +} + +kernel void compute_main(texturecube_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_50a9ee(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/50a9ee.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/50a9ee.wgsl.expected.spvasm new file mode 100644 index 0000000000..e7172f465f --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/50a9ee.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_50a9ee "textureDimensions_50a9ee" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %17 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %28 = OpConstantNull %v2int + %29 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_50a9ee = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %17 + %res = OpVariable %_ptr_Function_v2int Function %28 + OpStore %arg_1 %17 + %24 = OpLoad %11 %arg_0 + %25 = OpLoad %int %arg_1 + %22 = OpImageQuerySizeLod %v3int %24 %25 + %20 = OpVectorShuffle %v2int %22 %22 0 1 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %29 + %31 = OpLabel + %32 = OpFunctionCall %void %textureDimensions_50a9ee + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %34 = OpLabel + %35 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %35 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %38 = OpLabel + %39 = OpFunctionCall %void %textureDimensions_50a9ee + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %41 = OpLabel + %42 = OpFunctionCall %void %textureDimensions_50a9ee + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/50a9ee.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/50a9ee.wgsl.expected.wgsl new file mode 100644 index 0000000000..664cf63442 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/50a9ee.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +@group(1) @binding(0) var arg_0 : texture_cube_array; + +fn textureDimensions_50a9ee() { + var arg_1 = 0; + var res : vec2 = textureDimensions(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_50a9ee(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_50a9ee(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_50a9ee(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/52045c.wgsl b/test/tint/builtins/gen/var/textureDimensions/52045c.wgsl new file mode 100644 index 0000000000..08d9c900c8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/52045c.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_1d; + +// fn textureDimensions(texture: texture_1d, level: i32) -> i32 +fn textureDimensions_52045c() { + var arg_1 = 0; + var res: i32 = textureDimensions(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_52045c(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_52045c(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_52045c(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/52045c.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/52045c.wgsl.expected.glsl new file mode 100644 index 0000000000..d4f8701855 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/52045c.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp isampler1D arg_0_1; +void textureDimensions_52045c() { + int arg_1 = 0; + int res = textureSize(arg_0_1, arg_1); +} + +vec4 vertex_main() { + textureDimensions_52045c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'isampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp isampler1D arg_0_1; +void textureDimensions_52045c() { + int arg_1 = 0; + int res = textureSize(arg_0_1, arg_1); +} + +void fragment_main() { + textureDimensions_52045c(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'isampler1D' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp isampler1D arg_0_1; +void textureDimensions_52045c() { + int arg_1 = 0; + int res = textureSize(arg_0_1, arg_1); +} + +void compute_main() { + textureDimensions_52045c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'isampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/52045c.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/52045c.wgsl.expected.hlsl new file mode 100644 index 0000000000..cb503d71c5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/52045c.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +Texture1D arg_0 : register(t0, space1); + +void textureDimensions_52045c() { + int arg_1 = 0; + int2 tint_tmp; + arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y); + int res = tint_tmp.x; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_52045c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_52045c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_52045c(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/52045c.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/52045c.wgsl.expected.msl new file mode 100644 index 0000000000..f8ccfdf25d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/52045c.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void textureDimensions_52045c(texture1d tint_symbol_1) { + int arg_1 = 0; + int res = int(tint_symbol_1.get_width(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureDimensions_52045c(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureDimensions_52045c(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureDimensions_52045c(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/52045c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/52045c.wgsl.expected.spvasm new file mode 100644 index 0000000000..a11913997f --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/52045c.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability Sampled1D + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_52045c "textureDimensions_52045c" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 1D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %17 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_52045c = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %17 + %res = OpVariable %_ptr_Function_int Function %17 + OpStore %arg_1 %17 + %21 = OpLoad %11 %arg_0 + %22 = OpLoad %int %arg_1 + %20 = OpImageQuerySizeLod %int %21 %22 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureDimensions_52045c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %33 = OpLabel + %34 = OpFunctionCall %void %textureDimensions_52045c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_52045c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/52045c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/52045c.wgsl.expected.wgsl new file mode 100644 index 0000000000..a03ae632f1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/52045c.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +@group(1) @binding(0) var arg_0 : texture_1d; + +fn textureDimensions_52045c() { + var arg_1 = 0; + var res : i32 = textureDimensions(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_52045c(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_52045c(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_52045c(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/55b23e.wgsl b/test/tint/builtins/gen/var/textureDimensions/55b23e.wgsl new file mode 100644 index 0000000000..06255e84f4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/55b23e.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureDimensions(texture: texture_storage_1d) -> i32 +fn textureDimensions_55b23e() { + var res: i32 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_55b23e(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_55b23e(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_55b23e(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/55b23e.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/55b23e.wgsl.expected.glsl new file mode 100644 index 0000000000..a9465b8a2c --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/55b23e.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32f) uniform highp writeonly image1D arg_0; +void textureDimensions_55b23e() { + int res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_55b23e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32f) uniform highp writeonly image1D arg_0; +void textureDimensions_55b23e() { + int res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_55b23e(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32f) uniform highp writeonly image1D arg_0; +void textureDimensions_55b23e() { + int res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_55b23e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/55b23e.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/55b23e.wgsl.expected.hlsl new file mode 100644 index 0000000000..c3634a3b40 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/55b23e.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_55b23e() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_55b23e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_55b23e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_55b23e(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/55b23e.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/55b23e.wgsl.expected.msl new file mode 100644 index 0000000000..0778752ea7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/55b23e.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_55b23e(texture1d tint_symbol_1) { + int res = int(tint_symbol_1.get_width(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureDimensions_55b23e(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureDimensions_55b23e(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureDimensions_55b23e(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/55b23e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/55b23e.wgsl.expected.spvasm new file mode 100644 index 0000000000..e6470a96b0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/55b23e.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Image1D + OpCapability StorageImageExtendedFormats + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_55b23e "textureDimensions_55b23e" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 1D 0 0 0 2 Rg32f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_55b23e = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_int Function %21 + %18 = OpLoad %11 %arg_0 + %16 = OpImageQuerySize %int %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %textureDimensions_55b23e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %31 = OpLabel + %32 = OpFunctionCall %void %textureDimensions_55b23e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %34 = OpLabel + %35 = OpFunctionCall %void %textureDimensions_55b23e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/55b23e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/55b23e.wgsl.expected.wgsl new file mode 100644 index 0000000000..32b929ccf5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/55b23e.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureDimensions_55b23e() { + var res : i32 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_55b23e(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_55b23e(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_55b23e(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/579629.wgsl b/test/tint/builtins/gen/var/textureDimensions/579629.wgsl new file mode 100644 index 0000000000..963d480a3d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/579629.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_multisampled_2d; + +// fn textureDimensions(texture: texture_multisampled_2d) -> vec2 +fn textureDimensions_579629() { + var res: vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_579629(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_579629(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_579629(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/579629.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/579629.wgsl.expected.glsl new file mode 100644 index 0000000000..d1ca2e719e --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/579629.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp usampler2DMS arg_0_1; +void textureDimensions_579629() { + ivec2 res = textureSize(arg_0_1); +} + +vec4 vertex_main() { + textureDimensions_579629(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp usampler2DMS arg_0_1; +void textureDimensions_579629() { + ivec2 res = textureSize(arg_0_1); +} + +void fragment_main() { + textureDimensions_579629(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp usampler2DMS arg_0_1; +void textureDimensions_579629() { + ivec2 res = textureSize(arg_0_1); +} + +void compute_main() { + textureDimensions_579629(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/579629.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/579629.wgsl.expected.hlsl new file mode 100644 index 0000000000..297d5dd29a --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/579629.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +Texture2DMS arg_0 : register(t0, space1); + +void textureDimensions_579629() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_579629(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_579629(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_579629(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/579629.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/579629.wgsl.expected.msl new file mode 100644 index 0000000000..d6c497bc4b --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/579629.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_579629(texture2d_ms tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_ms tint_symbol_2) { + textureDimensions_579629(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_ms tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_ms tint_symbol_4 [[texture(0)]]) { + textureDimensions_579629(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_ms tint_symbol_5 [[texture(0)]]) { + textureDimensions_579629(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/579629.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/579629.wgsl.expected.spvasm new file mode 100644 index 0000000000..5d35bf99e7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/579629.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_579629 "textureDimensions_579629" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 0 1 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %23 = OpConstantNull %v2int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_579629 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %23 + %20 = OpLoad %11 %arg_0 + %17 = OpImageQuerySize %v2int %20 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureDimensions_579629 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %33 = OpLabel + %34 = OpFunctionCall %void %textureDimensions_579629 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_579629 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/579629.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/579629.wgsl.expected.wgsl new file mode 100644 index 0000000000..e157439e3d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/579629.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_multisampled_2d; + +fn textureDimensions_579629() { + var res : vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_579629(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_579629(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_579629(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/57da0b.wgsl b/test/tint/builtins/gen/var/textureDimensions/57da0b.wgsl new file mode 100644 index 0000000000..5b7a1689fb --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/57da0b.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureDimensions(texture: texture_storage_1d) -> i32 +fn textureDimensions_57da0b() { + var res: i32 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_57da0b(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_57da0b(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_57da0b(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/57da0b.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/57da0b.wgsl.expected.glsl new file mode 100644 index 0000000000..c45ed2f613 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/57da0b.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +layout(r32ui) uniform highp writeonly uimage1D arg_0; +void textureDimensions_57da0b() { + int res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_57da0b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'uimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(r32ui) uniform highp writeonly uimage1D arg_0; +void textureDimensions_57da0b() { + int res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_57da0b(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'uimage1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(r32ui) uniform highp writeonly uimage1D arg_0; +void textureDimensions_57da0b() { + int res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_57da0b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'uimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/57da0b.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/57da0b.wgsl.expected.hlsl new file mode 100644 index 0000000000..f9df5efbd7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/57da0b.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_57da0b() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_57da0b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_57da0b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_57da0b(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/57da0b.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/57da0b.wgsl.expected.msl new file mode 100644 index 0000000000..fb1c232486 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/57da0b.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_57da0b(texture1d tint_symbol_1) { + int res = int(tint_symbol_1.get_width(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureDimensions_57da0b(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureDimensions_57da0b(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureDimensions_57da0b(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/57da0b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/57da0b.wgsl.expected.spvasm new file mode 100644 index 0000000000..9d0c96d5dd --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/57da0b.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability Image1D + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_57da0b "textureDimensions_57da0b" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 1D 0 0 0 2 R32ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %22 = OpConstantNull %int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_57da0b = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %22 + %19 = OpLoad %11 %arg_0 + %17 = OpImageQuerySize %int %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureDimensions_57da0b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %32 = OpLabel + %33 = OpFunctionCall %void %textureDimensions_57da0b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_57da0b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/57da0b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/57da0b.wgsl.expected.wgsl new file mode 100644 index 0000000000..f05ee1cf65 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/57da0b.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureDimensions_57da0b() { + var res : i32 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_57da0b(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_57da0b(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_57da0b(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/57e28f.wgsl b/test/tint/builtins/gen/var/textureDimensions/57e28f.wgsl new file mode 100644 index 0000000000..0b9d680776 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/57e28f.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_cube; + +// fn textureDimensions(texture: texture_depth_cube) -> vec2 +fn textureDimensions_57e28f() { + var res: vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_57e28f(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_57e28f(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_57e28f(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/57e28f.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/57e28f.wgsl.expected.glsl new file mode 100644 index 0000000000..c8713a2ded --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/57e28f.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp samplerCube arg_0_1; +void textureDimensions_57e28f() { + ivec2 res = textureSize(arg_0_1, 0); +} + +vec4 vertex_main() { + textureDimensions_57e28f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp samplerCube arg_0_1; +void textureDimensions_57e28f() { + ivec2 res = textureSize(arg_0_1, 0); +} + +void fragment_main() { + textureDimensions_57e28f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp samplerCube arg_0_1; +void textureDimensions_57e28f() { + ivec2 res = textureSize(arg_0_1, 0); +} + +void compute_main() { + textureDimensions_57e28f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/57e28f.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/57e28f.wgsl.expected.hlsl new file mode 100644 index 0000000000..8da8d7d569 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/57e28f.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +TextureCube arg_0 : register(t0, space1); + +void textureDimensions_57e28f() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_57e28f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_57e28f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_57e28f(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/57e28f.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/57e28f.wgsl.expected.msl new file mode 100644 index 0000000000..c089020df3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/57e28f.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_57e28f(depthcube tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depthcube tint_symbol_2) { + textureDimensions_57e28f(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depthcube tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depthcube tint_symbol_4 [[texture(0)]]) { + textureDimensions_57e28f(tint_symbol_4); + return; +} + +kernel void compute_main(depthcube tint_symbol_5 [[texture(0)]]) { + textureDimensions_57e28f(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/57e28f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/57e28f.wgsl.expected.spvasm new file mode 100644 index 0000000000..9dd34bf759 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/57e28f.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_57e28f "textureDimensions_57e28f" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float Cube 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %int_0 = OpConstant %int 0 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %23 = OpConstantNull %v2int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_57e28f = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %23 + %19 = OpLoad %11 %arg_0 + %16 = OpImageQuerySizeLod %v2int %19 %int_0 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureDimensions_57e28f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %33 = OpLabel + %34 = OpFunctionCall %void %textureDimensions_57e28f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_57e28f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/57e28f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/57e28f.wgsl.expected.wgsl new file mode 100644 index 0000000000..3d257471e3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/57e28f.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_depth_cube; + +fn textureDimensions_57e28f() { + var res : vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_57e28f(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_57e28f(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_57e28f(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/58a515.wgsl b/test/tint/builtins/gen/var/textureDimensions/58a515.wgsl new file mode 100644 index 0000000000..df0e9cd509 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/58a515.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureDimensions(texture: texture_storage_2d_array) -> vec2 +fn textureDimensions_58a515() { + var res: vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_58a515(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_58a515(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_58a515(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/58a515.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/58a515.wgsl.expected.glsl new file mode 100644 index 0000000000..b67bb0f017 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/58a515.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba16f) uniform highp writeonly image2DArray arg_0; +void textureDimensions_58a515() { + ivec2 res = imageSize(arg_0).xy; +} + +vec4 vertex_main() { + textureDimensions_58a515(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba16f) uniform highp writeonly image2DArray arg_0; +void textureDimensions_58a515() { + ivec2 res = imageSize(arg_0).xy; +} + +void fragment_main() { + textureDimensions_58a515(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba16f) uniform highp writeonly image2DArray arg_0; +void textureDimensions_58a515() { + ivec2 res = imageSize(arg_0).xy; +} + +void compute_main() { + textureDimensions_58a515(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/58a515.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/58a515.wgsl.expected.hlsl new file mode 100644 index 0000000000..e8a7b4b3f8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/58a515.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_58a515() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_58a515(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_58a515(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_58a515(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/58a515.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/58a515.wgsl.expected.msl new file mode 100644 index 0000000000..c8d90cdade --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/58a515.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_58a515(texture2d_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureDimensions_58a515(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_58a515(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_58a515(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/58a515.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/58a515.wgsl.expected.spvasm new file mode 100644 index 0000000000..5afc929ced --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/58a515.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_58a515 "textureDimensions_58a515" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 2 Rgba16f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %24 = OpConstantNull %v2int + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_58a515 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %24 + %21 = OpLoad %11 %arg_0 + %19 = OpImageQuerySize %v3int %21 + %16 = OpVectorShuffle %v2int %19 %19 0 1 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %textureDimensions_58a515 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %34 = OpLabel + %35 = OpFunctionCall %void %textureDimensions_58a515 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %37 = OpLabel + %38 = OpFunctionCall %void %textureDimensions_58a515 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/58a515.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/58a515.wgsl.expected.wgsl new file mode 100644 index 0000000000..c395b923f7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/58a515.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureDimensions_58a515() { + var res : vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_58a515(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_58a515(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_58a515(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/5985f3.wgsl b/test/tint/builtins/gen/var/textureDimensions/5985f3.wgsl new file mode 100644 index 0000000000..dffa849250 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/5985f3.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureDimensions(texture: texture_storage_2d_array) -> vec2 +fn textureDimensions_5985f3() { + var res: vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_5985f3(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_5985f3(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_5985f3(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/5985f3.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/5985f3.wgsl.expected.glsl new file mode 100644 index 0000000000..4c33a17f6a --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/5985f3.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba32i) uniform highp writeonly iimage2DArray arg_0; +void textureDimensions_5985f3() { + ivec2 res = imageSize(arg_0).xy; +} + +vec4 vertex_main() { + textureDimensions_5985f3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba32i) uniform highp writeonly iimage2DArray arg_0; +void textureDimensions_5985f3() { + ivec2 res = imageSize(arg_0).xy; +} + +void fragment_main() { + textureDimensions_5985f3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba32i) uniform highp writeonly iimage2DArray arg_0; +void textureDimensions_5985f3() { + ivec2 res = imageSize(arg_0).xy; +} + +void compute_main() { + textureDimensions_5985f3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/5985f3.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/5985f3.wgsl.expected.hlsl new file mode 100644 index 0000000000..488cb1754f --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/5985f3.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_5985f3() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_5985f3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_5985f3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_5985f3(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/5985f3.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/5985f3.wgsl.expected.msl new file mode 100644 index 0000000000..90f407d362 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/5985f3.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_5985f3(texture2d_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureDimensions_5985f3(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_5985f3(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_5985f3(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/5985f3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/5985f3.wgsl.expected.spvasm new file mode 100644 index 0000000000..f51c50b90e --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/5985f3.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_5985f3 "textureDimensions_5985f3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 1 0 2 Rgba32i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %24 = OpConstantNull %v2int + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_5985f3 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %24 + %21 = OpLoad %11 %arg_0 + %19 = OpImageQuerySize %v3int %21 + %17 = OpVectorShuffle %v2int %19 %19 0 1 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %textureDimensions_5985f3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %void %textureDimensions_5985f3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %37 = OpLabel + %38 = OpFunctionCall %void %textureDimensions_5985f3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/5985f3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/5985f3.wgsl.expected.wgsl new file mode 100644 index 0000000000..cc73d08dc7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/5985f3.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureDimensions_5985f3() { + var res : vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_5985f3(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_5985f3(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_5985f3(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/5caa5e.wgsl b/test/tint/builtins/gen/var/textureDimensions/5caa5e.wgsl new file mode 100644 index 0000000000..5582c6e7ab --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/5caa5e.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureDimensions(texture: texture_storage_1d) -> i32 +fn textureDimensions_5caa5e() { + var res: i32 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_5caa5e(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_5caa5e(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_5caa5e(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/5caa5e.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/5caa5e.wgsl.expected.glsl new file mode 100644 index 0000000000..d02caf1a45 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/5caa5e.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +layout(rgba32ui) uniform highp writeonly uimage1D arg_0; +void textureDimensions_5caa5e() { + int res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_5caa5e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'uimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rgba32ui) uniform highp writeonly uimage1D arg_0; +void textureDimensions_5caa5e() { + int res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_5caa5e(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'uimage1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rgba32ui) uniform highp writeonly uimage1D arg_0; +void textureDimensions_5caa5e() { + int res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_5caa5e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'uimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/5caa5e.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/5caa5e.wgsl.expected.hlsl new file mode 100644 index 0000000000..066fbdfdcc --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/5caa5e.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_5caa5e() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_5caa5e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_5caa5e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_5caa5e(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/5caa5e.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/5caa5e.wgsl.expected.msl new file mode 100644 index 0000000000..56e5f71c22 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/5caa5e.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_5caa5e(texture1d tint_symbol_1) { + int res = int(tint_symbol_1.get_width(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureDimensions_5caa5e(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureDimensions_5caa5e(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureDimensions_5caa5e(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/5caa5e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/5caa5e.wgsl.expected.spvasm new file mode 100644 index 0000000000..68ec968e6d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/5caa5e.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability Image1D + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_5caa5e "textureDimensions_5caa5e" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 1D 0 0 0 2 Rgba32ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %22 = OpConstantNull %int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_5caa5e = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %22 + %19 = OpLoad %11 %arg_0 + %17 = OpImageQuerySize %int %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureDimensions_5caa5e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %32 = OpLabel + %33 = OpFunctionCall %void %textureDimensions_5caa5e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_5caa5e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/5caa5e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/5caa5e.wgsl.expected.wgsl new file mode 100644 index 0000000000..3f834431a1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/5caa5e.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureDimensions_5caa5e() { + var res : i32 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_5caa5e(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_5caa5e(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_5caa5e(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/5e295d.wgsl b/test/tint/builtins/gen/var/textureDimensions/5e295d.wgsl new file mode 100644 index 0000000000..b855d3c2d2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/5e295d.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureDimensions(texture: texture_storage_2d_array) -> vec2 +fn textureDimensions_5e295d() { + var res: vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_5e295d(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_5e295d(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_5e295d(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/5e295d.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/5e295d.wgsl.expected.glsl new file mode 100644 index 0000000000..f079eb8801 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/5e295d.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba16ui) uniform highp writeonly uimage2DArray arg_0; +void textureDimensions_5e295d() { + ivec2 res = imageSize(arg_0).xy; +} + +vec4 vertex_main() { + textureDimensions_5e295d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba16ui) uniform highp writeonly uimage2DArray arg_0; +void textureDimensions_5e295d() { + ivec2 res = imageSize(arg_0).xy; +} + +void fragment_main() { + textureDimensions_5e295d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba16ui) uniform highp writeonly uimage2DArray arg_0; +void textureDimensions_5e295d() { + ivec2 res = imageSize(arg_0).xy; +} + +void compute_main() { + textureDimensions_5e295d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/5e295d.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/5e295d.wgsl.expected.hlsl new file mode 100644 index 0000000000..a88725c97e --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/5e295d.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_5e295d() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_5e295d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_5e295d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_5e295d(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/5e295d.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/5e295d.wgsl.expected.msl new file mode 100644 index 0000000000..50d3988eba --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/5e295d.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_5e295d(texture2d_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureDimensions_5e295d(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_5e295d(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_5e295d(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/5e295d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/5e295d.wgsl.expected.spvasm new file mode 100644 index 0000000000..05297b0ca5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/5e295d.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_5e295d "textureDimensions_5e295d" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 1 0 2 Rgba16ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %25 = OpConstantNull %v2int + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_5e295d = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %25 + %22 = OpLoad %11 %arg_0 + %20 = OpImageQuerySize %v3int %22 + %17 = OpVectorShuffle %v2int %20 %20 0 1 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %textureDimensions_5e295d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_5e295d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %38 = OpLabel + %39 = OpFunctionCall %void %textureDimensions_5e295d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/5e295d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/5e295d.wgsl.expected.wgsl new file mode 100644 index 0000000000..d8bceb6fec --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/5e295d.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureDimensions_5e295d() { + var res : vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_5e295d(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_5e295d(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_5e295d(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/60bf54.wgsl b/test/tint/builtins/gen/var/textureDimensions/60bf54.wgsl new file mode 100644 index 0000000000..df274c5399 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/60bf54.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureDimensions(texture: texture_storage_3d) -> vec3 +fn textureDimensions_60bf54() { + var res: vec3 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_60bf54(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_60bf54(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_60bf54(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/60bf54.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/60bf54.wgsl.expected.glsl new file mode 100644 index 0000000000..91d08156b2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/60bf54.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32i) uniform highp writeonly iimage3D arg_0; +void textureDimensions_60bf54() { + ivec3 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_60bf54(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32i) uniform highp writeonly iimage3D arg_0; +void textureDimensions_60bf54() { + ivec3 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_60bf54(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32i) uniform highp writeonly iimage3D arg_0; +void textureDimensions_60bf54() { + ivec3 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_60bf54(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/60bf54.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/60bf54.wgsl.expected.hlsl new file mode 100644 index 0000000000..d7ac1d3d72 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/60bf54.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_60bf54() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_60bf54(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_60bf54(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_60bf54(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/60bf54.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/60bf54.wgsl.expected.msl new file mode 100644 index 0000000000..bf597c3afd --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/60bf54.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_60bf54(texture3d tint_symbol_1) { + int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureDimensions_60bf54(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureDimensions_60bf54(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureDimensions_60bf54(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/60bf54.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/60bf54.wgsl.expected.spvasm new file mode 100644 index 0000000000..5073da1f55 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/60bf54.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability StorageImageExtendedFormats + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_60bf54 "textureDimensions_60bf54" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 3D 0 0 0 2 Rg32i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v3int = OpTypeVector %int 3 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %22 = OpConstantNull %v3int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_60bf54 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v3int Function %22 + %19 = OpLoad %11 %arg_0 + %17 = OpImageQuerySize %v3int %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureDimensions_60bf54 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %32 = OpLabel + %33 = OpFunctionCall %void %textureDimensions_60bf54 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_60bf54 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/60bf54.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/60bf54.wgsl.expected.wgsl new file mode 100644 index 0000000000..f9347deb41 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/60bf54.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureDimensions_60bf54() { + var res : vec3 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_60bf54(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_60bf54(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_60bf54(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/63f3cf.wgsl b/test/tint/builtins/gen/var/textureDimensions/63f3cf.wgsl new file mode 100644 index 0000000000..ae013ed060 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/63f3cf.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureDimensions(texture: texture_storage_3d) -> vec3 +fn textureDimensions_63f3cf() { + var res: vec3 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_63f3cf(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_63f3cf(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_63f3cf(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/63f3cf.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/63f3cf.wgsl.expected.glsl new file mode 100644 index 0000000000..6a77ea9751 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/63f3cf.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32f) uniform highp writeonly image3D arg_0; +void textureDimensions_63f3cf() { + ivec3 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_63f3cf(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32f) uniform highp writeonly image3D arg_0; +void textureDimensions_63f3cf() { + ivec3 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_63f3cf(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32f) uniform highp writeonly image3D arg_0; +void textureDimensions_63f3cf() { + ivec3 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_63f3cf(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/63f3cf.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/63f3cf.wgsl.expected.hlsl new file mode 100644 index 0000000000..f03906db15 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/63f3cf.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_63f3cf() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_63f3cf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_63f3cf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_63f3cf(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/63f3cf.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/63f3cf.wgsl.expected.msl new file mode 100644 index 0000000000..931b457149 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/63f3cf.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_63f3cf(texture3d tint_symbol_1) { + int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureDimensions_63f3cf(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureDimensions_63f3cf(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureDimensions_63f3cf(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/63f3cf.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/63f3cf.wgsl.expected.spvasm new file mode 100644 index 0000000000..f146e10ce2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/63f3cf.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability StorageImageExtendedFormats + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_63f3cf "textureDimensions_63f3cf" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 3D 0 0 0 2 Rg32f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %22 = OpConstantNull %v3int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_63f3cf = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v3int Function %22 + %19 = OpLoad %11 %arg_0 + %16 = OpImageQuerySize %v3int %19 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureDimensions_63f3cf + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %void %textureDimensions_63f3cf + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_63f3cf + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/63f3cf.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/63f3cf.wgsl.expected.wgsl new file mode 100644 index 0000000000..43e5f1573d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/63f3cf.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureDimensions_63f3cf() { + var res : vec3 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_63f3cf(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_63f3cf(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_63f3cf(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/68105c.wgsl b/test/tint/builtins/gen/var/textureDimensions/68105c.wgsl new file mode 100644 index 0000000000..ddac6b66ab --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/68105c.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureDimensions(texture: texture_storage_2d) -> vec2 +fn textureDimensions_68105c() { + var res: vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_68105c(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_68105c(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_68105c(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/68105c.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/68105c.wgsl.expected.glsl new file mode 100644 index 0000000000..d366071c30 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/68105c.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba32ui) uniform highp writeonly uimage2D arg_0; +void textureDimensions_68105c() { + ivec2 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_68105c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba32ui) uniform highp writeonly uimage2D arg_0; +void textureDimensions_68105c() { + ivec2 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_68105c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba32ui) uniform highp writeonly uimage2D arg_0; +void textureDimensions_68105c() { + ivec2 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_68105c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/68105c.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/68105c.wgsl.expected.hlsl new file mode 100644 index 0000000000..c3723286d7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/68105c.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_68105c() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_68105c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_68105c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_68105c(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/68105c.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/68105c.wgsl.expected.msl new file mode 100644 index 0000000000..a1fdb63b94 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/68105c.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_68105c(texture2d tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureDimensions_68105c(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_68105c(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_68105c(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/68105c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/68105c.wgsl.expected.spvasm new file mode 100644 index 0000000000..471b570c85 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/68105c.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_68105c "textureDimensions_68105c" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 0 0 2 Rgba32ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %23 = OpConstantNull %v2int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_68105c = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %23 + %20 = OpLoad %11 %arg_0 + %17 = OpImageQuerySize %v2int %20 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureDimensions_68105c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %33 = OpLabel + %34 = OpFunctionCall %void %textureDimensions_68105c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_68105c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/68105c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/68105c.wgsl.expected.wgsl new file mode 100644 index 0000000000..853c631dc4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/68105c.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureDimensions_68105c() { + var res : vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_68105c(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_68105c(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_68105c(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/686ef2.wgsl b/test/tint/builtins/gen/var/textureDimensions/686ef2.wgsl new file mode 100644 index 0000000000..8a24797438 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/686ef2.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube; + +// fn textureDimensions(texture: texture_cube, level: i32) -> vec2 +fn textureDimensions_686ef2() { + var arg_1 = 0; + var res: vec2 = textureDimensions(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_686ef2(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_686ef2(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_686ef2(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/686ef2.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/686ef2.wgsl.expected.glsl new file mode 100644 index 0000000000..c0209738da --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/686ef2.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp isamplerCube arg_0_1; +void textureDimensions_686ef2() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1); +} + +vec4 vertex_main() { + textureDimensions_686ef2(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp isamplerCube arg_0_1; +void textureDimensions_686ef2() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1); +} + +void fragment_main() { + textureDimensions_686ef2(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp isamplerCube arg_0_1; +void textureDimensions_686ef2() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1); +} + +void compute_main() { + textureDimensions_686ef2(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/686ef2.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/686ef2.wgsl.expected.hlsl new file mode 100644 index 0000000000..eeccbd6628 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/686ef2.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +TextureCube arg_0 : register(t0, space1); + +void textureDimensions_686ef2() { + int arg_1 = 0; + int3 tint_tmp; + arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_686ef2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_686ef2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_686ef2(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/686ef2.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/686ef2.wgsl.expected.msl new file mode 100644 index 0000000000..c934b1fcb9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/686ef2.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void textureDimensions_686ef2(texturecube tint_symbol_1) { + int arg_1 = 0; + int2 res = int2(tint_symbol_1.get_width(arg_1), tint_symbol_1.get_height(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube tint_symbol_2) { + textureDimensions_686ef2(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube tint_symbol_4 [[texture(0)]]) { + textureDimensions_686ef2(tint_symbol_4); + return; +} + +kernel void compute_main(texturecube tint_symbol_5 [[texture(0)]]) { + textureDimensions_686ef2(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/686ef2.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/686ef2.wgsl.expected.spvasm new file mode 100644 index 0000000000..83b84ec8e1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/686ef2.wgsl.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_686ef2 "textureDimensions_686ef2" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int Cube 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %17 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %26 = OpConstantNull %v2int + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_686ef2 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %17 + %res = OpVariable %_ptr_Function_v2int Function %26 + OpStore %arg_1 %17 + %22 = OpLoad %11 %arg_0 + %23 = OpLoad %int %arg_1 + %20 = OpImageQuerySizeLod %v2int %22 %23 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %textureDimensions_686ef2 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_686ef2 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %39 = OpLabel + %40 = OpFunctionCall %void %textureDimensions_686ef2 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/686ef2.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/686ef2.wgsl.expected.wgsl new file mode 100644 index 0000000000..19de8f06da --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/686ef2.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +@group(1) @binding(0) var arg_0 : texture_cube; + +fn textureDimensions_686ef2() { + var arg_1 = 0; + var res : vec2 = textureDimensions(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_686ef2(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_686ef2(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_686ef2(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/6adac6.wgsl b/test/tint/builtins/gen/var/textureDimensions/6adac6.wgsl new file mode 100644 index 0000000000..d079cf96b7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/6adac6.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureDimensions(texture: texture_storage_1d) -> i32 +fn textureDimensions_6adac6() { + var res: i32 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_6adac6(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_6adac6(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_6adac6(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/6adac6.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/6adac6.wgsl.expected.glsl new file mode 100644 index 0000000000..acaaa5adf0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/6adac6.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +layout(rgba32i) uniform highp writeonly iimage1D arg_0; +void textureDimensions_6adac6() { + int res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_6adac6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'iimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rgba32i) uniform highp writeonly iimage1D arg_0; +void textureDimensions_6adac6() { + int res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_6adac6(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'iimage1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rgba32i) uniform highp writeonly iimage1D arg_0; +void textureDimensions_6adac6() { + int res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_6adac6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'iimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/6adac6.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/6adac6.wgsl.expected.hlsl new file mode 100644 index 0000000000..52b2080c05 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/6adac6.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_6adac6() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_6adac6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_6adac6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_6adac6(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/6adac6.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/6adac6.wgsl.expected.msl new file mode 100644 index 0000000000..7087625943 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/6adac6.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_6adac6(texture1d tint_symbol_1) { + int res = int(tint_symbol_1.get_width(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureDimensions_6adac6(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureDimensions_6adac6(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureDimensions_6adac6(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/6adac6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/6adac6.wgsl.expected.spvasm new file mode 100644 index 0000000000..363af60804 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/6adac6.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Image1D + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_6adac6 "textureDimensions_6adac6" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 1D 0 0 0 2 Rgba32i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_6adac6 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %21 + %18 = OpLoad %11 %arg_0 + %17 = OpImageQuerySize %int %18 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %textureDimensions_6adac6 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %31 = OpLabel + %32 = OpFunctionCall %void %textureDimensions_6adac6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %void %textureDimensions_6adac6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/6adac6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/6adac6.wgsl.expected.wgsl new file mode 100644 index 0000000000..c48c479c52 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/6adac6.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureDimensions_6adac6() { + var res : i32 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_6adac6(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_6adac6(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_6adac6(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/6ec1b4.wgsl b/test/tint/builtins/gen/var/textureDimensions/6ec1b4.wgsl new file mode 100644 index 0000000000..eaab1916bb --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/6ec1b4.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_3d; + +// fn textureDimensions(texture: texture_3d) -> vec3 +fn textureDimensions_6ec1b4() { + var res: vec3 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_6ec1b4(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_6ec1b4(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_6ec1b4(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/6ec1b4.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/6ec1b4.wgsl.expected.glsl new file mode 100644 index 0000000000..482455da81 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/6ec1b4.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp usampler3D arg_0_1; +void textureDimensions_6ec1b4() { + ivec3 res = textureSize(arg_0_1, 0); +} + +vec4 vertex_main() { + textureDimensions_6ec1b4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp usampler3D arg_0_1; +void textureDimensions_6ec1b4() { + ivec3 res = textureSize(arg_0_1, 0); +} + +void fragment_main() { + textureDimensions_6ec1b4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp usampler3D arg_0_1; +void textureDimensions_6ec1b4() { + ivec3 res = textureSize(arg_0_1, 0); +} + +void compute_main() { + textureDimensions_6ec1b4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/6ec1b4.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/6ec1b4.wgsl.expected.hlsl new file mode 100644 index 0000000000..6e9cb1f014 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/6ec1b4.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +Texture3D arg_0 : register(t0, space1); + +void textureDimensions_6ec1b4() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_6ec1b4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_6ec1b4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_6ec1b4(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/6ec1b4.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/6ec1b4.wgsl.expected.msl new file mode 100644 index 0000000000..52a3369bb2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/6ec1b4.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_6ec1b4(texture3d tint_symbol_1) { + int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureDimensions_6ec1b4(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureDimensions_6ec1b4(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureDimensions_6ec1b4(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/6ec1b4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/6ec1b4.wgsl.expected.spvasm new file mode 100644 index 0000000000..4f8be173ec --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/6ec1b4.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_6ec1b4 "textureDimensions_6ec1b4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 3D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %int_0 = OpConstant %int 0 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %24 = OpConstantNull %v3int + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_6ec1b4 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v3int Function %24 + %20 = OpLoad %11 %arg_0 + %17 = OpImageQuerySizeLod %v3int %20 %int_0 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %textureDimensions_6ec1b4 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %void %textureDimensions_6ec1b4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %37 = OpLabel + %38 = OpFunctionCall %void %textureDimensions_6ec1b4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/6ec1b4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/6ec1b4.wgsl.expected.wgsl new file mode 100644 index 0000000000..6cc7cc1946 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/6ec1b4.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_3d; + +fn textureDimensions_6ec1b4() { + var res : vec3 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_6ec1b4(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_6ec1b4(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_6ec1b4(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/6f0d79.wgsl b/test/tint/builtins/gen/var/textureDimensions/6f0d79.wgsl new file mode 100644 index 0000000000..05ff7506bd --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/6f0d79.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureDimensions(texture: texture_storage_2d_array) -> vec2 +fn textureDimensions_6f0d79() { + var res: vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_6f0d79(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_6f0d79(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_6f0d79(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/6f0d79.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/6f0d79.wgsl.expected.glsl new file mode 100644 index 0000000000..71893cbbf0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/6f0d79.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba8_snorm) uniform highp writeonly image2DArray arg_0; +void textureDimensions_6f0d79() { + ivec2 res = imageSize(arg_0).xy; +} + +vec4 vertex_main() { + textureDimensions_6f0d79(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8_snorm) uniform highp writeonly image2DArray arg_0; +void textureDimensions_6f0d79() { + ivec2 res = imageSize(arg_0).xy; +} + +void fragment_main() { + textureDimensions_6f0d79(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8_snorm) uniform highp writeonly image2DArray arg_0; +void textureDimensions_6f0d79() { + ivec2 res = imageSize(arg_0).xy; +} + +void compute_main() { + textureDimensions_6f0d79(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/6f0d79.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/6f0d79.wgsl.expected.hlsl new file mode 100644 index 0000000000..cd1a3a48fd --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/6f0d79.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_6f0d79() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_6f0d79(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_6f0d79(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_6f0d79(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/6f0d79.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/6f0d79.wgsl.expected.msl new file mode 100644 index 0000000000..5154f6cfbf --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/6f0d79.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_6f0d79(texture2d_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureDimensions_6f0d79(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_6f0d79(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_6f0d79(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/6f0d79.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/6f0d79.wgsl.expected.spvasm new file mode 100644 index 0000000000..f1032b6920 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/6f0d79.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_6f0d79 "textureDimensions_6f0d79" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 2 Rgba8Snorm +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %24 = OpConstantNull %v2int + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_6f0d79 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %24 + %21 = OpLoad %11 %arg_0 + %19 = OpImageQuerySize %v3int %21 + %16 = OpVectorShuffle %v2int %19 %19 0 1 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %textureDimensions_6f0d79 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %34 = OpLabel + %35 = OpFunctionCall %void %textureDimensions_6f0d79 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %37 = OpLabel + %38 = OpFunctionCall %void %textureDimensions_6f0d79 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/6f0d79.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/6f0d79.wgsl.expected.wgsl new file mode 100644 index 0000000000..7b1f32c816 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/6f0d79.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureDimensions_6f0d79() { + var res : vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_6f0d79(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_6f0d79(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_6f0d79(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/702c53.wgsl b/test/tint/builtins/gen/var/textureDimensions/702c53.wgsl new file mode 100644 index 0000000000..0673cb460d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/702c53.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureDimensions(texture: texture_storage_2d) -> vec2 +fn textureDimensions_702c53() { + var res: vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_702c53(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_702c53(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_702c53(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/702c53.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/702c53.wgsl.expected.glsl new file mode 100644 index 0000000000..e4f0c34dd6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/702c53.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba8) uniform highp writeonly image2D arg_0; +void textureDimensions_702c53() { + ivec2 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_702c53(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8) uniform highp writeonly image2D arg_0; +void textureDimensions_702c53() { + ivec2 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_702c53(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8) uniform highp writeonly image2D arg_0; +void textureDimensions_702c53() { + ivec2 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_702c53(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/702c53.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/702c53.wgsl.expected.hlsl new file mode 100644 index 0000000000..40c27c8f76 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/702c53.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_702c53() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_702c53(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_702c53(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_702c53(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/702c53.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/702c53.wgsl.expected.msl new file mode 100644 index 0000000000..d202631130 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/702c53.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_702c53(texture2d tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureDimensions_702c53(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_702c53(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_702c53(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/702c53.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/702c53.wgsl.expected.spvasm new file mode 100644 index 0000000000..514d19ff32 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/702c53.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_702c53 "textureDimensions_702c53" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 2 Rgba8 +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %22 = OpConstantNull %v2int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_702c53 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %22 + %19 = OpLoad %11 %arg_0 + %16 = OpImageQuerySize %v2int %19 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureDimensions_702c53 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %void %textureDimensions_702c53 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_702c53 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/702c53.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/702c53.wgsl.expected.wgsl new file mode 100644 index 0000000000..27d3074777 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/702c53.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureDimensions_702c53() { + var res : vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_702c53(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_702c53(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_702c53(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/72e5d6.wgsl b/test/tint/builtins/gen/var/textureDimensions/72e5d6.wgsl new file mode 100644 index 0000000000..92e43ae11b --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/72e5d6.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d_array; + +// fn textureDimensions(texture: texture_depth_2d_array, level: i32) -> vec2 +fn textureDimensions_72e5d6() { + var arg_1 = 0; + var res: vec2 = textureDimensions(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_72e5d6(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_72e5d6(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_72e5d6(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/72e5d6.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/72e5d6.wgsl.expected.glsl new file mode 100644 index 0000000000..1b5be59272 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/72e5d6.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp sampler2DArray arg_0_1; +void textureDimensions_72e5d6() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1).xy; +} + +vec4 vertex_main() { + textureDimensions_72e5d6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DArray arg_0_1; +void textureDimensions_72e5d6() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1).xy; +} + +void fragment_main() { + textureDimensions_72e5d6(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DArray arg_0_1; +void textureDimensions_72e5d6() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1).xy; +} + +void compute_main() { + textureDimensions_72e5d6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/72e5d6.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/72e5d6.wgsl.expected.hlsl new file mode 100644 index 0000000000..71a9484b3a --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/72e5d6.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureDimensions_72e5d6() { + int arg_1 = 0; + int4 tint_tmp; + arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_72e5d6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_72e5d6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_72e5d6(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/72e5d6.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/72e5d6.wgsl.expected.msl new file mode 100644 index 0000000000..d022c05937 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/72e5d6.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void textureDimensions_72e5d6(depth2d_array tint_symbol_1) { + int arg_1 = 0; + int2 res = int2(tint_symbol_1.get_width(arg_1), tint_symbol_1.get_height(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d_array tint_symbol_2) { + textureDimensions_72e5d6(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_72e5d6(tint_symbol_4); + return; +} + +kernel void compute_main(depth2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_72e5d6(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/72e5d6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/72e5d6.wgsl.expected.spvasm new file mode 100644 index 0000000000..882e22c43f --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/72e5d6.wgsl.expected.spvasm @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_72e5d6 "textureDimensions_72e5d6" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %17 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %28 = OpConstantNull %v2int + %29 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_72e5d6 = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %17 + %res = OpVariable %_ptr_Function_v2int Function %28 + OpStore %arg_1 %17 + %24 = OpLoad %11 %arg_0 + %25 = OpLoad %int %arg_1 + %22 = OpImageQuerySizeLod %v3int %24 %25 + %20 = OpVectorShuffle %v2int %22 %22 0 1 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %29 + %31 = OpLabel + %32 = OpFunctionCall %void %textureDimensions_72e5d6 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %34 = OpLabel + %35 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %35 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %38 = OpLabel + %39 = OpFunctionCall %void %textureDimensions_72e5d6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %41 = OpLabel + %42 = OpFunctionCall %void %textureDimensions_72e5d6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/72e5d6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/72e5d6.wgsl.expected.wgsl new file mode 100644 index 0000000000..7789fbc8f5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/72e5d6.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d_array; + +fn textureDimensions_72e5d6() { + var arg_1 = 0; + var res : vec2 = textureDimensions(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_72e5d6(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_72e5d6(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_72e5d6(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/79df87.wgsl b/test/tint/builtins/gen/var/textureDimensions/79df87.wgsl new file mode 100644 index 0000000000..868f9d9ec1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/79df87.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_1d; + +// fn textureDimensions(texture: texture_1d, level: i32) -> i32 +fn textureDimensions_79df87() { + var arg_1 = 0; + var res: i32 = textureDimensions(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_79df87(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_79df87(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_79df87(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/79df87.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/79df87.wgsl.expected.glsl new file mode 100644 index 0000000000..1b5edf0262 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/79df87.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp usampler1D arg_0_1; +void textureDimensions_79df87() { + int arg_1 = 0; + int res = textureSize(arg_0_1, arg_1); +} + +vec4 vertex_main() { + textureDimensions_79df87(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'usampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp usampler1D arg_0_1; +void textureDimensions_79df87() { + int arg_1 = 0; + int res = textureSize(arg_0_1, arg_1); +} + +void fragment_main() { + textureDimensions_79df87(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'usampler1D' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp usampler1D arg_0_1; +void textureDimensions_79df87() { + int arg_1 = 0; + int res = textureSize(arg_0_1, arg_1); +} + +void compute_main() { + textureDimensions_79df87(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'usampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/79df87.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/79df87.wgsl.expected.hlsl new file mode 100644 index 0000000000..d2bf772328 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/79df87.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +Texture1D arg_0 : register(t0, space1); + +void textureDimensions_79df87() { + int arg_1 = 0; + int2 tint_tmp; + arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y); + int res = tint_tmp.x; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_79df87(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_79df87(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_79df87(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/79df87.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/79df87.wgsl.expected.msl new file mode 100644 index 0000000000..77b77b0f35 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/79df87.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void textureDimensions_79df87(texture1d tint_symbol_1) { + int arg_1 = 0; + int res = int(tint_symbol_1.get_width(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureDimensions_79df87(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureDimensions_79df87(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureDimensions_79df87(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/79df87.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/79df87.wgsl.expected.spvasm new file mode 100644 index 0000000000..4c4689a931 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/79df87.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability Sampled1D + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_79df87 "textureDimensions_79df87" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 1D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %18 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_79df87 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %18 + %res = OpVariable %_ptr_Function_int Function %18 + OpStore %arg_1 %18 + %22 = OpLoad %11 %arg_0 + %23 = OpLoad %int %arg_1 + %21 = OpImageQuerySizeLod %int %22 %23 + OpStore %res %21 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %textureDimensions_79df87 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %void %textureDimensions_79df87 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %37 = OpLabel + %38 = OpFunctionCall %void %textureDimensions_79df87 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/79df87.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/79df87.wgsl.expected.wgsl new file mode 100644 index 0000000000..3029f41870 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/79df87.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +@group(1) @binding(0) var arg_0 : texture_1d; + +fn textureDimensions_79df87() { + var arg_1 = 0; + var res : i32 = textureDimensions(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_79df87(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_79df87(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_79df87(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/7bf826.wgsl b/test/tint/builtins/gen/var/textureDimensions/7bf826.wgsl new file mode 100644 index 0000000000..6297e5a335 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/7bf826.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d_array; + +// fn textureDimensions(texture: texture_depth_2d_array) -> vec2 +fn textureDimensions_7bf826() { + var res: vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_7bf826(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_7bf826(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_7bf826(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/7bf826.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/7bf826.wgsl.expected.glsl new file mode 100644 index 0000000000..9859cdd941 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/7bf826.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp sampler2DArray arg_0_1; +void textureDimensions_7bf826() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +vec4 vertex_main() { + textureDimensions_7bf826(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DArray arg_0_1; +void textureDimensions_7bf826() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +void fragment_main() { + textureDimensions_7bf826(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DArray arg_0_1; +void textureDimensions_7bf826() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +void compute_main() { + textureDimensions_7bf826(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/7bf826.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/7bf826.wgsl.expected.hlsl new file mode 100644 index 0000000000..9c0e675218 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/7bf826.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureDimensions_7bf826() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_7bf826(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_7bf826(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_7bf826(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/7bf826.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/7bf826.wgsl.expected.msl new file mode 100644 index 0000000000..59cd3739f0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/7bf826.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_7bf826(depth2d_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d_array tint_symbol_2) { + textureDimensions_7bf826(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_7bf826(tint_symbol_4); + return; +} + +kernel void compute_main(depth2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_7bf826(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/7bf826.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/7bf826.wgsl.expected.spvasm new file mode 100644 index 0000000000..2229e184ac --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/7bf826.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_7bf826 "textureDimensions_7bf826" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 + %int_0 = OpConstant %int 0 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %25 = OpConstantNull %v2int + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_7bf826 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %25 + %21 = OpLoad %11 %arg_0 + %19 = OpImageQuerySizeLod %v3int %21 %int_0 + %16 = OpVectorShuffle %v2int %19 %19 0 1 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %textureDimensions_7bf826 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_7bf826 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %38 = OpLabel + %39 = OpFunctionCall %void %textureDimensions_7bf826 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/7bf826.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/7bf826.wgsl.expected.wgsl new file mode 100644 index 0000000000..50ddae7146 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/7bf826.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d_array; + +fn textureDimensions_7bf826() { + var res : vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_7bf826(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_7bf826(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_7bf826(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/7f5c2e.wgsl b/test/tint/builtins/gen/var/textureDimensions/7f5c2e.wgsl new file mode 100644 index 0000000000..97ce4ddafd --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/7f5c2e.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureDimensions(texture: texture_storage_2d) -> vec2 +fn textureDimensions_7f5c2e() { + var res: vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_7f5c2e(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_7f5c2e(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_7f5c2e(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/7f5c2e.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/7f5c2e.wgsl.expected.glsl new file mode 100644 index 0000000000..ed85e7deb1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/7f5c2e.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32i) uniform highp writeonly iimage2D arg_0; +void textureDimensions_7f5c2e() { + ivec2 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_7f5c2e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32i) uniform highp writeonly iimage2D arg_0; +void textureDimensions_7f5c2e() { + ivec2 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_7f5c2e(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32i) uniform highp writeonly iimage2D arg_0; +void textureDimensions_7f5c2e() { + ivec2 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_7f5c2e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/7f5c2e.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/7f5c2e.wgsl.expected.hlsl new file mode 100644 index 0000000000..9c6abe3894 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/7f5c2e.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_7f5c2e() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_7f5c2e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_7f5c2e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_7f5c2e(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/7f5c2e.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/7f5c2e.wgsl.expected.msl new file mode 100644 index 0000000000..f853ebcebf --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/7f5c2e.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_7f5c2e(texture2d tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureDimensions_7f5c2e(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_7f5c2e(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_7f5c2e(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/7f5c2e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/7f5c2e.wgsl.expected.spvasm new file mode 100644 index 0000000000..5a25cc105f --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/7f5c2e.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability StorageImageExtendedFormats + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_7f5c2e "textureDimensions_7f5c2e" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 0 0 2 Rg32i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %22 = OpConstantNull %v2int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_7f5c2e = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %22 + %19 = OpLoad %11 %arg_0 + %17 = OpImageQuerySize %v2int %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureDimensions_7f5c2e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %32 = OpLabel + %33 = OpFunctionCall %void %textureDimensions_7f5c2e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_7f5c2e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/7f5c2e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/7f5c2e.wgsl.expected.wgsl new file mode 100644 index 0000000000..0eecf68fd2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/7f5c2e.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureDimensions_7f5c2e() { + var res : vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_7f5c2e(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_7f5c2e(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_7f5c2e(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/8028f3.wgsl b/test/tint/builtins/gen/var/textureDimensions/8028f3.wgsl new file mode 100644 index 0000000000..b478fa2d96 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/8028f3.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureDimensions(texture: texture_storage_3d) -> vec3 +fn textureDimensions_8028f3() { + var res: vec3 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_8028f3(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_8028f3(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_8028f3(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/8028f3.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/8028f3.wgsl.expected.glsl new file mode 100644 index 0000000000..4ac9ac9786 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/8028f3.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(r32f) uniform highp writeonly image3D arg_0; +void textureDimensions_8028f3() { + ivec3 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_8028f3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(r32f) uniform highp writeonly image3D arg_0; +void textureDimensions_8028f3() { + ivec3 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_8028f3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(r32f) uniform highp writeonly image3D arg_0; +void textureDimensions_8028f3() { + ivec3 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_8028f3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/8028f3.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/8028f3.wgsl.expected.hlsl new file mode 100644 index 0000000000..f18db34932 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/8028f3.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_8028f3() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_8028f3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_8028f3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_8028f3(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/8028f3.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/8028f3.wgsl.expected.msl new file mode 100644 index 0000000000..efc7793dda --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/8028f3.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_8028f3(texture3d tint_symbol_1) { + int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureDimensions_8028f3(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureDimensions_8028f3(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureDimensions_8028f3(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/8028f3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/8028f3.wgsl.expected.spvasm new file mode 100644 index 0000000000..814b999de5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/8028f3.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_8028f3 "textureDimensions_8028f3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 3D 0 0 0 2 R32f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %22 = OpConstantNull %v3int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_8028f3 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v3int Function %22 + %19 = OpLoad %11 %arg_0 + %16 = OpImageQuerySize %v3int %19 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureDimensions_8028f3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %void %textureDimensions_8028f3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_8028f3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/8028f3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/8028f3.wgsl.expected.wgsl new file mode 100644 index 0000000000..7ad57279ae --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/8028f3.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureDimensions_8028f3() { + var res : vec3 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_8028f3(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_8028f3(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_8028f3(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/811679.wgsl b/test/tint/builtins/gen/var/textureDimensions/811679.wgsl new file mode 100644 index 0000000000..7d7722d4f0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/811679.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureDimensions(texture: texture_storage_3d) -> vec3 +fn textureDimensions_811679() { + var res: vec3 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_811679(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_811679(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_811679(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/811679.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/811679.wgsl.expected.glsl new file mode 100644 index 0000000000..152d367823 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/811679.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba32ui) uniform highp writeonly uimage3D arg_0; +void textureDimensions_811679() { + ivec3 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_811679(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba32ui) uniform highp writeonly uimage3D arg_0; +void textureDimensions_811679() { + ivec3 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_811679(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba32ui) uniform highp writeonly uimage3D arg_0; +void textureDimensions_811679() { + ivec3 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_811679(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/811679.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/811679.wgsl.expected.hlsl new file mode 100644 index 0000000000..a474cba784 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/811679.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_811679() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_811679(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_811679(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_811679(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/811679.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/811679.wgsl.expected.msl new file mode 100644 index 0000000000..825c3ade50 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/811679.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_811679(texture3d tint_symbol_1) { + int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureDimensions_811679(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureDimensions_811679(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureDimensions_811679(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/811679.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/811679.wgsl.expected.spvasm new file mode 100644 index 0000000000..c051822017 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/811679.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_811679 "textureDimensions_811679" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 3D 0 0 0 2 Rgba32ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %23 = OpConstantNull %v3int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_811679 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v3int Function %23 + %20 = OpLoad %11 %arg_0 + %17 = OpImageQuerySize %v3int %20 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureDimensions_811679 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %33 = OpLabel + %34 = OpFunctionCall %void %textureDimensions_811679 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_811679 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/811679.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/811679.wgsl.expected.wgsl new file mode 100644 index 0000000000..154cddebb4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/811679.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureDimensions_811679() { + var res : vec3 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_811679(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_811679(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_811679(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/820596.wgsl b/test/tint/builtins/gen/var/textureDimensions/820596.wgsl new file mode 100644 index 0000000000..8ec3269dce --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/820596.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureDimensions(texture: texture_storage_3d) -> vec3 +fn textureDimensions_820596() { + var res: vec3 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_820596(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_820596(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_820596(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/820596.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/820596.wgsl.expected.glsl new file mode 100644 index 0000000000..12ee4ecbbe --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/820596.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32ui) uniform highp writeonly uimage3D arg_0; +void textureDimensions_820596() { + ivec3 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_820596(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32ui) uniform highp writeonly uimage3D arg_0; +void textureDimensions_820596() { + ivec3 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_820596(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32ui) uniform highp writeonly uimage3D arg_0; +void textureDimensions_820596() { + ivec3 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_820596(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/820596.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/820596.wgsl.expected.hlsl new file mode 100644 index 0000000000..af2f262f81 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/820596.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_820596() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_820596(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_820596(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_820596(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/820596.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/820596.wgsl.expected.msl new file mode 100644 index 0000000000..1ecf8c985c --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/820596.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_820596(texture3d tint_symbol_1) { + int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureDimensions_820596(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureDimensions_820596(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureDimensions_820596(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/820596.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/820596.wgsl.expected.spvasm new file mode 100644 index 0000000000..a657294634 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/820596.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability StorageImageExtendedFormats + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_820596 "textureDimensions_820596" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 3D 0 0 0 2 Rg32ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %23 = OpConstantNull %v3int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_820596 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v3int Function %23 + %20 = OpLoad %11 %arg_0 + %17 = OpImageQuerySize %v3int %20 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureDimensions_820596 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %33 = OpLabel + %34 = OpFunctionCall %void %textureDimensions_820596 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_820596 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/820596.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/820596.wgsl.expected.wgsl new file mode 100644 index 0000000000..93106d5a90 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/820596.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureDimensions_820596() { + var res : vec3 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_820596(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_820596(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_820596(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/83ee5a.wgsl b/test/tint/builtins/gen/var/textureDimensions/83ee5a.wgsl new file mode 100644 index 0000000000..bdd0b53c32 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/83ee5a.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureDimensions(texture: texture_storage_2d) -> vec2 +fn textureDimensions_83ee5a() { + var res: vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_83ee5a(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_83ee5a(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_83ee5a(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/83ee5a.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/83ee5a.wgsl.expected.glsl new file mode 100644 index 0000000000..1f6ce583e6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/83ee5a.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba32i) uniform highp writeonly iimage2D arg_0; +void textureDimensions_83ee5a() { + ivec2 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_83ee5a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba32i) uniform highp writeonly iimage2D arg_0; +void textureDimensions_83ee5a() { + ivec2 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_83ee5a(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba32i) uniform highp writeonly iimage2D arg_0; +void textureDimensions_83ee5a() { + ivec2 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_83ee5a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/83ee5a.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/83ee5a.wgsl.expected.hlsl new file mode 100644 index 0000000000..efa903aa81 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/83ee5a.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_83ee5a() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_83ee5a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_83ee5a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_83ee5a(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/83ee5a.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/83ee5a.wgsl.expected.msl new file mode 100644 index 0000000000..29cff8f6c4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/83ee5a.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_83ee5a(texture2d tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureDimensions_83ee5a(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_83ee5a(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_83ee5a(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/83ee5a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/83ee5a.wgsl.expected.spvasm new file mode 100644 index 0000000000..32e7431649 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/83ee5a.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_83ee5a "textureDimensions_83ee5a" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 0 0 2 Rgba32i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %22 = OpConstantNull %v2int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_83ee5a = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %22 + %19 = OpLoad %11 %arg_0 + %17 = OpImageQuerySize %v2int %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureDimensions_83ee5a + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %32 = OpLabel + %33 = OpFunctionCall %void %textureDimensions_83ee5a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_83ee5a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/83ee5a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/83ee5a.wgsl.expected.wgsl new file mode 100644 index 0000000000..3481e3c102 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/83ee5a.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureDimensions_83ee5a() { + var res : vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_83ee5a(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_83ee5a(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_83ee5a(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/85d556.wgsl b/test/tint/builtins/gen/var/textureDimensions/85d556.wgsl new file mode 100644 index 0000000000..10a4318e5e --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/85d556.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; + +// fn textureDimensions(texture: texture_2d_array, level: i32) -> vec2 +fn textureDimensions_85d556() { + var arg_1 = 0; + var res: vec2 = textureDimensions(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_85d556(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_85d556(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_85d556(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/85d556.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/85d556.wgsl.expected.glsl new file mode 100644 index 0000000000..0186d41694 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/85d556.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp sampler2DArray arg_0_1; +void textureDimensions_85d556() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1).xy; +} + +vec4 vertex_main() { + textureDimensions_85d556(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DArray arg_0_1; +void textureDimensions_85d556() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1).xy; +} + +void fragment_main() { + textureDimensions_85d556(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DArray arg_0_1; +void textureDimensions_85d556() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1).xy; +} + +void compute_main() { + textureDimensions_85d556(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/85d556.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/85d556.wgsl.expected.hlsl new file mode 100644 index 0000000000..383bb7d313 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/85d556.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureDimensions_85d556() { + int arg_1 = 0; + int4 tint_tmp; + arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_85d556(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_85d556(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_85d556(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/85d556.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/85d556.wgsl.expected.msl new file mode 100644 index 0000000000..ee20395c33 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/85d556.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void textureDimensions_85d556(texture2d_array tint_symbol_1) { + int arg_1 = 0; + int2 res = int2(tint_symbol_1.get_width(arg_1), tint_symbol_1.get_height(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureDimensions_85d556(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_85d556(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_85d556(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/85d556.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/85d556.wgsl.expected.spvasm new file mode 100644 index 0000000000..e15046a773 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/85d556.wgsl.expected.spvasm @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_85d556 "textureDimensions_85d556" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %17 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %28 = OpConstantNull %v2int + %29 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_85d556 = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %17 + %res = OpVariable %_ptr_Function_v2int Function %28 + OpStore %arg_1 %17 + %24 = OpLoad %11 %arg_0 + %25 = OpLoad %int %arg_1 + %22 = OpImageQuerySizeLod %v3int %24 %25 + %20 = OpVectorShuffle %v2int %22 %22 0 1 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %29 + %31 = OpLabel + %32 = OpFunctionCall %void %textureDimensions_85d556 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %34 = OpLabel + %35 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %35 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %38 = OpLabel + %39 = OpFunctionCall %void %textureDimensions_85d556 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %41 = OpLabel + %42 = OpFunctionCall %void %textureDimensions_85d556 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/85d556.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/85d556.wgsl.expected.wgsl new file mode 100644 index 0000000000..55c3e24a7d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/85d556.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +fn textureDimensions_85d556() { + var arg_1 = 0; + var res : vec2 = textureDimensions(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_85d556(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_85d556(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_85d556(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/88ad17.wgsl b/test/tint/builtins/gen/var/textureDimensions/88ad17.wgsl new file mode 100644 index 0000000000..f64186a99e --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/88ad17.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube; + +// fn textureDimensions(texture: texture_cube, level: i32) -> vec2 +fn textureDimensions_88ad17() { + var arg_1 = 0; + var res: vec2 = textureDimensions(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_88ad17(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_88ad17(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_88ad17(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/88ad17.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/88ad17.wgsl.expected.glsl new file mode 100644 index 0000000000..5cfa74e4fa --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/88ad17.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp usamplerCube arg_0_1; +void textureDimensions_88ad17() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1); +} + +vec4 vertex_main() { + textureDimensions_88ad17(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp usamplerCube arg_0_1; +void textureDimensions_88ad17() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1); +} + +void fragment_main() { + textureDimensions_88ad17(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp usamplerCube arg_0_1; +void textureDimensions_88ad17() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1); +} + +void compute_main() { + textureDimensions_88ad17(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/88ad17.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/88ad17.wgsl.expected.hlsl new file mode 100644 index 0000000000..4b443c7a6d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/88ad17.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +TextureCube arg_0 : register(t0, space1); + +void textureDimensions_88ad17() { + int arg_1 = 0; + int3 tint_tmp; + arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_88ad17(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_88ad17(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_88ad17(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/88ad17.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/88ad17.wgsl.expected.msl new file mode 100644 index 0000000000..6a00fb1ea0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/88ad17.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void textureDimensions_88ad17(texturecube tint_symbol_1) { + int arg_1 = 0; + int2 res = int2(tint_symbol_1.get_width(arg_1), tint_symbol_1.get_height(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube tint_symbol_2) { + textureDimensions_88ad17(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube tint_symbol_4 [[texture(0)]]) { + textureDimensions_88ad17(tint_symbol_4); + return; +} + +kernel void compute_main(texturecube tint_symbol_5 [[texture(0)]]) { + textureDimensions_88ad17(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/88ad17.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/88ad17.wgsl.expected.spvasm new file mode 100644 index 0000000000..c88dd065a1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/88ad17.wgsl.expected.spvasm @@ -0,0 +1,82 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 42 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_88ad17 "textureDimensions_88ad17" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint Cube 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %18 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %27 = OpConstantNull %v2int + %28 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_88ad17 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %18 + %res = OpVariable %_ptr_Function_v2int Function %27 + OpStore %arg_1 %18 + %23 = OpLoad %11 %arg_0 + %24 = OpLoad %int %arg_1 + %21 = OpImageQuerySizeLod %v2int %23 %24 + OpStore %res %21 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %28 + %30 = OpLabel + %31 = OpFunctionCall %void %textureDimensions_88ad17 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %33 = OpLabel + %34 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %34 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %37 = OpLabel + %38 = OpFunctionCall %void %textureDimensions_88ad17 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %40 = OpLabel + %41 = OpFunctionCall %void %textureDimensions_88ad17 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/88ad17.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/88ad17.wgsl.expected.wgsl new file mode 100644 index 0000000000..8a2f64b484 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/88ad17.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +@group(1) @binding(0) var arg_0 : texture_cube; + +fn textureDimensions_88ad17() { + var arg_1 = 0; + var res : vec2 = textureDimensions(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_88ad17(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_88ad17(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_88ad17(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/8aa4c4.wgsl b/test/tint/builtins/gen/var/textureDimensions/8aa4c4.wgsl new file mode 100644 index 0000000000..4468f2676d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/8aa4c4.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_3d; + +// fn textureDimensions(texture: texture_3d) -> vec3 +fn textureDimensions_8aa4c4() { + var res: vec3 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_8aa4c4(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_8aa4c4(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_8aa4c4(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/8aa4c4.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/8aa4c4.wgsl.expected.glsl new file mode 100644 index 0000000000..45495e95e6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/8aa4c4.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp sampler3D arg_0_1; +void textureDimensions_8aa4c4() { + ivec3 res = textureSize(arg_0_1, 0); +} + +vec4 vertex_main() { + textureDimensions_8aa4c4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler3D arg_0_1; +void textureDimensions_8aa4c4() { + ivec3 res = textureSize(arg_0_1, 0); +} + +void fragment_main() { + textureDimensions_8aa4c4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler3D arg_0_1; +void textureDimensions_8aa4c4() { + ivec3 res = textureSize(arg_0_1, 0); +} + +void compute_main() { + textureDimensions_8aa4c4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/8aa4c4.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/8aa4c4.wgsl.expected.hlsl new file mode 100644 index 0000000000..e8a2fa1d4b --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/8aa4c4.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +Texture3D arg_0 : register(t0, space1); + +void textureDimensions_8aa4c4() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_8aa4c4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_8aa4c4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_8aa4c4(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/8aa4c4.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/8aa4c4.wgsl.expected.msl new file mode 100644 index 0000000000..77f5715a6d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/8aa4c4.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_8aa4c4(texture3d tint_symbol_1) { + int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureDimensions_8aa4c4(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureDimensions_8aa4c4(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureDimensions_8aa4c4(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/8aa4c4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/8aa4c4.wgsl.expected.spvasm new file mode 100644 index 0000000000..4b2376f02d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/8aa4c4.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_8aa4c4 "textureDimensions_8aa4c4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 3D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %int_0 = OpConstant %int 0 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %23 = OpConstantNull %v3int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_8aa4c4 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v3int Function %23 + %19 = OpLoad %11 %arg_0 + %16 = OpImageQuerySizeLod %v3int %19 %int_0 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureDimensions_8aa4c4 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %33 = OpLabel + %34 = OpFunctionCall %void %textureDimensions_8aa4c4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_8aa4c4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/8aa4c4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/8aa4c4.wgsl.expected.wgsl new file mode 100644 index 0000000000..3a59eb68df --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/8aa4c4.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_3d; + +fn textureDimensions_8aa4c4() { + var res : vec3 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_8aa4c4(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_8aa4c4(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_8aa4c4(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/8deb5e.wgsl b/test/tint/builtins/gen/var/textureDimensions/8deb5e.wgsl new file mode 100644 index 0000000000..de87126016 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/8deb5e.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_3d; + +// fn textureDimensions(texture: texture_3d) -> vec3 +fn textureDimensions_8deb5e() { + var res: vec3 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_8deb5e(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_8deb5e(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_8deb5e(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/8deb5e.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/8deb5e.wgsl.expected.glsl new file mode 100644 index 0000000000..8869c19303 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/8deb5e.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp isampler3D arg_0_1; +void textureDimensions_8deb5e() { + ivec3 res = textureSize(arg_0_1, 0); +} + +vec4 vertex_main() { + textureDimensions_8deb5e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp isampler3D arg_0_1; +void textureDimensions_8deb5e() { + ivec3 res = textureSize(arg_0_1, 0); +} + +void fragment_main() { + textureDimensions_8deb5e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp isampler3D arg_0_1; +void textureDimensions_8deb5e() { + ivec3 res = textureSize(arg_0_1, 0); +} + +void compute_main() { + textureDimensions_8deb5e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/8deb5e.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/8deb5e.wgsl.expected.hlsl new file mode 100644 index 0000000000..398823e556 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/8deb5e.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +Texture3D arg_0 : register(t0, space1); + +void textureDimensions_8deb5e() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_8deb5e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_8deb5e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_8deb5e(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/8deb5e.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/8deb5e.wgsl.expected.msl new file mode 100644 index 0000000000..7899845cb3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/8deb5e.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_8deb5e(texture3d tint_symbol_1) { + int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureDimensions_8deb5e(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureDimensions_8deb5e(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureDimensions_8deb5e(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/8deb5e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/8deb5e.wgsl.expected.spvasm new file mode 100644 index 0000000000..7afdac336f --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/8deb5e.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_8deb5e "textureDimensions_8deb5e" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 3D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v3int = OpTypeVector %int 3 + %int_0 = OpConstant %int 0 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %23 = OpConstantNull %v3int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_8deb5e = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v3int Function %23 + %19 = OpLoad %11 %arg_0 + %17 = OpImageQuerySizeLod %v3int %19 %int_0 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureDimensions_8deb5e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %33 = OpLabel + %34 = OpFunctionCall %void %textureDimensions_8deb5e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_8deb5e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/8deb5e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/8deb5e.wgsl.expected.wgsl new file mode 100644 index 0000000000..1f088c3858 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/8deb5e.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_3d; + +fn textureDimensions_8deb5e() { + var res : vec3 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_8deb5e(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_8deb5e(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_8deb5e(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/8f20bf.wgsl b/test/tint/builtins/gen/var/textureDimensions/8f20bf.wgsl new file mode 100644 index 0000000000..ba505967cf --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/8f20bf.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube_array; + +// fn textureDimensions(texture: texture_cube_array) -> vec2 +fn textureDimensions_8f20bf() { + var res: vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_8f20bf(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_8f20bf(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_8f20bf(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/8f20bf.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/8f20bf.wgsl.expected.glsl new file mode 100644 index 0000000000..a01eead6eb --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/8f20bf.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +uniform highp samplerCubeArray arg_0_1; +void textureDimensions_8f20bf() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +vec4 vertex_main() { + textureDimensions_8f20bf(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp samplerCubeArray arg_0_1; +void textureDimensions_8f20bf() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +void fragment_main() { + textureDimensions_8f20bf(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'samplerCubeArray' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp samplerCubeArray arg_0_1; +void textureDimensions_8f20bf() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +void compute_main() { + textureDimensions_8f20bf(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/8f20bf.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/8f20bf.wgsl.expected.hlsl new file mode 100644 index 0000000000..58462cf470 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/8f20bf.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureDimensions_8f20bf() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_8f20bf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_8f20bf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_8f20bf(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/8f20bf.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/8f20bf.wgsl.expected.msl new file mode 100644 index 0000000000..431a4549c4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/8f20bf.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_8f20bf(texturecube_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube_array tint_symbol_2) { + textureDimensions_8f20bf(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_8f20bf(tint_symbol_4); + return; +} + +kernel void compute_main(texturecube_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_8f20bf(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/8f20bf.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/8f20bf.wgsl.expected.spvasm new file mode 100644 index 0000000000..952b3d4b02 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/8f20bf.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_8f20bf "textureDimensions_8f20bf" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 + %int_0 = OpConstant %int 0 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %25 = OpConstantNull %v2int + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_8f20bf = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %25 + %21 = OpLoad %11 %arg_0 + %19 = OpImageQuerySizeLod %v3int %21 %int_0 + %16 = OpVectorShuffle %v2int %19 %19 0 1 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %textureDimensions_8f20bf + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_8f20bf + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %38 = OpLabel + %39 = OpFunctionCall %void %textureDimensions_8f20bf + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/8f20bf.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/8f20bf.wgsl.expected.wgsl new file mode 100644 index 0000000000..e299daf159 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/8f20bf.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_cube_array; + +fn textureDimensions_8f20bf() { + var res : vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_8f20bf(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_8f20bf(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_8f20bf(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/8fca0f.wgsl b/test/tint/builtins/gen/var/textureDimensions/8fca0f.wgsl new file mode 100644 index 0000000000..ca949de724 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/8fca0f.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureDimensions(texture: texture_storage_3d) -> vec3 +fn textureDimensions_8fca0f() { + var res: vec3 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_8fca0f(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_8fca0f(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_8fca0f(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/8fca0f.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/8fca0f.wgsl.expected.glsl new file mode 100644 index 0000000000..255924ad16 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/8fca0f.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba32f) uniform highp writeonly image3D arg_0; +void textureDimensions_8fca0f() { + ivec3 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_8fca0f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba32f) uniform highp writeonly image3D arg_0; +void textureDimensions_8fca0f() { + ivec3 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_8fca0f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba32f) uniform highp writeonly image3D arg_0; +void textureDimensions_8fca0f() { + ivec3 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_8fca0f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/8fca0f.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/8fca0f.wgsl.expected.hlsl new file mode 100644 index 0000000000..ace86e03bd --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/8fca0f.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_8fca0f() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_8fca0f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_8fca0f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_8fca0f(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/8fca0f.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/8fca0f.wgsl.expected.msl new file mode 100644 index 0000000000..f104902483 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/8fca0f.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_8fca0f(texture3d tint_symbol_1) { + int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureDimensions_8fca0f(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureDimensions_8fca0f(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureDimensions_8fca0f(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/8fca0f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/8fca0f.wgsl.expected.spvasm new file mode 100644 index 0000000000..0f3281e3ee --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/8fca0f.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_8fca0f "textureDimensions_8fca0f" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 3D 0 0 0 2 Rgba32f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %22 = OpConstantNull %v3int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_8fca0f = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v3int Function %22 + %19 = OpLoad %11 %arg_0 + %16 = OpImageQuerySize %v3int %19 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureDimensions_8fca0f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %void %textureDimensions_8fca0f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_8fca0f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/8fca0f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/8fca0f.wgsl.expected.wgsl new file mode 100644 index 0000000000..4599b2e29a --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/8fca0f.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureDimensions_8fca0f() { + var res : vec3 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_8fca0f(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_8fca0f(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_8fca0f(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/90340b.wgsl b/test/tint/builtins/gen/var/textureDimensions/90340b.wgsl new file mode 100644 index 0000000000..4acb1f6412 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/90340b.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_cube_array; + +// fn textureDimensions(texture: texture_depth_cube_array) -> vec2 +fn textureDimensions_90340b() { + var res: vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_90340b(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_90340b(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_90340b(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/90340b.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/90340b.wgsl.expected.glsl new file mode 100644 index 0000000000..09d10eb7bb --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/90340b.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +uniform highp samplerCubeArray arg_0_1; +void textureDimensions_90340b() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +vec4 vertex_main() { + textureDimensions_90340b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp samplerCubeArray arg_0_1; +void textureDimensions_90340b() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +void fragment_main() { + textureDimensions_90340b(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'samplerCubeArray' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp samplerCubeArray arg_0_1; +void textureDimensions_90340b() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +void compute_main() { + textureDimensions_90340b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/90340b.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/90340b.wgsl.expected.hlsl new file mode 100644 index 0000000000..26df72fa72 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/90340b.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureDimensions_90340b() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_90340b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_90340b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_90340b(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/90340b.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/90340b.wgsl.expected.msl new file mode 100644 index 0000000000..f585531ed1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/90340b.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_90340b(depthcube_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depthcube_array tint_symbol_2) { + textureDimensions_90340b(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depthcube_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depthcube_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_90340b(tint_symbol_4); + return; +} + +kernel void compute_main(depthcube_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_90340b(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/90340b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/90340b.wgsl.expected.spvasm new file mode 100644 index 0000000000..5d4d7e7ef8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/90340b.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_90340b "textureDimensions_90340b" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 + %int_0 = OpConstant %int 0 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %25 = OpConstantNull %v2int + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_90340b = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %25 + %21 = OpLoad %11 %arg_0 + %19 = OpImageQuerySizeLod %v3int %21 %int_0 + %16 = OpVectorShuffle %v2int %19 %19 0 1 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %textureDimensions_90340b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_90340b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %38 = OpLabel + %39 = OpFunctionCall %void %textureDimensions_90340b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/90340b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/90340b.wgsl.expected.wgsl new file mode 100644 index 0000000000..2addbf1322 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/90340b.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_depth_cube_array; + +fn textureDimensions_90340b() { + var res : vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_90340b(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_90340b(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_90340b(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/9042ab.wgsl b/test/tint/builtins/gen/var/textureDimensions/9042ab.wgsl new file mode 100644 index 0000000000..6365cba61e --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9042ab.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureDimensions(texture: texture_storage_2d_array) -> vec2 +fn textureDimensions_9042ab() { + var res: vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_9042ab(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_9042ab(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_9042ab(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/9042ab.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/9042ab.wgsl.expected.glsl new file mode 100644 index 0000000000..1fb6520aad --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9042ab.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32ui) uniform highp writeonly uimage2DArray arg_0; +void textureDimensions_9042ab() { + ivec2 res = imageSize(arg_0).xy; +} + +vec4 vertex_main() { + textureDimensions_9042ab(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32ui) uniform highp writeonly uimage2DArray arg_0; +void textureDimensions_9042ab() { + ivec2 res = imageSize(arg_0).xy; +} + +void fragment_main() { + textureDimensions_9042ab(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32ui) uniform highp writeonly uimage2DArray arg_0; +void textureDimensions_9042ab() { + ivec2 res = imageSize(arg_0).xy; +} + +void compute_main() { + textureDimensions_9042ab(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/9042ab.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/9042ab.wgsl.expected.hlsl new file mode 100644 index 0000000000..95dc10539c --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9042ab.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_9042ab() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_9042ab(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_9042ab(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_9042ab(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/9042ab.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/9042ab.wgsl.expected.msl new file mode 100644 index 0000000000..5f29287b31 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9042ab.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_9042ab(texture2d_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureDimensions_9042ab(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_9042ab(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_9042ab(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/9042ab.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/9042ab.wgsl.expected.spvasm new file mode 100644 index 0000000000..d0099a03d5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9042ab.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability StorageImageExtendedFormats + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_9042ab "textureDimensions_9042ab" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 1 0 2 Rg32ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %25 = OpConstantNull %v2int + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_9042ab = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %25 + %22 = OpLoad %11 %arg_0 + %20 = OpImageQuerySize %v3int %22 + %17 = OpVectorShuffle %v2int %20 %20 0 1 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %textureDimensions_9042ab + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_9042ab + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %38 = OpLabel + %39 = OpFunctionCall %void %textureDimensions_9042ab + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/9042ab.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/9042ab.wgsl.expected.wgsl new file mode 100644 index 0000000000..a2d866661b --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9042ab.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureDimensions_9042ab() { + var res : vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_9042ab(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_9042ab(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_9042ab(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/9393b0.wgsl b/test/tint/builtins/gen/var/textureDimensions/9393b0.wgsl new file mode 100644 index 0000000000..2872414576 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9393b0.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_cube; + +// fn textureDimensions(texture: texture_depth_cube, level: i32) -> vec2 +fn textureDimensions_9393b0() { + var arg_1 = 0; + var res: vec2 = textureDimensions(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_9393b0(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_9393b0(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_9393b0(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/9393b0.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/9393b0.wgsl.expected.glsl new file mode 100644 index 0000000000..5faaac0985 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9393b0.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp samplerCube arg_0_1; +void textureDimensions_9393b0() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1); +} + +vec4 vertex_main() { + textureDimensions_9393b0(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp samplerCube arg_0_1; +void textureDimensions_9393b0() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1); +} + +void fragment_main() { + textureDimensions_9393b0(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp samplerCube arg_0_1; +void textureDimensions_9393b0() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1); +} + +void compute_main() { + textureDimensions_9393b0(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/9393b0.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/9393b0.wgsl.expected.hlsl new file mode 100644 index 0000000000..452ad7f916 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9393b0.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +TextureCube arg_0 : register(t0, space1); + +void textureDimensions_9393b0() { + int arg_1 = 0; + int3 tint_tmp; + arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_9393b0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_9393b0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_9393b0(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/9393b0.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/9393b0.wgsl.expected.msl new file mode 100644 index 0000000000..b564f162f6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9393b0.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void textureDimensions_9393b0(depthcube tint_symbol_1) { + int arg_1 = 0; + int2 res = int2(tint_symbol_1.get_width(arg_1), tint_symbol_1.get_height(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depthcube tint_symbol_2) { + textureDimensions_9393b0(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depthcube tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depthcube tint_symbol_4 [[texture(0)]]) { + textureDimensions_9393b0(tint_symbol_4); + return; +} + +kernel void compute_main(depthcube tint_symbol_5 [[texture(0)]]) { + textureDimensions_9393b0(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/9393b0.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/9393b0.wgsl.expected.spvasm new file mode 100644 index 0000000000..e7d10e9e71 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9393b0.wgsl.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_9393b0 "textureDimensions_9393b0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float Cube 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %17 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %26 = OpConstantNull %v2int + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_9393b0 = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %17 + %res = OpVariable %_ptr_Function_v2int Function %26 + OpStore %arg_1 %17 + %22 = OpLoad %11 %arg_0 + %23 = OpLoad %int %arg_1 + %20 = OpImageQuerySizeLod %v2int %22 %23 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %textureDimensions_9393b0 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_9393b0 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %39 = OpLabel + %40 = OpFunctionCall %void %textureDimensions_9393b0 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/9393b0.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/9393b0.wgsl.expected.wgsl new file mode 100644 index 0000000000..6243a7fe9d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9393b0.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +@group(1) @binding(0) var arg_0 : texture_depth_cube; + +fn textureDimensions_9393b0() { + var arg_1 = 0; + var res : vec2 = textureDimensions(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_9393b0(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_9393b0(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_9393b0(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/939fdb.wgsl b/test/tint/builtins/gen/var/textureDimensions/939fdb.wgsl new file mode 100644 index 0000000000..9852d37cf8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/939fdb.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d; + +// fn textureDimensions(texture: texture_depth_2d) -> vec2 +fn textureDimensions_939fdb() { + var res: vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_939fdb(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_939fdb(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_939fdb(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/939fdb.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/939fdb.wgsl.expected.glsl new file mode 100644 index 0000000000..380941ea5f --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/939fdb.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp sampler2D arg_0_1; +void textureDimensions_939fdb() { + ivec2 res = textureSize(arg_0_1, 0); +} + +vec4 vertex_main() { + textureDimensions_939fdb(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2D arg_0_1; +void textureDimensions_939fdb() { + ivec2 res = textureSize(arg_0_1, 0); +} + +void fragment_main() { + textureDimensions_939fdb(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2D arg_0_1; +void textureDimensions_939fdb() { + ivec2 res = textureSize(arg_0_1, 0); +} + +void compute_main() { + textureDimensions_939fdb(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/939fdb.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/939fdb.wgsl.expected.hlsl new file mode 100644 index 0000000000..1edab80e0e --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/939fdb.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_0 : register(t0, space1); + +void textureDimensions_939fdb() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_939fdb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_939fdb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_939fdb(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/939fdb.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/939fdb.wgsl.expected.msl new file mode 100644 index 0000000000..a6283fbd15 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/939fdb.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_939fdb(depth2d tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d tint_symbol_2) { + textureDimensions_939fdb(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_939fdb(tint_symbol_4); + return; +} + +kernel void compute_main(depth2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_939fdb(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/939fdb.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/939fdb.wgsl.expected.spvasm new file mode 100644 index 0000000000..7e41c36dc2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/939fdb.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_939fdb "textureDimensions_939fdb" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %int_0 = OpConstant %int 0 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %23 = OpConstantNull %v2int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_939fdb = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %23 + %19 = OpLoad %11 %arg_0 + %16 = OpImageQuerySizeLod %v2int %19 %int_0 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureDimensions_939fdb + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %33 = OpLabel + %34 = OpFunctionCall %void %textureDimensions_939fdb + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_939fdb + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/939fdb.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/939fdb.wgsl.expected.wgsl new file mode 100644 index 0000000000..12cc53592c --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/939fdb.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d; + +fn textureDimensions_939fdb() { + var res : vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_939fdb(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_939fdb(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_939fdb(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/962dcd.wgsl b/test/tint/builtins/gen/var/textureDimensions/962dcd.wgsl new file mode 100644 index 0000000000..fddb8289a4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/962dcd.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube; + +// fn textureDimensions(texture: texture_cube) -> vec2 +fn textureDimensions_962dcd() { + var res: vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_962dcd(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_962dcd(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_962dcd(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/962dcd.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/962dcd.wgsl.expected.glsl new file mode 100644 index 0000000000..ded4e4210b --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/962dcd.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp isamplerCube arg_0_1; +void textureDimensions_962dcd() { + ivec2 res = textureSize(arg_0_1, 0); +} + +vec4 vertex_main() { + textureDimensions_962dcd(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp isamplerCube arg_0_1; +void textureDimensions_962dcd() { + ivec2 res = textureSize(arg_0_1, 0); +} + +void fragment_main() { + textureDimensions_962dcd(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp isamplerCube arg_0_1; +void textureDimensions_962dcd() { + ivec2 res = textureSize(arg_0_1, 0); +} + +void compute_main() { + textureDimensions_962dcd(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/962dcd.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/962dcd.wgsl.expected.hlsl new file mode 100644 index 0000000000..7f1c1eb2a4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/962dcd.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +TextureCube arg_0 : register(t0, space1); + +void textureDimensions_962dcd() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_962dcd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_962dcd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_962dcd(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/962dcd.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/962dcd.wgsl.expected.msl new file mode 100644 index 0000000000..052154fa52 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/962dcd.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_962dcd(texturecube tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube tint_symbol_2) { + textureDimensions_962dcd(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube tint_symbol_4 [[texture(0)]]) { + textureDimensions_962dcd(tint_symbol_4); + return; +} + +kernel void compute_main(texturecube tint_symbol_5 [[texture(0)]]) { + textureDimensions_962dcd(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/962dcd.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/962dcd.wgsl.expected.spvasm new file mode 100644 index 0000000000..ceac95f3ae --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/962dcd.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_962dcd "textureDimensions_962dcd" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int Cube 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v2int = OpTypeVector %int 2 + %int_0 = OpConstant %int 0 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %23 = OpConstantNull %v2int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_962dcd = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %23 + %19 = OpLoad %11 %arg_0 + %17 = OpImageQuerySizeLod %v2int %19 %int_0 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureDimensions_962dcd + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %33 = OpLabel + %34 = OpFunctionCall %void %textureDimensions_962dcd + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_962dcd + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/962dcd.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/962dcd.wgsl.expected.wgsl new file mode 100644 index 0000000000..8c1d2563a5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/962dcd.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_cube; + +fn textureDimensions_962dcd() { + var res : vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_962dcd(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_962dcd(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_962dcd(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/9abfe5.wgsl b/test/tint/builtins/gen/var/textureDimensions/9abfe5.wgsl new file mode 100644 index 0000000000..4fea70cd28 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9abfe5.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureDimensions(texture: texture_storage_2d_array) -> vec2 +fn textureDimensions_9abfe5() { + var res: vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_9abfe5(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_9abfe5(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_9abfe5(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/9abfe5.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/9abfe5.wgsl.expected.glsl new file mode 100644 index 0000000000..0de8c91026 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9abfe5.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba32f) uniform highp writeonly image2DArray arg_0; +void textureDimensions_9abfe5() { + ivec2 res = imageSize(arg_0).xy; +} + +vec4 vertex_main() { + textureDimensions_9abfe5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba32f) uniform highp writeonly image2DArray arg_0; +void textureDimensions_9abfe5() { + ivec2 res = imageSize(arg_0).xy; +} + +void fragment_main() { + textureDimensions_9abfe5(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba32f) uniform highp writeonly image2DArray arg_0; +void textureDimensions_9abfe5() { + ivec2 res = imageSize(arg_0).xy; +} + +void compute_main() { + textureDimensions_9abfe5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/9abfe5.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/9abfe5.wgsl.expected.hlsl new file mode 100644 index 0000000000..d97dcf7f31 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9abfe5.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_9abfe5() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_9abfe5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_9abfe5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_9abfe5(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/9abfe5.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/9abfe5.wgsl.expected.msl new file mode 100644 index 0000000000..cc19962ad6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9abfe5.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_9abfe5(texture2d_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureDimensions_9abfe5(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_9abfe5(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_9abfe5(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/9abfe5.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/9abfe5.wgsl.expected.spvasm new file mode 100644 index 0000000000..6a733e8c35 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9abfe5.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_9abfe5 "textureDimensions_9abfe5" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 2 Rgba32f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %24 = OpConstantNull %v2int + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_9abfe5 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %24 + %21 = OpLoad %11 %arg_0 + %19 = OpImageQuerySize %v3int %21 + %16 = OpVectorShuffle %v2int %19 %19 0 1 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %textureDimensions_9abfe5 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %34 = OpLabel + %35 = OpFunctionCall %void %textureDimensions_9abfe5 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %37 = OpLabel + %38 = OpFunctionCall %void %textureDimensions_9abfe5 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/9abfe5.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/9abfe5.wgsl.expected.wgsl new file mode 100644 index 0000000000..fd979941fa --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9abfe5.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureDimensions_9abfe5() { + var res : vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_9abfe5(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_9abfe5(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_9abfe5(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/9c9c57.wgsl b/test/tint/builtins/gen/var/textureDimensions/9c9c57.wgsl new file mode 100644 index 0000000000..d04579d7ed --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9c9c57.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; + +// fn textureDimensions(texture: texture_2d_array, level: i32) -> vec2 +fn textureDimensions_9c9c57() { + var arg_1 = 0; + var res: vec2 = textureDimensions(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_9c9c57(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_9c9c57(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_9c9c57(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/9c9c57.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/9c9c57.wgsl.expected.glsl new file mode 100644 index 0000000000..09beab32d5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9c9c57.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp isampler2DArray arg_0_1; +void textureDimensions_9c9c57() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1).xy; +} + +vec4 vertex_main() { + textureDimensions_9c9c57(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp isampler2DArray arg_0_1; +void textureDimensions_9c9c57() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1).xy; +} + +void fragment_main() { + textureDimensions_9c9c57(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp isampler2DArray arg_0_1; +void textureDimensions_9c9c57() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1).xy; +} + +void compute_main() { + textureDimensions_9c9c57(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/9c9c57.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/9c9c57.wgsl.expected.hlsl new file mode 100644 index 0000000000..31b75d4d15 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9c9c57.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureDimensions_9c9c57() { + int arg_1 = 0; + int4 tint_tmp; + arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_9c9c57(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_9c9c57(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_9c9c57(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/9c9c57.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/9c9c57.wgsl.expected.msl new file mode 100644 index 0000000000..97807b6924 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9c9c57.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void textureDimensions_9c9c57(texture2d_array tint_symbol_1) { + int arg_1 = 0; + int2 res = int2(tint_symbol_1.get_width(arg_1), tint_symbol_1.get_height(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureDimensions_9c9c57(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_9c9c57(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_9c9c57(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/9c9c57.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/9c9c57.wgsl.expected.spvasm new file mode 100644 index 0000000000..f00858a94d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9c9c57.wgsl.expected.spvasm @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_9c9c57 "textureDimensions_9c9c57" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %17 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %28 = OpConstantNull %v2int + %29 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_9c9c57 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %17 + %res = OpVariable %_ptr_Function_v2int Function %28 + OpStore %arg_1 %17 + %24 = OpLoad %11 %arg_0 + %25 = OpLoad %int %arg_1 + %22 = OpImageQuerySizeLod %v3int %24 %25 + %20 = OpVectorShuffle %v2int %22 %22 0 1 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %29 + %31 = OpLabel + %32 = OpFunctionCall %void %textureDimensions_9c9c57 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %35 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %38 = OpLabel + %39 = OpFunctionCall %void %textureDimensions_9c9c57 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %41 = OpLabel + %42 = OpFunctionCall %void %textureDimensions_9c9c57 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/9c9c57.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/9c9c57.wgsl.expected.wgsl new file mode 100644 index 0000000000..dd5cf5b246 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9c9c57.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +fn textureDimensions_9c9c57() { + var arg_1 = 0; + var res : vec2 = textureDimensions(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_9c9c57(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_9c9c57(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_9c9c57(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/9da9e2.wgsl b/test/tint/builtins/gen/var/textureDimensions/9da9e2.wgsl new file mode 100644 index 0000000000..05e9f02a72 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9da9e2.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureDimensions(texture: texture_storage_1d) -> i32 +fn textureDimensions_9da9e2() { + var res: i32 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_9da9e2(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_9da9e2(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_9da9e2(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/9da9e2.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/9da9e2.wgsl.expected.glsl new file mode 100644 index 0000000000..5773b40625 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9da9e2.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +layout(rgba8i) uniform highp writeonly iimage1D arg_0; +void textureDimensions_9da9e2() { + int res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_9da9e2(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'iimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rgba8i) uniform highp writeonly iimage1D arg_0; +void textureDimensions_9da9e2() { + int res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_9da9e2(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'iimage1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rgba8i) uniform highp writeonly iimage1D arg_0; +void textureDimensions_9da9e2() { + int res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_9da9e2(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'iimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/9da9e2.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/9da9e2.wgsl.expected.hlsl new file mode 100644 index 0000000000..f500491b95 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9da9e2.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_9da9e2() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_9da9e2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_9da9e2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_9da9e2(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/9da9e2.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/9da9e2.wgsl.expected.msl new file mode 100644 index 0000000000..ea085fa528 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9da9e2.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_9da9e2(texture1d tint_symbol_1) { + int res = int(tint_symbol_1.get_width(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureDimensions_9da9e2(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureDimensions_9da9e2(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureDimensions_9da9e2(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/9da9e2.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/9da9e2.wgsl.expected.spvasm new file mode 100644 index 0000000000..edaecfe138 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9da9e2.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Image1D + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_9da9e2 "textureDimensions_9da9e2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 1D 0 0 0 2 Rgba8i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_9da9e2 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %21 + %18 = OpLoad %11 %arg_0 + %17 = OpImageQuerySize %int %18 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %textureDimensions_9da9e2 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %31 = OpLabel + %32 = OpFunctionCall %void %textureDimensions_9da9e2 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %void %textureDimensions_9da9e2 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/9da9e2.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/9da9e2.wgsl.expected.wgsl new file mode 100644 index 0000000000..3e1f941fcb --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9da9e2.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureDimensions_9da9e2() { + var res : i32 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_9da9e2(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_9da9e2(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_9da9e2(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/9eb8d8.wgsl b/test/tint/builtins/gen/var/textureDimensions/9eb8d8.wgsl new file mode 100644 index 0000000000..8a3f461c91 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9eb8d8.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureDimensions(texture: texture_storage_2d) -> vec2 +fn textureDimensions_9eb8d8() { + var res: vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_9eb8d8(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_9eb8d8(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_9eb8d8(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/9eb8d8.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/9eb8d8.wgsl.expected.glsl new file mode 100644 index 0000000000..6185ef1959 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9eb8d8.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(r32ui) uniform highp writeonly uimage2D arg_0; +void textureDimensions_9eb8d8() { + ivec2 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_9eb8d8(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(r32ui) uniform highp writeonly uimage2D arg_0; +void textureDimensions_9eb8d8() { + ivec2 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_9eb8d8(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(r32ui) uniform highp writeonly uimage2D arg_0; +void textureDimensions_9eb8d8() { + ivec2 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_9eb8d8(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/9eb8d8.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/9eb8d8.wgsl.expected.hlsl new file mode 100644 index 0000000000..cf18843418 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9eb8d8.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_9eb8d8() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_9eb8d8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_9eb8d8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_9eb8d8(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/9eb8d8.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/9eb8d8.wgsl.expected.msl new file mode 100644 index 0000000000..140c2af898 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9eb8d8.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_9eb8d8(texture2d tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureDimensions_9eb8d8(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_9eb8d8(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_9eb8d8(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/9eb8d8.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/9eb8d8.wgsl.expected.spvasm new file mode 100644 index 0000000000..b450c7b327 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9eb8d8.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_9eb8d8 "textureDimensions_9eb8d8" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 0 0 2 R32ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %23 = OpConstantNull %v2int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_9eb8d8 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %23 + %20 = OpLoad %11 %arg_0 + %17 = OpImageQuerySize %v2int %20 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureDimensions_9eb8d8 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %33 = OpLabel + %34 = OpFunctionCall %void %textureDimensions_9eb8d8 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_9eb8d8 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/9eb8d8.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/9eb8d8.wgsl.expected.wgsl new file mode 100644 index 0000000000..58bc54ffae --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9eb8d8.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureDimensions_9eb8d8() { + var res : vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_9eb8d8(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_9eb8d8(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_9eb8d8(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/9f8e46.wgsl b/test/tint/builtins/gen/var/textureDimensions/9f8e46.wgsl new file mode 100644 index 0000000000..c2caccf29d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9f8e46.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d; + +// fn textureDimensions(texture: texture_2d) -> vec2 +fn textureDimensions_9f8e46() { + var res: vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_9f8e46(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_9f8e46(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_9f8e46(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/9f8e46.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/9f8e46.wgsl.expected.glsl new file mode 100644 index 0000000000..a292ec4b7f --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9f8e46.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp sampler2D arg_0_1; +void textureDimensions_9f8e46() { + ivec2 res = textureSize(arg_0_1, 0); +} + +vec4 vertex_main() { + textureDimensions_9f8e46(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2D arg_0_1; +void textureDimensions_9f8e46() { + ivec2 res = textureSize(arg_0_1, 0); +} + +void fragment_main() { + textureDimensions_9f8e46(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2D arg_0_1; +void textureDimensions_9f8e46() { + ivec2 res = textureSize(arg_0_1, 0); +} + +void compute_main() { + textureDimensions_9f8e46(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/9f8e46.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/9f8e46.wgsl.expected.hlsl new file mode 100644 index 0000000000..384fdc350c --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9f8e46.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_0 : register(t0, space1); + +void textureDimensions_9f8e46() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_9f8e46(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_9f8e46(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_9f8e46(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/9f8e46.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/9f8e46.wgsl.expected.msl new file mode 100644 index 0000000000..b7097a21b4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9f8e46.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_9f8e46(texture2d tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureDimensions_9f8e46(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_9f8e46(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_9f8e46(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/9f8e46.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/9f8e46.wgsl.expected.spvasm new file mode 100644 index 0000000000..9fabd6ec80 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9f8e46.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_9f8e46 "textureDimensions_9f8e46" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %int_0 = OpConstant %int 0 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %23 = OpConstantNull %v2int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_9f8e46 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %23 + %19 = OpLoad %11 %arg_0 + %16 = OpImageQuerySizeLod %v2int %19 %int_0 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureDimensions_9f8e46 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %33 = OpLabel + %34 = OpFunctionCall %void %textureDimensions_9f8e46 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_9f8e46 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/9f8e46.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/9f8e46.wgsl.expected.wgsl new file mode 100644 index 0000000000..df7b1a7e59 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9f8e46.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_2d; + +fn textureDimensions_9f8e46() { + var res : vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_9f8e46(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_9f8e46(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_9f8e46(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/a01845.wgsl b/test/tint/builtins/gen/var/textureDimensions/a01845.wgsl new file mode 100644 index 0000000000..00aa1e57d6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/a01845.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_cube_array; + +// fn textureDimensions(texture: texture_depth_cube_array, level: i32) -> vec2 +fn textureDimensions_a01845() { + var arg_1 = 0; + var res: vec2 = textureDimensions(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_a01845(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_a01845(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_a01845(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/a01845.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/a01845.wgsl.expected.glsl new file mode 100644 index 0000000000..283779e46c --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/a01845.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp samplerCubeArray arg_0_1; +void textureDimensions_a01845() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1).xy; +} + +vec4 vertex_main() { + textureDimensions_a01845(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp samplerCubeArray arg_0_1; +void textureDimensions_a01845() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1).xy; +} + +void fragment_main() { + textureDimensions_a01845(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'samplerCubeArray' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp samplerCubeArray arg_0_1; +void textureDimensions_a01845() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1).xy; +} + +void compute_main() { + textureDimensions_a01845(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/a01845.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/a01845.wgsl.expected.hlsl new file mode 100644 index 0000000000..3fcaee8dbf --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/a01845.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureDimensions_a01845() { + int arg_1 = 0; + int4 tint_tmp; + arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_a01845(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_a01845(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_a01845(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/a01845.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/a01845.wgsl.expected.msl new file mode 100644 index 0000000000..a386075dc3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/a01845.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void textureDimensions_a01845(depthcube_array tint_symbol_1) { + int arg_1 = 0; + int2 res = int2(tint_symbol_1.get_width(arg_1), tint_symbol_1.get_height(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depthcube_array tint_symbol_2) { + textureDimensions_a01845(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depthcube_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depthcube_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_a01845(tint_symbol_4); + return; +} + +kernel void compute_main(depthcube_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_a01845(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/a01845.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/a01845.wgsl.expected.spvasm new file mode 100644 index 0000000000..8f49c1bb1c --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/a01845.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_a01845 "textureDimensions_a01845" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %17 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %28 = OpConstantNull %v2int + %29 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_a01845 = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %17 + %res = OpVariable %_ptr_Function_v2int Function %28 + OpStore %arg_1 %17 + %24 = OpLoad %11 %arg_0 + %25 = OpLoad %int %arg_1 + %22 = OpImageQuerySizeLod %v3int %24 %25 + %20 = OpVectorShuffle %v2int %22 %22 0 1 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %29 + %31 = OpLabel + %32 = OpFunctionCall %void %textureDimensions_a01845 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %34 = OpLabel + %35 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %35 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %38 = OpLabel + %39 = OpFunctionCall %void %textureDimensions_a01845 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %41 = OpLabel + %42 = OpFunctionCall %void %textureDimensions_a01845 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/a01845.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/a01845.wgsl.expected.wgsl new file mode 100644 index 0000000000..70d0b729ac --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/a01845.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +@group(1) @binding(0) var arg_0 : texture_depth_cube_array; + +fn textureDimensions_a01845() { + var arg_1 = 0; + var res : vec2 = textureDimensions(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_a01845(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_a01845(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_a01845(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/a7d565.wgsl b/test/tint/builtins/gen/var/textureDimensions/a7d565.wgsl new file mode 100644 index 0000000000..2559f773d8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/a7d565.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_1d; + +// fn textureDimensions(texture: texture_1d) -> i32 +fn textureDimensions_a7d565() { + var res: i32 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_a7d565(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_a7d565(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_a7d565(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/a7d565.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/a7d565.wgsl.expected.glsl new file mode 100644 index 0000000000..24152c71b7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/a7d565.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +uniform highp usampler1D arg_0_1; +void textureDimensions_a7d565() { + int res = textureSize(arg_0_1, 0); +} + +vec4 vertex_main() { + textureDimensions_a7d565(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'usampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp usampler1D arg_0_1; +void textureDimensions_a7d565() { + int res = textureSize(arg_0_1, 0); +} + +void fragment_main() { + textureDimensions_a7d565(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'usampler1D' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp usampler1D arg_0_1; +void textureDimensions_a7d565() { + int res = textureSize(arg_0_1, 0); +} + +void compute_main() { + textureDimensions_a7d565(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'usampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/a7d565.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/a7d565.wgsl.expected.hlsl new file mode 100644 index 0000000000..949e8b1a10 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/a7d565.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +Texture1D arg_0 : register(t0, space1); + +void textureDimensions_a7d565() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_a7d565(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_a7d565(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_a7d565(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/a7d565.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/a7d565.wgsl.expected.msl new file mode 100644 index 0000000000..aef867087f --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/a7d565.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_a7d565(texture1d tint_symbol_1) { + int res = int(tint_symbol_1.get_width(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureDimensions_a7d565(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureDimensions_a7d565(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureDimensions_a7d565(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/a7d565.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/a7d565.wgsl.expected.spvasm new file mode 100644 index 0000000000..1694f883ae --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/a7d565.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability Sampled1D + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_a7d565 "textureDimensions_a7d565" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 1D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Function_int = OpTypePointer Function %int + %23 = OpConstantNull %int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_a7d565 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %23 + %19 = OpLoad %11 %arg_0 + %17 = OpImageQuerySizeLod %int %19 %int_0 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureDimensions_a7d565 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %33 = OpLabel + %34 = OpFunctionCall %void %textureDimensions_a7d565 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_a7d565 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/a7d565.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/a7d565.wgsl.expected.wgsl new file mode 100644 index 0000000000..4cd2c97081 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/a7d565.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_1d; + +fn textureDimensions_a7d565() { + var res : i32 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_a7d565(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_a7d565(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_a7d565(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/a863f2.wgsl b/test/tint/builtins/gen/var/textureDimensions/a863f2.wgsl new file mode 100644 index 0000000000..d88716e58e --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/a863f2.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureDimensions(texture: texture_storage_1d) -> i32 +fn textureDimensions_a863f2() { + var res: i32 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_a863f2(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_a863f2(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_a863f2(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/a863f2.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/a863f2.wgsl.expected.glsl new file mode 100644 index 0000000000..b157dd9015 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/a863f2.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +layout(r32f) uniform highp writeonly image1D arg_0; +void textureDimensions_a863f2() { + int res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_a863f2(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(r32f) uniform highp writeonly image1D arg_0; +void textureDimensions_a863f2() { + int res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_a863f2(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(r32f) uniform highp writeonly image1D arg_0; +void textureDimensions_a863f2() { + int res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_a863f2(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/a863f2.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/a863f2.wgsl.expected.hlsl new file mode 100644 index 0000000000..212bbcaf5b --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/a863f2.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_a863f2() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_a863f2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_a863f2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_a863f2(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/a863f2.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/a863f2.wgsl.expected.msl new file mode 100644 index 0000000000..583342b5f9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/a863f2.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_a863f2(texture1d tint_symbol_1) { + int res = int(tint_symbol_1.get_width(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureDimensions_a863f2(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureDimensions_a863f2(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureDimensions_a863f2(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/a863f2.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/a863f2.wgsl.expected.spvasm new file mode 100644 index 0000000000..9e5a66ac12 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/a863f2.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Image1D + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_a863f2 "textureDimensions_a863f2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 1D 0 0 0 2 R32f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_a863f2 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_int Function %21 + %18 = OpLoad %11 %arg_0 + %16 = OpImageQuerySize %int %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %textureDimensions_a863f2 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %31 = OpLabel + %32 = OpFunctionCall %void %textureDimensions_a863f2 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %34 = OpLabel + %35 = OpFunctionCall %void %textureDimensions_a863f2 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/a863f2.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/a863f2.wgsl.expected.wgsl new file mode 100644 index 0000000000..257be4e0f7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/a863f2.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureDimensions_a863f2() { + var res : i32 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_a863f2(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_a863f2(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_a863f2(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/a9c9c1.wgsl b/test/tint/builtins/gen/var/textureDimensions/a9c9c1.wgsl new file mode 100644 index 0000000000..7dac118e51 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/a9c9c1.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube; + +// fn textureDimensions(texture: texture_cube, level: i32) -> vec2 +fn textureDimensions_a9c9c1() { + var arg_1 = 0; + var res: vec2 = textureDimensions(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_a9c9c1(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_a9c9c1(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_a9c9c1(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/a9c9c1.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/a9c9c1.wgsl.expected.glsl new file mode 100644 index 0000000000..2ed5a55c45 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/a9c9c1.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp samplerCube arg_0_1; +void textureDimensions_a9c9c1() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1); +} + +vec4 vertex_main() { + textureDimensions_a9c9c1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp samplerCube arg_0_1; +void textureDimensions_a9c9c1() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1); +} + +void fragment_main() { + textureDimensions_a9c9c1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp samplerCube arg_0_1; +void textureDimensions_a9c9c1() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1); +} + +void compute_main() { + textureDimensions_a9c9c1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/a9c9c1.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/a9c9c1.wgsl.expected.hlsl new file mode 100644 index 0000000000..d7f1f2582d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/a9c9c1.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +TextureCube arg_0 : register(t0, space1); + +void textureDimensions_a9c9c1() { + int arg_1 = 0; + int3 tint_tmp; + arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_a9c9c1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_a9c9c1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_a9c9c1(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/a9c9c1.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/a9c9c1.wgsl.expected.msl new file mode 100644 index 0000000000..63ccb1a385 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/a9c9c1.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void textureDimensions_a9c9c1(texturecube tint_symbol_1) { + int arg_1 = 0; + int2 res = int2(tint_symbol_1.get_width(arg_1), tint_symbol_1.get_height(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube tint_symbol_2) { + textureDimensions_a9c9c1(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube tint_symbol_4 [[texture(0)]]) { + textureDimensions_a9c9c1(tint_symbol_4); + return; +} + +kernel void compute_main(texturecube tint_symbol_5 [[texture(0)]]) { + textureDimensions_a9c9c1(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/a9c9c1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/a9c9c1.wgsl.expected.spvasm new file mode 100644 index 0000000000..11c075c971 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/a9c9c1.wgsl.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_a9c9c1 "textureDimensions_a9c9c1" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float Cube 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %17 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %26 = OpConstantNull %v2int + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_a9c9c1 = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %17 + %res = OpVariable %_ptr_Function_v2int Function %26 + OpStore %arg_1 %17 + %22 = OpLoad %11 %arg_0 + %23 = OpLoad %int %arg_1 + %20 = OpImageQuerySizeLod %v2int %22 %23 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %textureDimensions_a9c9c1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_a9c9c1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %39 = OpLabel + %40 = OpFunctionCall %void %textureDimensions_a9c9c1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/a9c9c1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/a9c9c1.wgsl.expected.wgsl new file mode 100644 index 0000000000..4532c170c0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/a9c9c1.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +@group(1) @binding(0) var arg_0 : texture_cube; + +fn textureDimensions_a9c9c1() { + var arg_1 = 0; + var res : vec2 = textureDimensions(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_a9c9c1(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_a9c9c1(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_a9c9c1(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/b0e16d.wgsl b/test/tint/builtins/gen/var/textureDimensions/b0e16d.wgsl new file mode 100644 index 0000000000..ff16fe84ee --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/b0e16d.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d; + +// fn textureDimensions(texture: texture_2d, level: i32) -> vec2 +fn textureDimensions_b0e16d() { + var arg_1 = 0; + var res: vec2 = textureDimensions(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_b0e16d(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_b0e16d(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_b0e16d(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/b0e16d.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/b0e16d.wgsl.expected.glsl new file mode 100644 index 0000000000..08c8f511b9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/b0e16d.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp isampler2D arg_0_1; +void textureDimensions_b0e16d() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1); +} + +vec4 vertex_main() { + textureDimensions_b0e16d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp isampler2D arg_0_1; +void textureDimensions_b0e16d() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1); +} + +void fragment_main() { + textureDimensions_b0e16d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp isampler2D arg_0_1; +void textureDimensions_b0e16d() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1); +} + +void compute_main() { + textureDimensions_b0e16d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/b0e16d.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/b0e16d.wgsl.expected.hlsl new file mode 100644 index 0000000000..6cdc838b67 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/b0e16d.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +Texture2D arg_0 : register(t0, space1); + +void textureDimensions_b0e16d() { + int arg_1 = 0; + int3 tint_tmp; + arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_b0e16d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_b0e16d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_b0e16d(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/b0e16d.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/b0e16d.wgsl.expected.msl new file mode 100644 index 0000000000..fe9454ada7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/b0e16d.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void textureDimensions_b0e16d(texture2d tint_symbol_1) { + int arg_1 = 0; + int2 res = int2(tint_symbol_1.get_width(arg_1), tint_symbol_1.get_height(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureDimensions_b0e16d(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_b0e16d(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_b0e16d(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/b0e16d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/b0e16d.wgsl.expected.spvasm new file mode 100644 index 0000000000..b8b73a8666 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/b0e16d.wgsl.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_b0e16d "textureDimensions_b0e16d" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %17 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %26 = OpConstantNull %v2int + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_b0e16d = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %17 + %res = OpVariable %_ptr_Function_v2int Function %26 + OpStore %arg_1 %17 + %22 = OpLoad %11 %arg_0 + %23 = OpLoad %int %arg_1 + %20 = OpImageQuerySizeLod %v2int %22 %23 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %textureDimensions_b0e16d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_b0e16d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %39 = OpLabel + %40 = OpFunctionCall %void %textureDimensions_b0e16d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/b0e16d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/b0e16d.wgsl.expected.wgsl new file mode 100644 index 0000000000..fd73808664 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/b0e16d.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +@group(1) @binding(0) var arg_0 : texture_2d; + +fn textureDimensions_b0e16d() { + var arg_1 = 0; + var res : vec2 = textureDimensions(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_b0e16d(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_b0e16d(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_b0e16d(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/b3c954.wgsl b/test/tint/builtins/gen/var/textureDimensions/b3c954.wgsl new file mode 100644 index 0000000000..2fb0e3d12c --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/b3c954.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube; + +// fn textureDimensions(texture: texture_cube) -> vec2 +fn textureDimensions_b3c954() { + var res: vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_b3c954(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_b3c954(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_b3c954(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/b3c954.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/b3c954.wgsl.expected.glsl new file mode 100644 index 0000000000..855349fba4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/b3c954.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp usamplerCube arg_0_1; +void textureDimensions_b3c954() { + ivec2 res = textureSize(arg_0_1, 0); +} + +vec4 vertex_main() { + textureDimensions_b3c954(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp usamplerCube arg_0_1; +void textureDimensions_b3c954() { + ivec2 res = textureSize(arg_0_1, 0); +} + +void fragment_main() { + textureDimensions_b3c954(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp usamplerCube arg_0_1; +void textureDimensions_b3c954() { + ivec2 res = textureSize(arg_0_1, 0); +} + +void compute_main() { + textureDimensions_b3c954(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/b3c954.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/b3c954.wgsl.expected.hlsl new file mode 100644 index 0000000000..f0d031de32 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/b3c954.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +TextureCube arg_0 : register(t0, space1); + +void textureDimensions_b3c954() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_b3c954(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_b3c954(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_b3c954(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/b3c954.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/b3c954.wgsl.expected.msl new file mode 100644 index 0000000000..33fc09aae0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/b3c954.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_b3c954(texturecube tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube tint_symbol_2) { + textureDimensions_b3c954(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube tint_symbol_4 [[texture(0)]]) { + textureDimensions_b3c954(tint_symbol_4); + return; +} + +kernel void compute_main(texturecube tint_symbol_5 [[texture(0)]]) { + textureDimensions_b3c954(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/b3c954.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/b3c954.wgsl.expected.spvasm new file mode 100644 index 0000000000..f8a392c057 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/b3c954.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_b3c954 "textureDimensions_b3c954" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint Cube 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %int_0 = OpConstant %int 0 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %24 = OpConstantNull %v2int + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_b3c954 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %24 + %20 = OpLoad %11 %arg_0 + %17 = OpImageQuerySizeLod %v2int %20 %int_0 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %textureDimensions_b3c954 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %void %textureDimensions_b3c954 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %37 = OpLabel + %38 = OpFunctionCall %void %textureDimensions_b3c954 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/b3c954.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/b3c954.wgsl.expected.wgsl new file mode 100644 index 0000000000..de3b872866 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/b3c954.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_cube; + +fn textureDimensions_b3c954() { + var res : vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_b3c954(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_b3c954(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_b3c954(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/b3e407.wgsl b/test/tint/builtins/gen/var/textureDimensions/b3e407.wgsl new file mode 100644 index 0000000000..5b88cd2957 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/b3e407.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_1d; + +// fn textureDimensions(texture: texture_1d, level: i32) -> i32 +fn textureDimensions_b3e407() { + var arg_1 = 0; + var res: i32 = textureDimensions(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_b3e407(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_b3e407(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_b3e407(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/b3e407.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/b3e407.wgsl.expected.glsl new file mode 100644 index 0000000000..0191881639 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/b3e407.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp sampler1D arg_0_1; +void textureDimensions_b3e407() { + int arg_1 = 0; + int res = textureSize(arg_0_1, arg_1); +} + +vec4 vertex_main() { + textureDimensions_b3e407(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'sampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp sampler1D arg_0_1; +void textureDimensions_b3e407() { + int arg_1 = 0; + int res = textureSize(arg_0_1, arg_1); +} + +void fragment_main() { + textureDimensions_b3e407(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'sampler1D' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp sampler1D arg_0_1; +void textureDimensions_b3e407() { + int arg_1 = 0; + int res = textureSize(arg_0_1, arg_1); +} + +void compute_main() { + textureDimensions_b3e407(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'sampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/b3e407.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/b3e407.wgsl.expected.hlsl new file mode 100644 index 0000000000..035c05f0e6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/b3e407.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +Texture1D arg_0 : register(t0, space1); + +void textureDimensions_b3e407() { + int arg_1 = 0; + int2 tint_tmp; + arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y); + int res = tint_tmp.x; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_b3e407(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_b3e407(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_b3e407(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/b3e407.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/b3e407.wgsl.expected.msl new file mode 100644 index 0000000000..bd1261aa98 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/b3e407.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void textureDimensions_b3e407(texture1d tint_symbol_1) { + int arg_1 = 0; + int res = int(tint_symbol_1.get_width(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureDimensions_b3e407(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureDimensions_b3e407(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureDimensions_b3e407(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/b3e407.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/b3e407.wgsl.expected.spvasm new file mode 100644 index 0000000000..fdc21d2b82 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/b3e407.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability Sampled1D + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_b3e407 "textureDimensions_b3e407" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 1D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %17 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_b3e407 = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %17 + %res = OpVariable %_ptr_Function_int Function %17 + OpStore %arg_1 %17 + %21 = OpLoad %11 %arg_0 + %22 = OpLoad %int %arg_1 + %20 = OpImageQuerySizeLod %int %21 %22 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureDimensions_b3e407 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %33 = OpLabel + %34 = OpFunctionCall %void %textureDimensions_b3e407 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_b3e407 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/b3e407.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/b3e407.wgsl.expected.wgsl new file mode 100644 index 0000000000..6e09c13292 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/b3e407.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +@group(1) @binding(0) var arg_0 : texture_1d; + +fn textureDimensions_b3e407() { + var arg_1 = 0; + var res : i32 = textureDimensions(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_b3e407(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_b3e407(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_b3e407(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/b91240.wgsl b/test/tint/builtins/gen/var/textureDimensions/b91240.wgsl new file mode 100644 index 0000000000..df6cccbef5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/b91240.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureDimensions(texture: texture_storage_2d) -> vec2 +fn textureDimensions_b91240() { + var res: vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_b91240(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_b91240(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_b91240(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/b91240.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/b91240.wgsl.expected.glsl new file mode 100644 index 0000000000..3976de3f5b --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/b91240.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba8_snorm) uniform highp writeonly image2D arg_0; +void textureDimensions_b91240() { + ivec2 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_b91240(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8_snorm) uniform highp writeonly image2D arg_0; +void textureDimensions_b91240() { + ivec2 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_b91240(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8_snorm) uniform highp writeonly image2D arg_0; +void textureDimensions_b91240() { + ivec2 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_b91240(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/b91240.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/b91240.wgsl.expected.hlsl new file mode 100644 index 0000000000..7f3c930964 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/b91240.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_b91240() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_b91240(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_b91240(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_b91240(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/b91240.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/b91240.wgsl.expected.msl new file mode 100644 index 0000000000..ee84ff1eb9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/b91240.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_b91240(texture2d tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureDimensions_b91240(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_b91240(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_b91240(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/b91240.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/b91240.wgsl.expected.spvasm new file mode 100644 index 0000000000..a0757e4610 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/b91240.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_b91240 "textureDimensions_b91240" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 2 Rgba8Snorm +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %22 = OpConstantNull %v2int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_b91240 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %22 + %19 = OpLoad %11 %arg_0 + %16 = OpImageQuerySize %v2int %19 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureDimensions_b91240 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %void %textureDimensions_b91240 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_b91240 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/b91240.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/b91240.wgsl.expected.wgsl new file mode 100644 index 0000000000..105338f1c8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/b91240.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureDimensions_b91240() { + var res : vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_b91240(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_b91240(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_b91240(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/ba1481.wgsl b/test/tint/builtins/gen/var/textureDimensions/ba1481.wgsl new file mode 100644 index 0000000000..1cb0abe122 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/ba1481.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_external; + +// fn textureDimensions(texture: texture_external) -> vec2 +fn textureDimensions_ba1481() { + var res: vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_ba1481(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_ba1481(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_ba1481(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/ba1481.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/ba1481.wgsl.expected.glsl new file mode 100644 index 0000000000..25eab78df8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/ba1481.wgsl.expected.glsl @@ -0,0 +1,133 @@ +#version 310 es + +struct GammaTransferParams { + float G; + float A; + float B; + float C; + float D; + float E; + float F; + uint padding; +}; + +struct ExternalTextureParams { + uint numPlanes; + mat3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + mat3 gamutConversionMatrix; +}; + +layout(binding = 2) uniform ExternalTextureParams_1 { + uint numPlanes; + mat3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + mat3 gamutConversionMatrix; +} ext_tex_params; + +uniform highp sampler2D arg_0_1; +void textureDimensions_ba1481() { + ivec2 res = textureSize(arg_0_1, 0); +} + +vec4 vertex_main() { + textureDimensions_ba1481(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +struct GammaTransferParams { + float G; + float A; + float B; + float C; + float D; + float E; + float F; + uint padding; +}; + +struct ExternalTextureParams { + uint numPlanes; + mat3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + mat3 gamutConversionMatrix; +}; + +layout(binding = 2) uniform ExternalTextureParams_1 { + uint numPlanes; + mat3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + mat3 gamutConversionMatrix; +} ext_tex_params; + +uniform highp sampler2D arg_0_1; +void textureDimensions_ba1481() { + ivec2 res = textureSize(arg_0_1, 0); +} + +void fragment_main() { + textureDimensions_ba1481(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct GammaTransferParams { + float G; + float A; + float B; + float C; + float D; + float E; + float F; + uint padding; +}; + +struct ExternalTextureParams { + uint numPlanes; + mat3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + mat3 gamutConversionMatrix; +}; + +layout(binding = 2) uniform ExternalTextureParams_1 { + uint numPlanes; + mat3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + mat3 gamutConversionMatrix; +} ext_tex_params; + +uniform highp sampler2D arg_0_1; +void textureDimensions_ba1481() { + ivec2 res = textureSize(arg_0_1, 0); +} + +void compute_main() { + textureDimensions_ba1481(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/ba1481.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/ba1481.wgsl.expected.hlsl new file mode 100644 index 0000000000..1761c01751 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/ba1481.wgsl.expected.hlsl @@ -0,0 +1,38 @@ +Texture2D ext_tex_plane_1 : register(t1, space1); +cbuffer cbuffer_ext_tex_params : register(b2, space1) { + uint4 ext_tex_params[11]; +}; +Texture2D arg_0 : register(t0, space1); + +void textureDimensions_ba1481() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_ba1481(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_ba1481(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_ba1481(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/ba1481.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/ba1481.wgsl.expected.msl new file mode 100644 index 0000000000..cf84f15c94 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/ba1481.wgsl.expected.msl @@ -0,0 +1,52 @@ +#include + +using namespace metal; +struct GammaTransferParams { + float G; + float A; + float B; + float C; + float D; + float E; + float F; + uint padding; +}; + +struct ExternalTextureParams { + uint numPlanes; + float3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + float3x3 gamutConversionMatrix; +}; + +void textureDimensions_ba1481(texture2d tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureDimensions_ba1481(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_ba1481(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_ba1481(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/ba1481.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/ba1481.wgsl.expected.spvasm new file mode 100644 index 0000000000..c0f550a47f --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/ba1481.wgsl.expected.spvasm @@ -0,0 +1,125 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %ext_tex_plane_1 "ext_tex_plane_1" + OpName %ExternalTextureParams "ExternalTextureParams" + OpMemberName %ExternalTextureParams 0 "numPlanes" + OpMemberName %ExternalTextureParams 1 "yuvToRgbConversionMatrix" + OpMemberName %ExternalTextureParams 2 "gammaDecodeParams" + OpName %GammaTransferParams "GammaTransferParams" + OpMemberName %GammaTransferParams 0 "G" + OpMemberName %GammaTransferParams 1 "A" + OpMemberName %GammaTransferParams 2 "B" + OpMemberName %GammaTransferParams 3 "C" + OpMemberName %GammaTransferParams 4 "D" + OpMemberName %GammaTransferParams 5 "E" + OpMemberName %GammaTransferParams 6 "F" + OpMemberName %GammaTransferParams 7 "padding" + OpMemberName %ExternalTextureParams 3 "gammaEncodeParams" + OpMemberName %ExternalTextureParams 4 "gamutConversionMatrix" + OpName %ext_tex_params "ext_tex_params" + OpName %arg_0 "arg_0" + OpName %textureDimensions_ba1481 "textureDimensions_ba1481" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %ext_tex_plane_1 DescriptorSet 1 + OpDecorate %ext_tex_plane_1 Binding 1 + OpDecorate %ExternalTextureParams Block + OpMemberDecorate %ExternalTextureParams 0 Offset 0 + OpMemberDecorate %ExternalTextureParams 1 Offset 16 + OpMemberDecorate %ExternalTextureParams 1 ColMajor + OpMemberDecorate %ExternalTextureParams 1 MatrixStride 16 + OpMemberDecorate %ExternalTextureParams 2 Offset 64 + OpMemberDecorate %GammaTransferParams 0 Offset 0 + OpMemberDecorate %GammaTransferParams 1 Offset 4 + OpMemberDecorate %GammaTransferParams 2 Offset 8 + OpMemberDecorate %GammaTransferParams 3 Offset 12 + OpMemberDecorate %GammaTransferParams 4 Offset 16 + OpMemberDecorate %GammaTransferParams 5 Offset 20 + OpMemberDecorate %GammaTransferParams 6 Offset 24 + OpMemberDecorate %GammaTransferParams 7 Offset 28 + OpMemberDecorate %ExternalTextureParams 3 Offset 96 + OpMemberDecorate %ExternalTextureParams 4 Offset 128 + OpMemberDecorate %ExternalTextureParams 4 ColMajor + OpMemberDecorate %ExternalTextureParams 4 MatrixStride 16 + OpDecorate %ext_tex_params NonWritable + OpDecorate %ext_tex_params DescriptorSet 1 + OpDecorate %ext_tex_params Binding 2 + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 +%ext_tex_plane_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %uint = OpTypeInt 32 0 +%mat3v4float = OpTypeMatrix %v4float 3 +%GammaTransferParams = OpTypeStruct %float %float %float %float %float %float %float %uint + %v3float = OpTypeVector %float 3 +%mat3v3float = OpTypeMatrix %v3float 3 +%ExternalTextureParams = OpTypeStruct %uint %mat3v4float %GammaTransferParams %GammaTransferParams %mat3v3float +%_ptr_Uniform_ExternalTextureParams = OpTypePointer Uniform %ExternalTextureParams +%ext_tex_params = OpVariable %_ptr_Uniform_ExternalTextureParams Uniform + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %21 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %int_0 = OpConstant %int 0 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %32 = OpConstantNull %v2int + %33 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_ba1481 = OpFunction %void None %21 + %24 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %32 + %28 = OpLoad %11 %arg_0 + %25 = OpImageQuerySizeLod %v2int %28 %int_0 + OpStore %res %25 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %33 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_ba1481 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %21 + %38 = OpLabel + %39 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %39 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %21 + %42 = OpLabel + %43 = OpFunctionCall %void %textureDimensions_ba1481 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %21 + %45 = OpLabel + %46 = OpFunctionCall %void %textureDimensions_ba1481 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/ba1481.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/ba1481.wgsl.expected.wgsl new file mode 100644 index 0000000000..0bcf4af3de --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/ba1481.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_external; + +fn textureDimensions_ba1481() { + var res : vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_ba1481(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_ba1481(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_ba1481(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/bb3dde.wgsl b/test/tint/builtins/gen/var/textureDimensions/bb3dde.wgsl new file mode 100644 index 0000000000..fec2488e79 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/bb3dde.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureDimensions(texture: texture_storage_3d) -> vec3 +fn textureDimensions_bb3dde() { + var res: vec3 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_bb3dde(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_bb3dde(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_bb3dde(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/bb3dde.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/bb3dde.wgsl.expected.glsl new file mode 100644 index 0000000000..8c5f7400b3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/bb3dde.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba32i) uniform highp writeonly iimage3D arg_0; +void textureDimensions_bb3dde() { + ivec3 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_bb3dde(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba32i) uniform highp writeonly iimage3D arg_0; +void textureDimensions_bb3dde() { + ivec3 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_bb3dde(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba32i) uniform highp writeonly iimage3D arg_0; +void textureDimensions_bb3dde() { + ivec3 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_bb3dde(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/bb3dde.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/bb3dde.wgsl.expected.hlsl new file mode 100644 index 0000000000..48b980a2d2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/bb3dde.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_bb3dde() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_bb3dde(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_bb3dde(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_bb3dde(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/bb3dde.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/bb3dde.wgsl.expected.msl new file mode 100644 index 0000000000..0f837421b7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/bb3dde.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_bb3dde(texture3d tint_symbol_1) { + int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureDimensions_bb3dde(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureDimensions_bb3dde(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureDimensions_bb3dde(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/bb3dde.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/bb3dde.wgsl.expected.spvasm new file mode 100644 index 0000000000..7d300727de --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/bb3dde.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_bb3dde "textureDimensions_bb3dde" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 3D 0 0 0 2 Rgba32i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v3int = OpTypeVector %int 3 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %22 = OpConstantNull %v3int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_bb3dde = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v3int Function %22 + %19 = OpLoad %11 %arg_0 + %17 = OpImageQuerySize %v3int %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureDimensions_bb3dde + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %32 = OpLabel + %33 = OpFunctionCall %void %textureDimensions_bb3dde + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_bb3dde + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/bb3dde.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/bb3dde.wgsl.expected.wgsl new file mode 100644 index 0000000000..005cae6f32 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/bb3dde.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureDimensions_bb3dde() { + var res : vec3 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_bb3dde(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_bb3dde(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_bb3dde(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/c30e75.wgsl b/test/tint/builtins/gen/var/textureDimensions/c30e75.wgsl new file mode 100644 index 0000000000..c5afaf371b --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/c30e75.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureDimensions(texture: texture_storage_2d) -> vec2 +fn textureDimensions_c30e75() { + var res: vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_c30e75(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_c30e75(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_c30e75(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/c30e75.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/c30e75.wgsl.expected.glsl new file mode 100644 index 0000000000..06b6108b8c --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/c30e75.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(r32i) uniform highp writeonly iimage2D arg_0; +void textureDimensions_c30e75() { + ivec2 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_c30e75(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(r32i) uniform highp writeonly iimage2D arg_0; +void textureDimensions_c30e75() { + ivec2 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_c30e75(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(r32i) uniform highp writeonly iimage2D arg_0; +void textureDimensions_c30e75() { + ivec2 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_c30e75(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/c30e75.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/c30e75.wgsl.expected.hlsl new file mode 100644 index 0000000000..e4ae3823e8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/c30e75.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_c30e75() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_c30e75(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_c30e75(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_c30e75(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/c30e75.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/c30e75.wgsl.expected.msl new file mode 100644 index 0000000000..711f4aace3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/c30e75.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_c30e75(texture2d tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureDimensions_c30e75(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_c30e75(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_c30e75(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/c30e75.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/c30e75.wgsl.expected.spvasm new file mode 100644 index 0000000000..05cad7c90a --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/c30e75.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_c30e75 "textureDimensions_c30e75" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 0 0 2 R32i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %22 = OpConstantNull %v2int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_c30e75 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %22 + %19 = OpLoad %11 %arg_0 + %17 = OpImageQuerySize %v2int %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureDimensions_c30e75 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %32 = OpLabel + %33 = OpFunctionCall %void %textureDimensions_c30e75 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_c30e75 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/c30e75.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/c30e75.wgsl.expected.wgsl new file mode 100644 index 0000000000..ecf60b5c6b --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/c30e75.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureDimensions_c30e75() { + var res : vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_c30e75(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_c30e75(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_c30e75(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/c7943d.wgsl b/test/tint/builtins/gen/var/textureDimensions/c7943d.wgsl new file mode 100644 index 0000000000..892ea87552 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/c7943d.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureDimensions(texture: texture_storage_2d) -> vec2 +fn textureDimensions_c7943d() { + var res: vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_c7943d(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_c7943d(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_c7943d(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/c7943d.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/c7943d.wgsl.expected.glsl new file mode 100644 index 0000000000..ec88d6e813 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/c7943d.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba8ui) uniform highp writeonly uimage2D arg_0; +void textureDimensions_c7943d() { + ivec2 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_c7943d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8ui) uniform highp writeonly uimage2D arg_0; +void textureDimensions_c7943d() { + ivec2 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_c7943d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8ui) uniform highp writeonly uimage2D arg_0; +void textureDimensions_c7943d() { + ivec2 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_c7943d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/c7943d.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/c7943d.wgsl.expected.hlsl new file mode 100644 index 0000000000..4b69252d51 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/c7943d.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_c7943d() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_c7943d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_c7943d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_c7943d(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/c7943d.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/c7943d.wgsl.expected.msl new file mode 100644 index 0000000000..39c32d13d5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/c7943d.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_c7943d(texture2d tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureDimensions_c7943d(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_c7943d(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_c7943d(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/c7943d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/c7943d.wgsl.expected.spvasm new file mode 100644 index 0000000000..0f1070d207 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/c7943d.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_c7943d "textureDimensions_c7943d" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 0 0 2 Rgba8ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %23 = OpConstantNull %v2int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_c7943d = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %23 + %20 = OpLoad %11 %arg_0 + %17 = OpImageQuerySize %v2int %20 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureDimensions_c7943d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %33 = OpLabel + %34 = OpFunctionCall %void %textureDimensions_c7943d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_c7943d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/c7943d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/c7943d.wgsl.expected.wgsl new file mode 100644 index 0000000000..d664f33756 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/c7943d.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureDimensions_c7943d() { + var res : vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_c7943d(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_c7943d(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_c7943d(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/cc968c.wgsl b/test/tint/builtins/gen/var/textureDimensions/cc968c.wgsl new file mode 100644 index 0000000000..42f777f254 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cc968c.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureDimensions(texture: texture_storage_1d) -> i32 +fn textureDimensions_cc968c() { + var res: i32 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_cc968c(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_cc968c(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_cc968c(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/cc968c.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/cc968c.wgsl.expected.glsl new file mode 100644 index 0000000000..d7f3becc89 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cc968c.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32i) uniform highp writeonly iimage1D arg_0; +void textureDimensions_cc968c() { + int res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_cc968c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32i) uniform highp writeonly iimage1D arg_0; +void textureDimensions_cc968c() { + int res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_cc968c(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32i) uniform highp writeonly iimage1D arg_0; +void textureDimensions_cc968c() { + int res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_cc968c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/cc968c.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/cc968c.wgsl.expected.hlsl new file mode 100644 index 0000000000..e20e81bcef --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cc968c.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_cc968c() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_cc968c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_cc968c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_cc968c(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/cc968c.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/cc968c.wgsl.expected.msl new file mode 100644 index 0000000000..2a4db09c42 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cc968c.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_cc968c(texture1d tint_symbol_1) { + int res = int(tint_symbol_1.get_width(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureDimensions_cc968c(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureDimensions_cc968c(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureDimensions_cc968c(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/cc968c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/cc968c.wgsl.expected.spvasm new file mode 100644 index 0000000000..21f2dd1d8e --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cc968c.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Image1D + OpCapability StorageImageExtendedFormats + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_cc968c "textureDimensions_cc968c" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 1D 0 0 0 2 Rg32i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_cc968c = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %21 + %18 = OpLoad %11 %arg_0 + %17 = OpImageQuerySize %int %18 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %textureDimensions_cc968c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %31 = OpLabel + %32 = OpFunctionCall %void %textureDimensions_cc968c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %void %textureDimensions_cc968c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/cc968c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/cc968c.wgsl.expected.wgsl new file mode 100644 index 0000000000..8198585683 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cc968c.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureDimensions_cc968c() { + var res : i32 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_cc968c(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_cc968c(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_cc968c(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/cccc8f.wgsl b/test/tint/builtins/gen/var/textureDimensions/cccc8f.wgsl new file mode 100644 index 0000000000..b320e91e14 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cccc8f.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureDimensions(texture: texture_storage_1d) -> i32 +fn textureDimensions_cccc8f() { + var res: i32 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_cccc8f(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_cccc8f(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_cccc8f(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/cccc8f.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/cccc8f.wgsl.expected.glsl new file mode 100644 index 0000000000..8ea9b9ed23 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cccc8f.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +layout(rgba8_snorm) uniform highp writeonly image1D arg_0; +void textureDimensions_cccc8f() { + int res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_cccc8f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rgba8_snorm) uniform highp writeonly image1D arg_0; +void textureDimensions_cccc8f() { + int res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_cccc8f(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rgba8_snorm) uniform highp writeonly image1D arg_0; +void textureDimensions_cccc8f() { + int res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_cccc8f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/cccc8f.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/cccc8f.wgsl.expected.hlsl new file mode 100644 index 0000000000..8030a26359 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cccc8f.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_cccc8f() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_cccc8f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_cccc8f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_cccc8f(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/cccc8f.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/cccc8f.wgsl.expected.msl new file mode 100644 index 0000000000..f03ce0c682 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cccc8f.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_cccc8f(texture1d tint_symbol_1) { + int res = int(tint_symbol_1.get_width(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureDimensions_cccc8f(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureDimensions_cccc8f(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureDimensions_cccc8f(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/cccc8f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/cccc8f.wgsl.expected.spvasm new file mode 100644 index 0000000000..ae7cb8d608 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cccc8f.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Image1D + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_cccc8f "textureDimensions_cccc8f" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 1D 0 0 0 2 Rgba8Snorm +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_cccc8f = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_int Function %21 + %18 = OpLoad %11 %arg_0 + %16 = OpImageQuerySize %int %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %textureDimensions_cccc8f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %31 = OpLabel + %32 = OpFunctionCall %void %textureDimensions_cccc8f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %34 = OpLabel + %35 = OpFunctionCall %void %textureDimensions_cccc8f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/cccc8f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/cccc8f.wgsl.expected.wgsl new file mode 100644 index 0000000000..a4d44f0df9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cccc8f.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureDimensions_cccc8f() { + var res : i32 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_cccc8f(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_cccc8f(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_cccc8f(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/cd76a7.wgsl b/test/tint/builtins/gen/var/textureDimensions/cd76a7.wgsl new file mode 100644 index 0000000000..8959a179d7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cd76a7.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureDimensions(texture: texture_storage_3d) -> vec3 +fn textureDimensions_cd76a7() { + var res: vec3 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_cd76a7(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_cd76a7(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_cd76a7(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/cd76a7.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/cd76a7.wgsl.expected.glsl new file mode 100644 index 0000000000..92b0daea4b --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cd76a7.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba8) uniform highp writeonly image3D arg_0; +void textureDimensions_cd76a7() { + ivec3 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_cd76a7(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8) uniform highp writeonly image3D arg_0; +void textureDimensions_cd76a7() { + ivec3 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_cd76a7(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8) uniform highp writeonly image3D arg_0; +void textureDimensions_cd76a7() { + ivec3 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_cd76a7(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/cd76a7.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/cd76a7.wgsl.expected.hlsl new file mode 100644 index 0000000000..107e7e6b32 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cd76a7.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_cd76a7() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_cd76a7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_cd76a7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_cd76a7(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/cd76a7.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/cd76a7.wgsl.expected.msl new file mode 100644 index 0000000000..14b141addd --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cd76a7.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_cd76a7(texture3d tint_symbol_1) { + int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureDimensions_cd76a7(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureDimensions_cd76a7(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureDimensions_cd76a7(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/cd76a7.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/cd76a7.wgsl.expected.spvasm new file mode 100644 index 0000000000..6d33337b5a --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cd76a7.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_cd76a7 "textureDimensions_cd76a7" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 3D 0 0 0 2 Rgba8 +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %22 = OpConstantNull %v3int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_cd76a7 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v3int Function %22 + %19 = OpLoad %11 %arg_0 + %16 = OpImageQuerySize %v3int %19 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureDimensions_cd76a7 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %void %textureDimensions_cd76a7 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_cd76a7 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/cd76a7.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/cd76a7.wgsl.expected.wgsl new file mode 100644 index 0000000000..139070fb82 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cd76a7.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureDimensions_cd76a7() { + var res : vec3 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_cd76a7(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_cd76a7(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_cd76a7(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/cdf473.wgsl b/test/tint/builtins/gen/var/textureDimensions/cdf473.wgsl new file mode 100644 index 0000000000..3eb0f09d1d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cdf473.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureDimensions(texture: texture_storage_2d_array) -> vec2 +fn textureDimensions_cdf473() { + var res: vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_cdf473(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_cdf473(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_cdf473(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/cdf473.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/cdf473.wgsl.expected.glsl new file mode 100644 index 0000000000..ea5fe7d9f8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cdf473.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba16i) uniform highp writeonly iimage2DArray arg_0; +void textureDimensions_cdf473() { + ivec2 res = imageSize(arg_0).xy; +} + +vec4 vertex_main() { + textureDimensions_cdf473(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba16i) uniform highp writeonly iimage2DArray arg_0; +void textureDimensions_cdf473() { + ivec2 res = imageSize(arg_0).xy; +} + +void fragment_main() { + textureDimensions_cdf473(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba16i) uniform highp writeonly iimage2DArray arg_0; +void textureDimensions_cdf473() { + ivec2 res = imageSize(arg_0).xy; +} + +void compute_main() { + textureDimensions_cdf473(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/cdf473.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/cdf473.wgsl.expected.hlsl new file mode 100644 index 0000000000..895f7d05b6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cdf473.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_cdf473() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_cdf473(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_cdf473(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_cdf473(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/cdf473.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/cdf473.wgsl.expected.msl new file mode 100644 index 0000000000..fa50285dcc --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cdf473.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_cdf473(texture2d_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureDimensions_cdf473(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_cdf473(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_cdf473(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/cdf473.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/cdf473.wgsl.expected.spvasm new file mode 100644 index 0000000000..30caae894f --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cdf473.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_cdf473 "textureDimensions_cdf473" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 1 0 2 Rgba16i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %24 = OpConstantNull %v2int + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_cdf473 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %24 + %21 = OpLoad %11 %arg_0 + %19 = OpImageQuerySize %v3int %21 + %17 = OpVectorShuffle %v2int %19 %19 0 1 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %textureDimensions_cdf473 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %void %textureDimensions_cdf473 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %37 = OpLabel + %38 = OpFunctionCall %void %textureDimensions_cdf473 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/cdf473.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/cdf473.wgsl.expected.wgsl new file mode 100644 index 0000000000..31373c0050 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cdf473.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureDimensions_cdf473() { + var res : vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_cdf473(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_cdf473(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_cdf473(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/cec841.wgsl b/test/tint/builtins/gen/var/textureDimensions/cec841.wgsl new file mode 100644 index 0000000000..abd76b16c5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cec841.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; + +// fn textureDimensions(texture: texture_2d_array) -> vec2 +fn textureDimensions_cec841() { + var res: vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_cec841(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_cec841(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_cec841(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/cec841.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/cec841.wgsl.expected.glsl new file mode 100644 index 0000000000..6c4ff13a80 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cec841.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp sampler2DArray arg_0_1; +void textureDimensions_cec841() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +vec4 vertex_main() { + textureDimensions_cec841(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DArray arg_0_1; +void textureDimensions_cec841() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +void fragment_main() { + textureDimensions_cec841(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DArray arg_0_1; +void textureDimensions_cec841() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +void compute_main() { + textureDimensions_cec841(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/cec841.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/cec841.wgsl.expected.hlsl new file mode 100644 index 0000000000..8b892fb9f9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cec841.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureDimensions_cec841() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_cec841(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_cec841(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_cec841(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/cec841.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/cec841.wgsl.expected.msl new file mode 100644 index 0000000000..7c0b4ee3e5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cec841.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_cec841(texture2d_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureDimensions_cec841(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_cec841(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_cec841(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/cec841.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/cec841.wgsl.expected.spvasm new file mode 100644 index 0000000000..34eb8ecef6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cec841.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_cec841 "textureDimensions_cec841" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 + %int_0 = OpConstant %int 0 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %25 = OpConstantNull %v2int + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_cec841 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %25 + %21 = OpLoad %11 %arg_0 + %19 = OpImageQuerySizeLod %v3int %21 %int_0 + %16 = OpVectorShuffle %v2int %19 %19 0 1 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %textureDimensions_cec841 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_cec841 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %38 = OpLabel + %39 = OpFunctionCall %void %textureDimensions_cec841 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/cec841.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/cec841.wgsl.expected.wgsl new file mode 100644 index 0000000000..d1667a0f6d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cec841.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +fn textureDimensions_cec841() { + var res : vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_cec841(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_cec841(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_cec841(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/cf7e43.wgsl b/test/tint/builtins/gen/var/textureDimensions/cf7e43.wgsl new file mode 100644 index 0000000000..8faa148e88 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cf7e43.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureDimensions(texture: texture_storage_3d) -> vec3 +fn textureDimensions_cf7e43() { + var res: vec3 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_cf7e43(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_cf7e43(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_cf7e43(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/cf7e43.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/cf7e43.wgsl.expected.glsl new file mode 100644 index 0000000000..8b491fba70 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cf7e43.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba8_snorm) uniform highp writeonly image3D arg_0; +void textureDimensions_cf7e43() { + ivec3 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_cf7e43(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8_snorm) uniform highp writeonly image3D arg_0; +void textureDimensions_cf7e43() { + ivec3 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_cf7e43(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8_snorm) uniform highp writeonly image3D arg_0; +void textureDimensions_cf7e43() { + ivec3 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_cf7e43(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/cf7e43.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/cf7e43.wgsl.expected.hlsl new file mode 100644 index 0000000000..f8b6211340 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cf7e43.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_cf7e43() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_cf7e43(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_cf7e43(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_cf7e43(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/cf7e43.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/cf7e43.wgsl.expected.msl new file mode 100644 index 0000000000..210364294b --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cf7e43.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_cf7e43(texture3d tint_symbol_1) { + int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureDimensions_cf7e43(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureDimensions_cf7e43(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureDimensions_cf7e43(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/cf7e43.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/cf7e43.wgsl.expected.spvasm new file mode 100644 index 0000000000..62a64df145 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cf7e43.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_cf7e43 "textureDimensions_cf7e43" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 3D 0 0 0 2 Rgba8Snorm +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %22 = OpConstantNull %v3int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_cf7e43 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v3int Function %22 + %19 = OpLoad %11 %arg_0 + %16 = OpImageQuerySize %v3int %19 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureDimensions_cf7e43 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %void %textureDimensions_cf7e43 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_cf7e43 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/cf7e43.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/cf7e43.wgsl.expected.wgsl new file mode 100644 index 0000000000..fd5550b6bb --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cf7e43.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureDimensions_cf7e43() { + var res : vec3 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_cf7e43(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_cf7e43(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_cf7e43(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/d125bc.wgsl b/test/tint/builtins/gen/var/textureDimensions/d125bc.wgsl new file mode 100644 index 0000000000..62a607fe01 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/d125bc.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube; + +// fn textureDimensions(texture: texture_cube) -> vec2 +fn textureDimensions_d125bc() { + var res: vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_d125bc(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_d125bc(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_d125bc(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/d125bc.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/d125bc.wgsl.expected.glsl new file mode 100644 index 0000000000..0debada7db --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/d125bc.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp samplerCube arg_0_1; +void textureDimensions_d125bc() { + ivec2 res = textureSize(arg_0_1, 0); +} + +vec4 vertex_main() { + textureDimensions_d125bc(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp samplerCube arg_0_1; +void textureDimensions_d125bc() { + ivec2 res = textureSize(arg_0_1, 0); +} + +void fragment_main() { + textureDimensions_d125bc(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp samplerCube arg_0_1; +void textureDimensions_d125bc() { + ivec2 res = textureSize(arg_0_1, 0); +} + +void compute_main() { + textureDimensions_d125bc(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/d125bc.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/d125bc.wgsl.expected.hlsl new file mode 100644 index 0000000000..bf2c107f3a --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/d125bc.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +TextureCube arg_0 : register(t0, space1); + +void textureDimensions_d125bc() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_d125bc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_d125bc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_d125bc(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/d125bc.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/d125bc.wgsl.expected.msl new file mode 100644 index 0000000000..67f0abcb41 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/d125bc.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_d125bc(texturecube tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube tint_symbol_2) { + textureDimensions_d125bc(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube tint_symbol_4 [[texture(0)]]) { + textureDimensions_d125bc(tint_symbol_4); + return; +} + +kernel void compute_main(texturecube tint_symbol_5 [[texture(0)]]) { + textureDimensions_d125bc(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/d125bc.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/d125bc.wgsl.expected.spvasm new file mode 100644 index 0000000000..3d3b32a3d1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/d125bc.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_d125bc "textureDimensions_d125bc" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float Cube 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %int_0 = OpConstant %int 0 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %23 = OpConstantNull %v2int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_d125bc = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %23 + %19 = OpLoad %11 %arg_0 + %16 = OpImageQuerySizeLod %v2int %19 %int_0 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureDimensions_d125bc + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %33 = OpLabel + %34 = OpFunctionCall %void %textureDimensions_d125bc + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_d125bc + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/d125bc.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/d125bc.wgsl.expected.wgsl new file mode 100644 index 0000000000..e8b2c56e33 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/d125bc.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_cube; + +fn textureDimensions_d125bc() { + var res : vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_d125bc(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_d125bc(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_d125bc(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/d83c45.wgsl b/test/tint/builtins/gen/var/textureDimensions/d83c45.wgsl new file mode 100644 index 0000000000..46265786bd --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/d83c45.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube_array; + +// fn textureDimensions(texture: texture_cube_array, level: i32) -> vec2 +fn textureDimensions_d83c45() { + var arg_1 = 0; + var res: vec2 = textureDimensions(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_d83c45(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_d83c45(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_d83c45(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/d83c45.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/d83c45.wgsl.expected.glsl new file mode 100644 index 0000000000..7264f8b3f2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/d83c45.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp usamplerCubeArray arg_0_1; +void textureDimensions_d83c45() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1).xy; +} + +vec4 vertex_main() { + textureDimensions_d83c45(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'usamplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp usamplerCubeArray arg_0_1; +void textureDimensions_d83c45() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1).xy; +} + +void fragment_main() { + textureDimensions_d83c45(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'usamplerCubeArray' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp usamplerCubeArray arg_0_1; +void textureDimensions_d83c45() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1).xy; +} + +void compute_main() { + textureDimensions_d83c45(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'usamplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/d83c45.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/d83c45.wgsl.expected.hlsl new file mode 100644 index 0000000000..5ccc18c3d9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/d83c45.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureDimensions_d83c45() { + int arg_1 = 0; + int4 tint_tmp; + arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_d83c45(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_d83c45(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_d83c45(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/d83c45.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/d83c45.wgsl.expected.msl new file mode 100644 index 0000000000..15239da48d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/d83c45.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void textureDimensions_d83c45(texturecube_array tint_symbol_1) { + int arg_1 = 0; + int2 res = int2(tint_symbol_1.get_width(arg_1), tint_symbol_1.get_height(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube_array tint_symbol_2) { + textureDimensions_d83c45(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_d83c45(tint_symbol_4); + return; +} + +kernel void compute_main(texturecube_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_d83c45(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/d83c45.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/d83c45.wgsl.expected.spvasm new file mode 100644 index 0000000000..8aa6e79da9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/d83c45.wgsl.expected.spvasm @@ -0,0 +1,85 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_d83c45 "textureDimensions_d83c45" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %18 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %29 = OpConstantNull %v2int + %30 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_d83c45 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %18 + %res = OpVariable %_ptr_Function_v2int Function %29 + OpStore %arg_1 %18 + %25 = OpLoad %11 %arg_0 + %26 = OpLoad %int %arg_1 + %23 = OpImageQuerySizeLod %v3int %25 %26 + %21 = OpVectorShuffle %v2int %23 %23 0 1 + OpStore %res %21 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %textureDimensions_d83c45 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %36 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %39 = OpLabel + %40 = OpFunctionCall %void %textureDimensions_d83c45 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %42 = OpLabel + %43 = OpFunctionCall %void %textureDimensions_d83c45 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/d83c45.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/d83c45.wgsl.expected.wgsl new file mode 100644 index 0000000000..a0186f6756 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/d83c45.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +@group(1) @binding(0) var arg_0 : texture_cube_array; + +fn textureDimensions_d83c45() { + var arg_1 = 0; + var res : vec2 = textureDimensions(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_d83c45(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_d83c45(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_d83c45(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/daf7c0.wgsl b/test/tint/builtins/gen/var/textureDimensions/daf7c0.wgsl new file mode 100644 index 0000000000..9d66ada51a --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/daf7c0.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_multisampled_2d; + +// fn textureDimensions(texture: texture_multisampled_2d) -> vec2 +fn textureDimensions_daf7c0() { + var res: vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_daf7c0(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_daf7c0(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_daf7c0(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/daf7c0.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/daf7c0.wgsl.expected.glsl new file mode 100644 index 0000000000..5cfbb47de9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/daf7c0.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp isampler2DMS arg_0_1; +void textureDimensions_daf7c0() { + ivec2 res = textureSize(arg_0_1); +} + +vec4 vertex_main() { + textureDimensions_daf7c0(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp isampler2DMS arg_0_1; +void textureDimensions_daf7c0() { + ivec2 res = textureSize(arg_0_1); +} + +void fragment_main() { + textureDimensions_daf7c0(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp isampler2DMS arg_0_1; +void textureDimensions_daf7c0() { + ivec2 res = textureSize(arg_0_1); +} + +void compute_main() { + textureDimensions_daf7c0(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/daf7c0.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/daf7c0.wgsl.expected.hlsl new file mode 100644 index 0000000000..b44a6b8646 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/daf7c0.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +Texture2DMS arg_0 : register(t0, space1); + +void textureDimensions_daf7c0() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_daf7c0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_daf7c0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_daf7c0(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/daf7c0.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/daf7c0.wgsl.expected.msl new file mode 100644 index 0000000000..9f811af45e --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/daf7c0.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_daf7c0(texture2d_ms tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_ms tint_symbol_2) { + textureDimensions_daf7c0(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_ms tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_ms tint_symbol_4 [[texture(0)]]) { + textureDimensions_daf7c0(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_ms tint_symbol_5 [[texture(0)]]) { + textureDimensions_daf7c0(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/daf7c0.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/daf7c0.wgsl.expected.spvasm new file mode 100644 index 0000000000..05b6fe7726 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/daf7c0.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_daf7c0 "textureDimensions_daf7c0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 0 1 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %22 = OpConstantNull %v2int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_daf7c0 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %22 + %19 = OpLoad %11 %arg_0 + %17 = OpImageQuerySize %v2int %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureDimensions_daf7c0 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %32 = OpLabel + %33 = OpFunctionCall %void %textureDimensions_daf7c0 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_daf7c0 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/daf7c0.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/daf7c0.wgsl.expected.wgsl new file mode 100644 index 0000000000..6d2fbebf54 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/daf7c0.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_multisampled_2d; + +fn textureDimensions_daf7c0() { + var res : vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_daf7c0(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_daf7c0(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_daf7c0(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/dc2dd0.wgsl b/test/tint/builtins/gen/var/textureDimensions/dc2dd0.wgsl new file mode 100644 index 0000000000..dd28eb479d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/dc2dd0.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureDimensions(texture: texture_storage_1d) -> i32 +fn textureDimensions_dc2dd0() { + var res: i32 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_dc2dd0(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_dc2dd0(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_dc2dd0(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/dc2dd0.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/dc2dd0.wgsl.expected.glsl new file mode 100644 index 0000000000..3d7ac148af --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/dc2dd0.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +layout(rgba8ui) uniform highp writeonly uimage1D arg_0; +void textureDimensions_dc2dd0() { + int res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_dc2dd0(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'uimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rgba8ui) uniform highp writeonly uimage1D arg_0; +void textureDimensions_dc2dd0() { + int res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_dc2dd0(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'uimage1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rgba8ui) uniform highp writeonly uimage1D arg_0; +void textureDimensions_dc2dd0() { + int res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_dc2dd0(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'uimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/dc2dd0.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/dc2dd0.wgsl.expected.hlsl new file mode 100644 index 0000000000..20e9146625 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/dc2dd0.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_dc2dd0() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_dc2dd0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_dc2dd0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_dc2dd0(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/dc2dd0.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/dc2dd0.wgsl.expected.msl new file mode 100644 index 0000000000..9e5082a93f --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/dc2dd0.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_dc2dd0(texture1d tint_symbol_1) { + int res = int(tint_symbol_1.get_width(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureDimensions_dc2dd0(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureDimensions_dc2dd0(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureDimensions_dc2dd0(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/dc2dd0.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/dc2dd0.wgsl.expected.spvasm new file mode 100644 index 0000000000..074de23be3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/dc2dd0.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability Image1D + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_dc2dd0 "textureDimensions_dc2dd0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 1D 0 0 0 2 Rgba8ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %22 = OpConstantNull %int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_dc2dd0 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %22 + %19 = OpLoad %11 %arg_0 + %17 = OpImageQuerySize %int %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureDimensions_dc2dd0 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %32 = OpLabel + %33 = OpFunctionCall %void %textureDimensions_dc2dd0 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_dc2dd0 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/dc2dd0.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/dc2dd0.wgsl.expected.wgsl new file mode 100644 index 0000000000..5151ae90a7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/dc2dd0.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureDimensions_dc2dd0() { + var res : i32 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_dc2dd0(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_dc2dd0(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_dc2dd0(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/e927be.wgsl b/test/tint/builtins/gen/var/textureDimensions/e927be.wgsl new file mode 100644 index 0000000000..e711cdd7da --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/e927be.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube_array; + +// fn textureDimensions(texture: texture_cube_array) -> vec2 +fn textureDimensions_e927be() { + var res: vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_e927be(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_e927be(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_e927be(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/e927be.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/e927be.wgsl.expected.glsl new file mode 100644 index 0000000000..a476da2758 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/e927be.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +uniform highp isamplerCubeArray arg_0_1; +void textureDimensions_e927be() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +vec4 vertex_main() { + textureDimensions_e927be(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'isamplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp isamplerCubeArray arg_0_1; +void textureDimensions_e927be() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +void fragment_main() { + textureDimensions_e927be(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'isamplerCubeArray' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp isamplerCubeArray arg_0_1; +void textureDimensions_e927be() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +void compute_main() { + textureDimensions_e927be(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'isamplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/e927be.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/e927be.wgsl.expected.hlsl new file mode 100644 index 0000000000..3be868f09c --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/e927be.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureDimensions_e927be() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_e927be(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_e927be(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_e927be(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/e927be.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/e927be.wgsl.expected.msl new file mode 100644 index 0000000000..709257fa98 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/e927be.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_e927be(texturecube_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube_array tint_symbol_2) { + textureDimensions_e927be(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_e927be(tint_symbol_4); + return; +} + +kernel void compute_main(texturecube_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_e927be(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/e927be.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/e927be.wgsl.expected.spvasm new file mode 100644 index 0000000000..021901e9ed --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/e927be.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_e927be "textureDimensions_e927be" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 + %int_0 = OpConstant %int 0 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %25 = OpConstantNull %v2int + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_e927be = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %25 + %21 = OpLoad %11 %arg_0 + %19 = OpImageQuerySizeLod %v3int %21 %int_0 + %17 = OpVectorShuffle %v2int %19 %19 0 1 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %textureDimensions_e927be + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_e927be + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %38 = OpLabel + %39 = OpFunctionCall %void %textureDimensions_e927be + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/e927be.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/e927be.wgsl.expected.wgsl new file mode 100644 index 0000000000..637bad6a3b --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/e927be.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_cube_array; + +fn textureDimensions_e927be() { + var res : vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_e927be(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_e927be(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_e927be(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/e9e96c.wgsl b/test/tint/builtins/gen/var/textureDimensions/e9e96c.wgsl new file mode 100644 index 0000000000..41b9f1e4ac --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/e9e96c.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureDimensions(texture: texture_storage_2d_array) -> vec2 +fn textureDimensions_e9e96c() { + var res: vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_e9e96c(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_e9e96c(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_e9e96c(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/e9e96c.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/e9e96c.wgsl.expected.glsl new file mode 100644 index 0000000000..c167c243cb --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/e9e96c.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(r32f) uniform highp writeonly image2DArray arg_0; +void textureDimensions_e9e96c() { + ivec2 res = imageSize(arg_0).xy; +} + +vec4 vertex_main() { + textureDimensions_e9e96c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(r32f) uniform highp writeonly image2DArray arg_0; +void textureDimensions_e9e96c() { + ivec2 res = imageSize(arg_0).xy; +} + +void fragment_main() { + textureDimensions_e9e96c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(r32f) uniform highp writeonly image2DArray arg_0; +void textureDimensions_e9e96c() { + ivec2 res = imageSize(arg_0).xy; +} + +void compute_main() { + textureDimensions_e9e96c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/e9e96c.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/e9e96c.wgsl.expected.hlsl new file mode 100644 index 0000000000..510eef86c0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/e9e96c.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_e9e96c() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_e9e96c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_e9e96c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_e9e96c(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/e9e96c.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/e9e96c.wgsl.expected.msl new file mode 100644 index 0000000000..d512809aa0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/e9e96c.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_e9e96c(texture2d_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureDimensions_e9e96c(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_e9e96c(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_e9e96c(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/e9e96c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/e9e96c.wgsl.expected.spvasm new file mode 100644 index 0000000000..3bc1dd4e43 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/e9e96c.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_e9e96c "textureDimensions_e9e96c" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 2 R32f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %24 = OpConstantNull %v2int + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_e9e96c = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %24 + %21 = OpLoad %11 %arg_0 + %19 = OpImageQuerySize %v3int %21 + %16 = OpVectorShuffle %v2int %19 %19 0 1 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %textureDimensions_e9e96c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %34 = OpLabel + %35 = OpFunctionCall %void %textureDimensions_e9e96c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %37 = OpLabel + %38 = OpFunctionCall %void %textureDimensions_e9e96c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/e9e96c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/e9e96c.wgsl.expected.wgsl new file mode 100644 index 0000000000..0f84facc76 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/e9e96c.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureDimensions_e9e96c() { + var res : vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_e9e96c(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_e9e96c(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_e9e96c(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/ef5b89.wgsl b/test/tint/builtins/gen/var/textureDimensions/ef5b89.wgsl new file mode 100644 index 0000000000..b533d388c6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/ef5b89.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_multisampled_2d; + +// fn textureDimensions(texture: texture_multisampled_2d) -> vec2 +fn textureDimensions_ef5b89() { + var res: vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_ef5b89(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_ef5b89(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_ef5b89(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/ef5b89.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/ef5b89.wgsl.expected.glsl new file mode 100644 index 0000000000..c0c1d74400 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/ef5b89.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp sampler2DMS arg_0_1; +void textureDimensions_ef5b89() { + ivec2 res = textureSize(arg_0_1); +} + +vec4 vertex_main() { + textureDimensions_ef5b89(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DMS arg_0_1; +void textureDimensions_ef5b89() { + ivec2 res = textureSize(arg_0_1); +} + +void fragment_main() { + textureDimensions_ef5b89(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DMS arg_0_1; +void textureDimensions_ef5b89() { + ivec2 res = textureSize(arg_0_1); +} + +void compute_main() { + textureDimensions_ef5b89(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/ef5b89.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/ef5b89.wgsl.expected.hlsl new file mode 100644 index 0000000000..4bc53da64e --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/ef5b89.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +Texture2DMS arg_0 : register(t0, space1); + +void textureDimensions_ef5b89() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_ef5b89(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_ef5b89(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_ef5b89(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/ef5b89.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/ef5b89.wgsl.expected.msl new file mode 100644 index 0000000000..a0d18a7526 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/ef5b89.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_ef5b89(texture2d_ms tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_ms tint_symbol_2) { + textureDimensions_ef5b89(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_ms tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_ms tint_symbol_4 [[texture(0)]]) { + textureDimensions_ef5b89(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_ms tint_symbol_5 [[texture(0)]]) { + textureDimensions_ef5b89(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/ef5b89.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/ef5b89.wgsl.expected.spvasm new file mode 100644 index 0000000000..2cb1a7f2fd --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/ef5b89.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_ef5b89 "textureDimensions_ef5b89" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 1 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %22 = OpConstantNull %v2int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_ef5b89 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %22 + %19 = OpLoad %11 %arg_0 + %16 = OpImageQuerySize %v2int %19 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureDimensions_ef5b89 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %void %textureDimensions_ef5b89 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_ef5b89 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/ef5b89.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/ef5b89.wgsl.expected.wgsl new file mode 100644 index 0000000000..f7589624bb --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/ef5b89.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_multisampled_2d; + +fn textureDimensions_ef5b89() { + var res : vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_ef5b89(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_ef5b89(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_ef5b89(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/efc8a4.wgsl b/test/tint/builtins/gen/var/textureDimensions/efc8a4.wgsl new file mode 100644 index 0000000000..3c65b12e7b --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/efc8a4.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_3d; + +// fn textureDimensions(texture: texture_3d, level: i32) -> vec3 +fn textureDimensions_efc8a4() { + var arg_1 = 0; + var res: vec3 = textureDimensions(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_efc8a4(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_efc8a4(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_efc8a4(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/efc8a4.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/efc8a4.wgsl.expected.glsl new file mode 100644 index 0000000000..eab90c06ad --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/efc8a4.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp isampler3D arg_0_1; +void textureDimensions_efc8a4() { + int arg_1 = 0; + ivec3 res = textureSize(arg_0_1, arg_1); +} + +vec4 vertex_main() { + textureDimensions_efc8a4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp isampler3D arg_0_1; +void textureDimensions_efc8a4() { + int arg_1 = 0; + ivec3 res = textureSize(arg_0_1, arg_1); +} + +void fragment_main() { + textureDimensions_efc8a4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp isampler3D arg_0_1; +void textureDimensions_efc8a4() { + int arg_1 = 0; + ivec3 res = textureSize(arg_0_1, arg_1); +} + +void compute_main() { + textureDimensions_efc8a4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/efc8a4.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/efc8a4.wgsl.expected.hlsl new file mode 100644 index 0000000000..359fc0bd59 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/efc8a4.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +Texture3D arg_0 : register(t0, space1); + +void textureDimensions_efc8a4() { + int arg_1 = 0; + int4 tint_tmp; + arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int3 res = tint_tmp.xyz; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_efc8a4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_efc8a4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_efc8a4(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/efc8a4.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/efc8a4.wgsl.expected.msl new file mode 100644 index 0000000000..d1ba35ec51 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/efc8a4.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void textureDimensions_efc8a4(texture3d tint_symbol_1) { + int arg_1 = 0; + int3 res = int3(tint_symbol_1.get_width(arg_1), tint_symbol_1.get_height(arg_1), tint_symbol_1.get_depth(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureDimensions_efc8a4(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureDimensions_efc8a4(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureDimensions_efc8a4(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/efc8a4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/efc8a4.wgsl.expected.spvasm new file mode 100644 index 0000000000..83fbad656b --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/efc8a4.wgsl.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_efc8a4 "textureDimensions_efc8a4" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 3D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %17 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %v3int = OpTypeVector %int 3 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %26 = OpConstantNull %v3int + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_efc8a4 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %17 + %res = OpVariable %_ptr_Function_v3int Function %26 + OpStore %arg_1 %17 + %22 = OpLoad %11 %arg_0 + %23 = OpLoad %int %arg_1 + %20 = OpImageQuerySizeLod %v3int %22 %23 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %textureDimensions_efc8a4 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_efc8a4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %39 = OpLabel + %40 = OpFunctionCall %void %textureDimensions_efc8a4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/efc8a4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/efc8a4.wgsl.expected.wgsl new file mode 100644 index 0000000000..0bec181c10 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/efc8a4.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +@group(1) @binding(0) var arg_0 : texture_3d; + +fn textureDimensions_efc8a4() { + var arg_1 = 0; + var res : vec3 = textureDimensions(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_efc8a4(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_efc8a4(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_efc8a4(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/f60bdb.wgsl b/test/tint/builtins/gen/var/textureDimensions/f60bdb.wgsl new file mode 100644 index 0000000000..167f39a254 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/f60bdb.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_multisampled_2d; + +// fn textureDimensions(texture: texture_depth_multisampled_2d) -> vec2 +fn textureDimensions_f60bdb() { + var res: vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_f60bdb(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_f60bdb(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_f60bdb(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/f60bdb.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/f60bdb.wgsl.expected.glsl new file mode 100644 index 0000000000..943195634d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/f60bdb.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp sampler2DMS arg_0_1; +void textureDimensions_f60bdb() { + ivec2 res = textureSize(arg_0_1); +} + +vec4 vertex_main() { + textureDimensions_f60bdb(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DMS arg_0_1; +void textureDimensions_f60bdb() { + ivec2 res = textureSize(arg_0_1); +} + +void fragment_main() { + textureDimensions_f60bdb(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DMS arg_0_1; +void textureDimensions_f60bdb() { + ivec2 res = textureSize(arg_0_1); +} + +void compute_main() { + textureDimensions_f60bdb(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/f60bdb.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/f60bdb.wgsl.expected.hlsl new file mode 100644 index 0000000000..1609032503 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/f60bdb.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +Texture2DMS arg_0 : register(t0, space1); + +void textureDimensions_f60bdb() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_f60bdb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_f60bdb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_f60bdb(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/f60bdb.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/f60bdb.wgsl.expected.msl new file mode 100644 index 0000000000..1ec0626ad9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/f60bdb.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_f60bdb(depth2d_ms tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d_ms tint_symbol_2) { + textureDimensions_f60bdb(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d_ms tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d_ms tint_symbol_4 [[texture(0)]]) { + textureDimensions_f60bdb(tint_symbol_4); + return; +} + +kernel void compute_main(depth2d_ms tint_symbol_5 [[texture(0)]]) { + textureDimensions_f60bdb(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/f60bdb.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/f60bdb.wgsl.expected.spvasm new file mode 100644 index 0000000000..e43fe0b98a --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/f60bdb.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_f60bdb "textureDimensions_f60bdb" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 1 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %22 = OpConstantNull %v2int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_f60bdb = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %22 + %19 = OpLoad %11 %arg_0 + %16 = OpImageQuerySize %v2int %19 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureDimensions_f60bdb + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %void %textureDimensions_f60bdb + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_f60bdb + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/f60bdb.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/f60bdb.wgsl.expected.wgsl new file mode 100644 index 0000000000..04d24555c7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/f60bdb.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_depth_multisampled_2d; + +fn textureDimensions_f60bdb() { + var res : vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_f60bdb(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_f60bdb(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_f60bdb(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/f7145b.wgsl b/test/tint/builtins/gen/var/textureDimensions/f7145b.wgsl new file mode 100644 index 0000000000..b2c2685b81 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/f7145b.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d; + +// fn textureDimensions(texture: texture_2d, level: i32) -> vec2 +fn textureDimensions_f7145b() { + var arg_1 = 0; + var res: vec2 = textureDimensions(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_f7145b(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_f7145b(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_f7145b(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/f7145b.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/f7145b.wgsl.expected.glsl new file mode 100644 index 0000000000..23309a590d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/f7145b.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp usampler2D arg_0_1; +void textureDimensions_f7145b() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1); +} + +vec4 vertex_main() { + textureDimensions_f7145b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp usampler2D arg_0_1; +void textureDimensions_f7145b() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1); +} + +void fragment_main() { + textureDimensions_f7145b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp usampler2D arg_0_1; +void textureDimensions_f7145b() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1); +} + +void compute_main() { + textureDimensions_f7145b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/f7145b.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/f7145b.wgsl.expected.hlsl new file mode 100644 index 0000000000..54d1c39bf6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/f7145b.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +Texture2D arg_0 : register(t0, space1); + +void textureDimensions_f7145b() { + int arg_1 = 0; + int3 tint_tmp; + arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_f7145b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_f7145b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_f7145b(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/f7145b.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/f7145b.wgsl.expected.msl new file mode 100644 index 0000000000..7fff8169d2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/f7145b.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void textureDimensions_f7145b(texture2d tint_symbol_1) { + int arg_1 = 0; + int2 res = int2(tint_symbol_1.get_width(arg_1), tint_symbol_1.get_height(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureDimensions_f7145b(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_f7145b(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_f7145b(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/f7145b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/f7145b.wgsl.expected.spvasm new file mode 100644 index 0000000000..cf66407f83 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/f7145b.wgsl.expected.spvasm @@ -0,0 +1,82 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 42 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_f7145b "textureDimensions_f7145b" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %18 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %27 = OpConstantNull %v2int + %28 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_f7145b = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %18 + %res = OpVariable %_ptr_Function_v2int Function %27 + OpStore %arg_1 %18 + %23 = OpLoad %11 %arg_0 + %24 = OpLoad %int %arg_1 + %21 = OpImageQuerySizeLod %v2int %23 %24 + OpStore %res %21 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %28 + %30 = OpLabel + %31 = OpFunctionCall %void %textureDimensions_f7145b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %33 = OpLabel + %34 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %34 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %37 = OpLabel + %38 = OpFunctionCall %void %textureDimensions_f7145b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %40 = OpLabel + %41 = OpFunctionCall %void %textureDimensions_f7145b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/f7145b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/f7145b.wgsl.expected.wgsl new file mode 100644 index 0000000000..0bbfb0e8f3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/f7145b.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +@group(1) @binding(0) var arg_0 : texture_2d; + +fn textureDimensions_f7145b() { + var arg_1 = 0; + var res : vec2 = textureDimensions(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_f7145b(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_f7145b(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_f7145b(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/f931c7.wgsl b/test/tint/builtins/gen/var/textureDimensions/f931c7.wgsl new file mode 100644 index 0000000000..85c0fab066 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/f931c7.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureDimensions(texture: texture_storage_2d) -> vec2 +fn textureDimensions_f931c7() { + var res: vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_f931c7(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_f931c7(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_f931c7(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/f931c7.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/f931c7.wgsl.expected.glsl new file mode 100644 index 0000000000..016f679a07 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/f931c7.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(r32f) uniform highp writeonly image2D arg_0; +void textureDimensions_f931c7() { + ivec2 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_f931c7(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(r32f) uniform highp writeonly image2D arg_0; +void textureDimensions_f931c7() { + ivec2 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_f931c7(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(r32f) uniform highp writeonly image2D arg_0; +void textureDimensions_f931c7() { + ivec2 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_f931c7(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/f931c7.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/f931c7.wgsl.expected.hlsl new file mode 100644 index 0000000000..9e231e6b57 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/f931c7.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_f931c7() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_f931c7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_f931c7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_f931c7(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/f931c7.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/f931c7.wgsl.expected.msl new file mode 100644 index 0000000000..7b39e0fb9e --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/f931c7.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_f931c7(texture2d tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureDimensions_f931c7(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_f931c7(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_f931c7(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/f931c7.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/f931c7.wgsl.expected.spvasm new file mode 100644 index 0000000000..2375b4d725 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/f931c7.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_f931c7 "textureDimensions_f931c7" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 2 R32f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %22 = OpConstantNull %v2int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_f931c7 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %22 + %19 = OpLoad %11 %arg_0 + %16 = OpImageQuerySize %v2int %19 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureDimensions_f931c7 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %void %textureDimensions_f931c7 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_f931c7 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/f931c7.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/f931c7.wgsl.expected.wgsl new file mode 100644 index 0000000000..14de15ab0c --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/f931c7.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureDimensions_f931c7() { + var res : vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_f931c7(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_f931c7(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_f931c7(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/fa9859.wgsl b/test/tint/builtins/gen/var/textureDimensions/fa9859.wgsl new file mode 100644 index 0000000000..206c54ecf8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/fa9859.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d; + +// fn textureDimensions(texture: texture_2d) -> vec2 +fn textureDimensions_fa9859() { + var res: vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_fa9859(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_fa9859(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_fa9859(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/fa9859.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/fa9859.wgsl.expected.glsl new file mode 100644 index 0000000000..d8e8370ef5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/fa9859.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp isampler2D arg_0_1; +void textureDimensions_fa9859() { + ivec2 res = textureSize(arg_0_1, 0); +} + +vec4 vertex_main() { + textureDimensions_fa9859(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp isampler2D arg_0_1; +void textureDimensions_fa9859() { + ivec2 res = textureSize(arg_0_1, 0); +} + +void fragment_main() { + textureDimensions_fa9859(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp isampler2D arg_0_1; +void textureDimensions_fa9859() { + ivec2 res = textureSize(arg_0_1, 0); +} + +void compute_main() { + textureDimensions_fa9859(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/fa9859.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/fa9859.wgsl.expected.hlsl new file mode 100644 index 0000000000..4bfdddf6b2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/fa9859.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_0 : register(t0, space1); + +void textureDimensions_fa9859() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_fa9859(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_fa9859(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_fa9859(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/fa9859.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/fa9859.wgsl.expected.msl new file mode 100644 index 0000000000..5fca056387 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/fa9859.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_fa9859(texture2d tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureDimensions_fa9859(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_fa9859(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_fa9859(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/fa9859.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/fa9859.wgsl.expected.spvasm new file mode 100644 index 0000000000..769c44ef70 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/fa9859.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_fa9859 "textureDimensions_fa9859" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v2int = OpTypeVector %int 2 + %int_0 = OpConstant %int 0 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %23 = OpConstantNull %v2int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_fa9859 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %23 + %19 = OpLoad %11 %arg_0 + %17 = OpImageQuerySizeLod %v2int %19 %int_0 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureDimensions_fa9859 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %33 = OpLabel + %34 = OpFunctionCall %void %textureDimensions_fa9859 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_fa9859 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/fa9859.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/fa9859.wgsl.expected.wgsl new file mode 100644 index 0000000000..58b2bd0e55 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/fa9859.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_2d; + +fn textureDimensions_fa9859() { + var res : vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_fa9859(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_fa9859(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_fa9859(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/fb5670.wgsl b/test/tint/builtins/gen/var/textureDimensions/fb5670.wgsl new file mode 100644 index 0000000000..fcfb9cf8c8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/fb5670.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureDimensions(texture: texture_storage_2d_array) -> vec2 +fn textureDimensions_fb5670() { + var res: vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_fb5670(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_fb5670(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_fb5670(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/fb5670.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/fb5670.wgsl.expected.glsl new file mode 100644 index 0000000000..5c3bd40cfc --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/fb5670.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32f) uniform highp writeonly image2DArray arg_0; +void textureDimensions_fb5670() { + ivec2 res = imageSize(arg_0).xy; +} + +vec4 vertex_main() { + textureDimensions_fb5670(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32f) uniform highp writeonly image2DArray arg_0; +void textureDimensions_fb5670() { + ivec2 res = imageSize(arg_0).xy; +} + +void fragment_main() { + textureDimensions_fb5670(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32f) uniform highp writeonly image2DArray arg_0; +void textureDimensions_fb5670() { + ivec2 res = imageSize(arg_0).xy; +} + +void compute_main() { + textureDimensions_fb5670(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/fb5670.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/fb5670.wgsl.expected.hlsl new file mode 100644 index 0000000000..3f6c71f974 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/fb5670.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_fb5670() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_fb5670(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_fb5670(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_fb5670(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/fb5670.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/fb5670.wgsl.expected.msl new file mode 100644 index 0000000000..fed740f414 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/fb5670.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_fb5670(texture2d_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureDimensions_fb5670(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_fb5670(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_fb5670(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/fb5670.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/fb5670.wgsl.expected.spvasm new file mode 100644 index 0000000000..c870194c01 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/fb5670.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability StorageImageExtendedFormats + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_fb5670 "textureDimensions_fb5670" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 2 Rg32f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %24 = OpConstantNull %v2int + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_fb5670 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %24 + %21 = OpLoad %11 %arg_0 + %19 = OpImageQuerySize %v3int %21 + %16 = OpVectorShuffle %v2int %19 %19 0 1 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %textureDimensions_fb5670 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %34 = OpLabel + %35 = OpFunctionCall %void %textureDimensions_fb5670 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %37 = OpLabel + %38 = OpFunctionCall %void %textureDimensions_fb5670 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/fb5670.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/fb5670.wgsl.expected.wgsl new file mode 100644 index 0000000000..79fcdb8375 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/fb5670.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureDimensions_fb5670() { + var res : vec2 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_fb5670(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_fb5670(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_fb5670(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/fcac78.wgsl b/test/tint/builtins/gen/var/textureDimensions/fcac78.wgsl new file mode 100644 index 0000000000..7e7c4d874f --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/fcac78.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureDimensions(texture: texture_storage_3d) -> vec3 +fn textureDimensions_fcac78() { + var res: vec3 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_fcac78(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_fcac78(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_fcac78(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/fcac78.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/fcac78.wgsl.expected.glsl new file mode 100644 index 0000000000..9226dcd02c --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/fcac78.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba8ui) uniform highp writeonly uimage3D arg_0; +void textureDimensions_fcac78() { + ivec3 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_fcac78(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8ui) uniform highp writeonly uimage3D arg_0; +void textureDimensions_fcac78() { + ivec3 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_fcac78(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8ui) uniform highp writeonly uimage3D arg_0; +void textureDimensions_fcac78() { + ivec3 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_fcac78(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/fcac78.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/fcac78.wgsl.expected.hlsl new file mode 100644 index 0000000000..f02946b4e5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/fcac78.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_fcac78() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_fcac78(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_fcac78(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_fcac78(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/fcac78.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/fcac78.wgsl.expected.msl new file mode 100644 index 0000000000..3c6340c1e9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/fcac78.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_fcac78(texture3d tint_symbol_1) { + int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureDimensions_fcac78(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureDimensions_fcac78(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureDimensions_fcac78(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/fcac78.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/fcac78.wgsl.expected.spvasm new file mode 100644 index 0000000000..2b1c5c3df1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/fcac78.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_fcac78 "textureDimensions_fcac78" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 3D 0 0 0 2 Rgba8ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %23 = OpConstantNull %v3int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_fcac78 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v3int Function %23 + %20 = OpLoad %11 %arg_0 + %17 = OpImageQuerySize %v3int %20 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureDimensions_fcac78 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %33 = OpLabel + %34 = OpFunctionCall %void %textureDimensions_fcac78 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_fcac78 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/fcac78.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/fcac78.wgsl.expected.wgsl new file mode 100644 index 0000000000..bd243ab9de --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/fcac78.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureDimensions_fcac78() { + var res : vec3 = textureDimensions(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_fcac78(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureDimensions_fcac78(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureDimensions_fcac78(); +} diff --git a/test/tint/builtins/gen/var/textureGather/10c554.wgsl b/test/tint/builtins/gen/var/textureGather/10c554.wgsl new file mode 100644 index 0000000000..3f1f968cdb --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/10c554.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_cube; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureGather(texture: texture_depth_cube, sampler: sampler, coords: vec3) -> vec4 +fn textureGather_10c554() { + var arg_2 = vec3(); + var res: vec4 = textureGather(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_10c554(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_10c554(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_10c554(); +} diff --git a/test/tint/builtins/gen/var/textureGather/10c554.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/10c554.wgsl.expected.glsl new file mode 100644 index 0000000000..e6f2add193 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/10c554.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +uniform highp samplerCubeShadow arg_0_arg_1; + +void textureGather_10c554() { + vec3 arg_2 = vec3(0.0f); + vec4 res = textureGather(arg_0_arg_1, arg_2, 0.0); +} + +vec4 vertex_main() { + textureGather_10c554(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp samplerCubeShadow arg_0_arg_1; + +void textureGather_10c554() { + vec3 arg_2 = vec3(0.0f); + vec4 res = textureGather(arg_0_arg_1, arg_2, 0.0); +} + +void fragment_main() { + textureGather_10c554(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp samplerCubeShadow arg_0_arg_1; + +void textureGather_10c554() { + vec3 arg_2 = vec3(0.0f); + vec4 res = textureGather(arg_0_arg_1, arg_2, 0.0); +} + +void compute_main() { + textureGather_10c554(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/10c554.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureGather/10c554.wgsl.expected.hlsl new file mode 100644 index 0000000000..eab22776f4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/10c554.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +TextureCube arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureGather_10c554() { + float3 arg_2 = (0.0f).xxx; + float4 res = arg_0.Gather(arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_10c554(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_10c554(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_10c554(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/10c554.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/10c554.wgsl.expected.msl new file mode 100644 index 0000000000..16595bde0d --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/10c554.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void textureGather_10c554(depthcube tint_symbol_1, sampler tint_symbol_2) { + float3 arg_2 = float3(0.0f); + float4 res = tint_symbol_1.gather(tint_symbol_2, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depthcube tint_symbol_3, sampler tint_symbol_4) { + textureGather_10c554(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depthcube tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depthcube tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_10c554(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depthcube tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_10c554(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureGather/10c554.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/10c554.wgsl.expected.spvasm new file mode 100644 index 0000000000..76b255317f --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/10c554.wgsl.expected.spvasm @@ -0,0 +1,89 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureGather_10c554 "textureGather_10c554" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float Cube 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %20 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %26 = OpTypeSampledImage %11 + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %33 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_10c554 = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v3float Function %20 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_2 %20 + %24 = OpLoad %14 %arg_1 + %25 = OpLoad %11 %arg_0 + %27 = OpSampledImage %26 %25 %24 + %28 = OpLoad %v3float %arg_2 + %23 = OpImageGather %v4float %27 %28 %int_0 + OpStore %res %23 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %33 + %35 = OpLabel + %36 = OpFunctionCall %void %textureGather_10c554 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %38 = OpLabel + %39 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %39 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %42 = OpLabel + %43 = OpFunctionCall %void %textureGather_10c554 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %45 = OpLabel + %46 = OpFunctionCall %void %textureGather_10c554 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureGather/10c554.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/10c554.wgsl.expected.wgsl new file mode 100644 index 0000000000..2e22217e6f --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/10c554.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +@group(1) @binding(0) var arg_0 : texture_depth_cube; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureGather_10c554() { + var arg_2 = vec3(); + var res : vec4 = textureGather(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_10c554(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_10c554(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_10c554(); +} diff --git a/test/tint/builtins/gen/var/textureGather/1f7f6b.wgsl b/test/tint/builtins/gen/var/textureGather/1f7f6b.wgsl new file mode 100644 index 0000000000..e22c989947 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/1f7f6b.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureGather(texture: texture_depth_2d, sampler: sampler, coords: vec2, @const offset: vec2) -> vec4 +fn textureGather_1f7f6b() { + var arg_2 = vec2(); + var res: vec4 = textureGather(arg_0, arg_1, arg_2, vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_1f7f6b(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_1f7f6b(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_1f7f6b(); +} diff --git a/test/tint/builtins/gen/var/textureGather/1f7f6b.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/1f7f6b.wgsl.expected.glsl new file mode 100644 index 0000000000..151624890f --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/1f7f6b.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureGather_1f7f6b() { + vec2 arg_2 = vec2(0.0f); + vec4 res = textureGatherOffset(arg_0_arg_1, arg_2, 0.0, ivec2(0)); +} + +vec4 vertex_main() { + textureGather_1f7f6b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureGather_1f7f6b() { + vec2 arg_2 = vec2(0.0f); + vec4 res = textureGatherOffset(arg_0_arg_1, arg_2, 0.0, ivec2(0)); +} + +void fragment_main() { + textureGather_1f7f6b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureGather_1f7f6b() { + vec2 arg_2 = vec2(0.0f); + vec4 res = textureGatherOffset(arg_0_arg_1, arg_2, 0.0, ivec2(0)); +} + +void compute_main() { + textureGather_1f7f6b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/1f7f6b.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureGather/1f7f6b.wgsl.expected.hlsl new file mode 100644 index 0000000000..36412fad8e --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/1f7f6b.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureGather_1f7f6b() { + float2 arg_2 = (0.0f).xx; + float4 res = arg_0.Gather(arg_1, arg_2, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_1f7f6b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_1f7f6b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_1f7f6b(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/1f7f6b.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/1f7f6b.wgsl.expected.msl new file mode 100644 index 0000000000..5219d4f534 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/1f7f6b.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void textureGather_1f7f6b(depth2d tint_symbol_1, sampler tint_symbol_2) { + float2 arg_2 = float2(0.0f); + float4 res = tint_symbol_1.gather(tint_symbol_2, arg_2, int2(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d tint_symbol_3, sampler tint_symbol_4) { + textureGather_1f7f6b(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_1f7f6b(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depth2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_1f7f6b(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureGather/1f7f6b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/1f7f6b.wgsl.expected.spvasm new file mode 100644 index 0000000000..d32d0526d6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/1f7f6b.wgsl.expected.spvasm @@ -0,0 +1,91 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 49 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureGather_1f7f6b "textureGather_1f7f6b" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %20 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %26 = OpTypeSampledImage %11 + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %v2int = OpTypeVector %int 2 + %32 = OpConstantNull %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %35 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_1f7f6b = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %20 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_2 %20 + %24 = OpLoad %14 %arg_1 + %25 = OpLoad %11 %arg_0 + %27 = OpSampledImage %26 %25 %24 + %28 = OpLoad %v2float %arg_2 + %23 = OpImageGather %v4float %27 %28 %int_0 ConstOffset %32 + OpStore %res %23 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %35 + %37 = OpLabel + %38 = OpFunctionCall %void %textureGather_1f7f6b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %40 = OpLabel + %41 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %41 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %44 = OpLabel + %45 = OpFunctionCall %void %textureGather_1f7f6b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %47 = OpLabel + %48 = OpFunctionCall %void %textureGather_1f7f6b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureGather/1f7f6b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/1f7f6b.wgsl.expected.wgsl new file mode 100644 index 0000000000..b5b56634a1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/1f7f6b.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureGather_1f7f6b() { + var arg_2 = vec2(); + var res : vec4 = textureGather(arg_0, arg_1, arg_2, vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_1f7f6b(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_1f7f6b(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_1f7f6b(); +} diff --git a/test/tint/builtins/gen/var/textureGather/22e930.wgsl b/test/tint/builtins/gen/var/textureGather/22e930.wgsl new file mode 100644 index 0000000000..ba57f22822 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/22e930.wgsl @@ -0,0 +1,49 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_2d_array; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32) -> vec4 +fn textureGather_22e930() { + var arg_3 = vec2(); + var arg_4 = 1; + var res: vec4 = textureGather(1, arg_1, arg_2, arg_3, arg_4); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_22e930(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_22e930(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_22e930(); +} diff --git a/test/tint/builtins/gen/var/textureGather/22e930.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/22e930.wgsl.expected.glsl new file mode 100644 index 0000000000..af841336f9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/22e930.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +uniform highp sampler2DArray arg_1_arg_2; + +void textureGather_22e930() { + vec2 arg_3 = vec2(0.0f); + int arg_4 = 1; + vec4 res = textureGather(arg_1_arg_2, vec3(arg_3, float(arg_4)), 1); +} + +vec4 vertex_main() { + textureGather_22e930(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DArray arg_1_arg_2; + +void textureGather_22e930() { + vec2 arg_3 = vec2(0.0f); + int arg_4 = 1; + vec4 res = textureGather(arg_1_arg_2, vec3(arg_3, float(arg_4)), 1); +} + +void fragment_main() { + textureGather_22e930(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DArray arg_1_arg_2; + +void textureGather_22e930() { + vec2 arg_3 = vec2(0.0f); + int arg_4 = 1; + vec4 res = textureGather(arg_1_arg_2, vec3(arg_3, float(arg_4)), 1); +} + +void compute_main() { + textureGather_22e930(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/22e930.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureGather/22e930.wgsl.expected.hlsl new file mode 100644 index 0000000000..7aa31c9885 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/22e930.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +Texture2DArray arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_22e930() { + float2 arg_3 = (0.0f).xx; + int arg_4 = 1; + float4 res = arg_1.GatherGreen(arg_2, float3(arg_3, float(arg_4))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_22e930(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_22e930(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_22e930(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/22e930.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/22e930.wgsl.expected.msl new file mode 100644 index 0000000000..d6b3f74d37 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/22e930.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureGather_22e930(texture2d_array tint_symbol_1, sampler tint_symbol_2) { + float2 arg_3 = float2(0.0f); + int arg_4 = 1; + float4 res = tint_symbol_1.gather(tint_symbol_2, arg_3, arg_4, int2(0), component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_3, sampler tint_symbol_4) { + textureGather_22e930(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_22e930(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_22e930(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureGather/22e930.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/22e930.wgsl.expected.spvasm new file mode 100644 index 0000000000..dce3fe053d --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/22e930.wgsl.expected.spvasm @@ -0,0 +1,100 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 56 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_22e930 "textureGather_22e930" + OpName %arg_3 "arg_3" + OpName %arg_4 "arg_4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_2 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %20 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %27 = OpConstantNull %int + %31 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %42 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_22e930 = OpFunction %void None %15 + %18 = OpLabel + %arg_3 = OpVariable %_ptr_Function_v2float Function %20 + %arg_4 = OpVariable %_ptr_Function_int Function %27 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_3 %20 + OpStore %arg_4 %int_1 + %29 = OpLoad %14 %arg_2 + %30 = OpLoad %11 %arg_1 + %32 = OpSampledImage %31 %30 %29 + %34 = OpLoad %v2float %arg_3 + %35 = OpCompositeExtract %float %34 0 + %36 = OpCompositeExtract %float %34 1 + %38 = OpLoad %int %arg_4 + %37 = OpConvertSToF %float %38 + %39 = OpCompositeConstruct %v3float %35 %36 %37 + %28 = OpImageGather %v4float %32 %39 %int_1 + OpStore %res %28 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %42 + %44 = OpLabel + %45 = OpFunctionCall %void %textureGather_22e930 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %47 = OpLabel + %48 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %48 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %51 = OpLabel + %52 = OpFunctionCall %void %textureGather_22e930 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %54 = OpLabel + %55 = OpFunctionCall %void %textureGather_22e930 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureGather/22e930.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/22e930.wgsl.expected.wgsl new file mode 100644 index 0000000000..2642e65308 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/22e930.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +@group(1) @binding(1) var arg_1 : texture_2d_array; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_22e930() { + var arg_3 = vec2(); + var arg_4 = 1; + var res : vec4 = textureGather(1, arg_1, arg_2, arg_3, arg_4); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_22e930(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_22e930(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_22e930(); +} diff --git a/test/tint/builtins/gen/var/textureGather/2cc066.wgsl b/test/tint/builtins/gen/var/textureGather/2cc066.wgsl new file mode 100644 index 0000000000..436aa7448e --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/2cc066.wgsl @@ -0,0 +1,49 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_2d_array; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32) -> vec4 +fn textureGather_2cc066() { + var arg_3 = vec2(); + var arg_4 = 1; + var res: vec4 = textureGather(1, arg_1, arg_2, arg_3, arg_4); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_2cc066(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_2cc066(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_2cc066(); +} diff --git a/test/tint/builtins/gen/var/textureGather/2cc066.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/2cc066.wgsl.expected.glsl new file mode 100644 index 0000000000..42cedd124d --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/2cc066.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +uniform highp usampler2DArray arg_1_arg_2; + +void textureGather_2cc066() { + vec2 arg_3 = vec2(0.0f); + int arg_4 = 1; + uvec4 res = textureGather(arg_1_arg_2, vec3(arg_3, float(arg_4)), 1); +} + +vec4 vertex_main() { + textureGather_2cc066(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp usampler2DArray arg_1_arg_2; + +void textureGather_2cc066() { + vec2 arg_3 = vec2(0.0f); + int arg_4 = 1; + uvec4 res = textureGather(arg_1_arg_2, vec3(arg_3, float(arg_4)), 1); +} + +void fragment_main() { + textureGather_2cc066(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp usampler2DArray arg_1_arg_2; + +void textureGather_2cc066() { + vec2 arg_3 = vec2(0.0f); + int arg_4 = 1; + uvec4 res = textureGather(arg_1_arg_2, vec3(arg_3, float(arg_4)), 1); +} + +void compute_main() { + textureGather_2cc066(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/2cc066.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureGather/2cc066.wgsl.expected.hlsl new file mode 100644 index 0000000000..3d64cb3118 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/2cc066.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +Texture2DArray arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_2cc066() { + float2 arg_3 = (0.0f).xx; + int arg_4 = 1; + uint4 res = arg_1.GatherGreen(arg_2, float3(arg_3, float(arg_4))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_2cc066(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_2cc066(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_2cc066(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/2cc066.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/2cc066.wgsl.expected.msl new file mode 100644 index 0000000000..1788324a49 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/2cc066.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureGather_2cc066(texture2d_array tint_symbol_1, sampler tint_symbol_2) { + float2 arg_3 = float2(0.0f); + int arg_4 = 1; + uint4 res = tint_symbol_1.gather(tint_symbol_2, arg_3, arg_4, int2(0), component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_3, sampler tint_symbol_4) { + textureGather_2cc066(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_2cc066(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_2cc066(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureGather/2cc066.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/2cc066.wgsl.expected.spvasm new file mode 100644 index 0000000000..ba22c06769 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/2cc066.wgsl.expected.spvasm @@ -0,0 +1,103 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 59 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_2cc066 "textureGather_2cc066" + OpName %arg_3 "arg_3" + OpName %arg_4 "arg_4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %15 = OpTypeSampler +%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 + %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant + %void = OpTypeVoid + %16 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %21 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %28 = OpConstantNull %int + %v4uint = OpTypeVector %uint 4 + %33 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %44 = OpConstantNull %v4uint + %45 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_2cc066 = OpFunction %void None %16 + %19 = OpLabel + %arg_3 = OpVariable %_ptr_Function_v2float Function %21 + %arg_4 = OpVariable %_ptr_Function_int Function %28 + %res = OpVariable %_ptr_Function_v4uint Function %44 + OpStore %arg_3 %21 + OpStore %arg_4 %int_1 + %31 = OpLoad %15 %arg_2 + %32 = OpLoad %11 %arg_1 + %34 = OpSampledImage %33 %32 %31 + %36 = OpLoad %v2float %arg_3 + %37 = OpCompositeExtract %float %36 0 + %38 = OpCompositeExtract %float %36 1 + %40 = OpLoad %int %arg_4 + %39 = OpConvertSToF %float %40 + %41 = OpCompositeConstruct %v3float %37 %38 %39 + %29 = OpImageGather %v4uint %34 %41 %int_1 + OpStore %res %29 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %45 + %47 = OpLabel + %48 = OpFunctionCall %void %textureGather_2cc066 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %16 + %50 = OpLabel + %51 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %51 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %16 + %54 = OpLabel + %55 = OpFunctionCall %void %textureGather_2cc066 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %16 + %57 = OpLabel + %58 = OpFunctionCall %void %textureGather_2cc066 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureGather/2cc066.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/2cc066.wgsl.expected.wgsl new file mode 100644 index 0000000000..a7766aafab --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/2cc066.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +@group(1) @binding(1) var arg_1 : texture_2d_array; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_2cc066() { + var arg_3 = vec2(); + var arg_4 = 1; + var res : vec4 = textureGather(1, arg_1, arg_2, arg_3, arg_4); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_2cc066(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_2cc066(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_2cc066(); +} diff --git a/test/tint/builtins/gen/var/textureGather/2e0ed5.wgsl b/test/tint/builtins/gen/var/textureGather/2e0ed5.wgsl new file mode 100644 index 0000000000..f678c1d059 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/2e0ed5.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureGather(texture: texture_depth_2d, sampler: sampler, coords: vec2) -> vec4 +fn textureGather_2e0ed5() { + var arg_2 = vec2(); + var res: vec4 = textureGather(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_2e0ed5(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_2e0ed5(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_2e0ed5(); +} diff --git a/test/tint/builtins/gen/var/textureGather/2e0ed5.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/2e0ed5.wgsl.expected.glsl new file mode 100644 index 0000000000..56056aeb55 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/2e0ed5.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureGather_2e0ed5() { + vec2 arg_2 = vec2(0.0f); + vec4 res = textureGather(arg_0_arg_1, arg_2, 0.0); +} + +vec4 vertex_main() { + textureGather_2e0ed5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureGather_2e0ed5() { + vec2 arg_2 = vec2(0.0f); + vec4 res = textureGather(arg_0_arg_1, arg_2, 0.0); +} + +void fragment_main() { + textureGather_2e0ed5(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureGather_2e0ed5() { + vec2 arg_2 = vec2(0.0f); + vec4 res = textureGather(arg_0_arg_1, arg_2, 0.0); +} + +void compute_main() { + textureGather_2e0ed5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/2e0ed5.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureGather/2e0ed5.wgsl.expected.hlsl new file mode 100644 index 0000000000..995319a09a --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/2e0ed5.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureGather_2e0ed5() { + float2 arg_2 = (0.0f).xx; + float4 res = arg_0.Gather(arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_2e0ed5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_2e0ed5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_2e0ed5(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/2e0ed5.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/2e0ed5.wgsl.expected.msl new file mode 100644 index 0000000000..0fafcf7131 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/2e0ed5.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void textureGather_2e0ed5(depth2d tint_symbol_1, sampler tint_symbol_2) { + float2 arg_2 = float2(0.0f); + float4 res = tint_symbol_1.gather(tint_symbol_2, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d tint_symbol_3, sampler tint_symbol_4) { + textureGather_2e0ed5(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_2e0ed5(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depth2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_2e0ed5(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureGather/2e0ed5.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/2e0ed5.wgsl.expected.spvasm new file mode 100644 index 0000000000..c33a890d85 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/2e0ed5.wgsl.expected.spvasm @@ -0,0 +1,89 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureGather_2e0ed5 "textureGather_2e0ed5" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %20 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %26 = OpTypeSampledImage %11 + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %33 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_2e0ed5 = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %20 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_2 %20 + %24 = OpLoad %14 %arg_1 + %25 = OpLoad %11 %arg_0 + %27 = OpSampledImage %26 %25 %24 + %28 = OpLoad %v2float %arg_2 + %23 = OpImageGather %v4float %27 %28 %int_0 + OpStore %res %23 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %33 + %35 = OpLabel + %36 = OpFunctionCall %void %textureGather_2e0ed5 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %38 = OpLabel + %39 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %39 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %42 = OpLabel + %43 = OpFunctionCall %void %textureGather_2e0ed5 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %45 = OpLabel + %46 = OpFunctionCall %void %textureGather_2e0ed5 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureGather/2e0ed5.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/2e0ed5.wgsl.expected.wgsl new file mode 100644 index 0000000000..b2617bb533 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/2e0ed5.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureGather_2e0ed5() { + var arg_2 = vec2(); + var res : vec4 = textureGather(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_2e0ed5(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_2e0ed5(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_2e0ed5(); +} diff --git a/test/tint/builtins/gen/var/textureGather/32c4e8.wgsl b/test/tint/builtins/gen/var/textureGather/32c4e8.wgsl new file mode 100644 index 0000000000..981274f851 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/32c4e8.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_cube; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_cube, sampler: sampler, coords: vec3) -> vec4 +fn textureGather_32c4e8() { + var arg_3 = vec3(); + var res: vec4 = textureGather(1, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_32c4e8(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_32c4e8(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_32c4e8(); +} diff --git a/test/tint/builtins/gen/var/textureGather/32c4e8.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/32c4e8.wgsl.expected.glsl new file mode 100644 index 0000000000..aa2ae8009b --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/32c4e8.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +uniform highp samplerCube arg_1_arg_2; + +void textureGather_32c4e8() { + vec3 arg_3 = vec3(0.0f); + vec4 res = textureGather(arg_1_arg_2, arg_3, 1); +} + +vec4 vertex_main() { + textureGather_32c4e8(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp samplerCube arg_1_arg_2; + +void textureGather_32c4e8() { + vec3 arg_3 = vec3(0.0f); + vec4 res = textureGather(arg_1_arg_2, arg_3, 1); +} + +void fragment_main() { + textureGather_32c4e8(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp samplerCube arg_1_arg_2; + +void textureGather_32c4e8() { + vec3 arg_3 = vec3(0.0f); + vec4 res = textureGather(arg_1_arg_2, arg_3, 1); +} + +void compute_main() { + textureGather_32c4e8(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/32c4e8.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureGather/32c4e8.wgsl.expected.hlsl new file mode 100644 index 0000000000..6843bb16f9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/32c4e8.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +TextureCube arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_32c4e8() { + float3 arg_3 = (0.0f).xxx; + float4 res = arg_1.GatherGreen(arg_2, arg_3); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_32c4e8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_32c4e8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_32c4e8(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/32c4e8.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/32c4e8.wgsl.expected.msl new file mode 100644 index 0000000000..6bcc6d7fd3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/32c4e8.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void textureGather_32c4e8(texturecube tint_symbol_1, sampler tint_symbol_2) { + float3 arg_3 = float3(0.0f); + float4 res = tint_symbol_1.gather(tint_symbol_2, arg_3, component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube tint_symbol_3, sampler tint_symbol_4) { + textureGather_32c4e8(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_32c4e8(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texturecube tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_32c4e8(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureGather/32c4e8.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/32c4e8.wgsl.expected.spvasm new file mode 100644 index 0000000000..af17d8105b --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/32c4e8.wgsl.expected.spvasm @@ -0,0 +1,89 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_32c4e8 "textureGather_32c4e8" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float Cube 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_2 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %20 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %26 = OpTypeSampledImage %11 + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %33 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_32c4e8 = OpFunction %void None %15 + %18 = OpLabel + %arg_3 = OpVariable %_ptr_Function_v3float Function %20 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_3 %20 + %24 = OpLoad %14 %arg_2 + %25 = OpLoad %11 %arg_1 + %27 = OpSampledImage %26 %25 %24 + %28 = OpLoad %v3float %arg_3 + %23 = OpImageGather %v4float %27 %28 %int_1 + OpStore %res %23 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %33 + %35 = OpLabel + %36 = OpFunctionCall %void %textureGather_32c4e8 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %38 = OpLabel + %39 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %39 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %42 = OpLabel + %43 = OpFunctionCall %void %textureGather_32c4e8 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %45 = OpLabel + %46 = OpFunctionCall %void %textureGather_32c4e8 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureGather/32c4e8.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/32c4e8.wgsl.expected.wgsl new file mode 100644 index 0000000000..257838472a --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/32c4e8.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +@group(1) @binding(1) var arg_1 : texture_cube; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_32c4e8() { + var arg_3 = vec3(); + var res : vec4 = textureGather(1, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_32c4e8(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_32c4e8(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_32c4e8(); +} diff --git a/test/tint/builtins/gen/var/textureGather/3b32cc.wgsl b/test/tint/builtins/gen/var/textureGather/3b32cc.wgsl new file mode 100644 index 0000000000..361b66f62d --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/3b32cc.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_cube; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_cube, sampler: sampler, coords: vec3) -> vec4 +fn textureGather_3b32cc() { + var arg_3 = vec3(); + var res: vec4 = textureGather(1, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_3b32cc(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_3b32cc(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_3b32cc(); +} diff --git a/test/tint/builtins/gen/var/textureGather/3b32cc.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/3b32cc.wgsl.expected.glsl new file mode 100644 index 0000000000..12cba16237 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/3b32cc.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +uniform highp usamplerCube arg_1_arg_2; + +void textureGather_3b32cc() { + vec3 arg_3 = vec3(0.0f); + uvec4 res = textureGather(arg_1_arg_2, arg_3, 1); +} + +vec4 vertex_main() { + textureGather_3b32cc(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp usamplerCube arg_1_arg_2; + +void textureGather_3b32cc() { + vec3 arg_3 = vec3(0.0f); + uvec4 res = textureGather(arg_1_arg_2, arg_3, 1); +} + +void fragment_main() { + textureGather_3b32cc(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp usamplerCube arg_1_arg_2; + +void textureGather_3b32cc() { + vec3 arg_3 = vec3(0.0f); + uvec4 res = textureGather(arg_1_arg_2, arg_3, 1); +} + +void compute_main() { + textureGather_3b32cc(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/3b32cc.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureGather/3b32cc.wgsl.expected.hlsl new file mode 100644 index 0000000000..2845979813 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/3b32cc.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +TextureCube arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_3b32cc() { + float3 arg_3 = (0.0f).xxx; + uint4 res = arg_1.GatherGreen(arg_2, arg_3); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_3b32cc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_3b32cc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_3b32cc(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/3b32cc.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/3b32cc.wgsl.expected.msl new file mode 100644 index 0000000000..f1dfbe57b2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/3b32cc.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void textureGather_3b32cc(texturecube tint_symbol_1, sampler tint_symbol_2) { + float3 arg_3 = float3(0.0f); + uint4 res = tint_symbol_1.gather(tint_symbol_2, arg_3, component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube tint_symbol_3, sampler tint_symbol_4) { + textureGather_3b32cc(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_3b32cc(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texturecube tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_3b32cc(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureGather/3b32cc.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/3b32cc.wgsl.expected.spvasm new file mode 100644 index 0000000000..2a2979191f --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/3b32cc.wgsl.expected.spvasm @@ -0,0 +1,92 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 50 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_3b32cc "textureGather_3b32cc" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint Cube 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %15 = OpTypeSampler +%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 + %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant + %void = OpTypeVoid + %16 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %21 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %v4uint = OpTypeVector %uint 4 + %28 = OpTypeSampledImage %11 + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %35 = OpConstantNull %v4uint + %36 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_3b32cc = OpFunction %void None %16 + %19 = OpLabel + %arg_3 = OpVariable %_ptr_Function_v3float Function %21 + %res = OpVariable %_ptr_Function_v4uint Function %35 + OpStore %arg_3 %21 + %26 = OpLoad %15 %arg_2 + %27 = OpLoad %11 %arg_1 + %29 = OpSampledImage %28 %27 %26 + %30 = OpLoad %v3float %arg_3 + %24 = OpImageGather %v4uint %29 %30 %int_1 + OpStore %res %24 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %36 + %38 = OpLabel + %39 = OpFunctionCall %void %textureGather_3b32cc + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %16 + %41 = OpLabel + %42 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %42 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %16 + %45 = OpLabel + %46 = OpFunctionCall %void %textureGather_3b32cc + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %16 + %48 = OpLabel + %49 = OpFunctionCall %void %textureGather_3b32cc + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureGather/3b32cc.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/3b32cc.wgsl.expected.wgsl new file mode 100644 index 0000000000..769f417c33 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/3b32cc.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +@group(1) @binding(1) var arg_1 : texture_cube; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_3b32cc() { + var arg_3 = vec3(); + var res : vec4 = textureGather(1, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_3b32cc(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_3b32cc(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_3b32cc(); +} diff --git a/test/tint/builtins/gen/var/textureGather/43025d.wgsl b/test/tint/builtins/gen/var/textureGather/43025d.wgsl new file mode 100644 index 0000000000..f17e27514c --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/43025d.wgsl @@ -0,0 +1,49 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_cube_array; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureGather(texture: texture_depth_cube_array, sampler: sampler, coords: vec3, array_index: i32) -> vec4 +fn textureGather_43025d() { + var arg_2 = vec3(); + var arg_3 = 1; + var res: vec4 = textureGather(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_43025d(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_43025d(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_43025d(); +} diff --git a/test/tint/builtins/gen/var/textureGather/43025d.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/43025d.wgsl.expected.glsl new file mode 100644 index 0000000000..864a150164 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/43025d.wgsl.expected.glsl @@ -0,0 +1,84 @@ +SKIP: FAILED + +#version 310 es + +uniform highp samplerCubeArrayShadow arg_0_arg_1; + +void textureGather_43025d() { + vec3 arg_2 = vec3(0.0f); + int arg_3 = 1; + vec4 res = textureGather(arg_0_arg_1, vec4(arg_2, float(arg_3)), 0.0); +} + +vec4 vertex_main() { + textureGather_43025d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArrayShadow' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp samplerCubeArrayShadow arg_0_arg_1; + +void textureGather_43025d() { + vec3 arg_2 = vec3(0.0f); + int arg_3 = 1; + vec4 res = textureGather(arg_0_arg_1, vec4(arg_2, float(arg_3)), 0.0); +} + +void fragment_main() { + textureGather_43025d(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'samplerCubeArrayShadow' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp samplerCubeArrayShadow arg_0_arg_1; + +void textureGather_43025d() { + vec3 arg_2 = vec3(0.0f); + int arg_3 = 1; + vec4 res = textureGather(arg_0_arg_1, vec4(arg_2, float(arg_3)), 0.0); +} + +void compute_main() { + textureGather_43025d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArrayShadow' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureGather/43025d.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureGather/43025d.wgsl.expected.hlsl new file mode 100644 index 0000000000..95e40237e6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/43025d.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +TextureCubeArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureGather_43025d() { + float3 arg_2 = (0.0f).xxx; + int arg_3 = 1; + float4 res = arg_0.Gather(arg_1, float4(arg_2, float(arg_3))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_43025d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_43025d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_43025d(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/43025d.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/43025d.wgsl.expected.msl new file mode 100644 index 0000000000..ed0f44ae9e --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/43025d.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureGather_43025d(depthcube_array tint_symbol_1, sampler tint_symbol_2) { + float3 arg_2 = float3(0.0f); + int arg_3 = 1; + float4 res = tint_symbol_1.gather(tint_symbol_2, arg_2, arg_3); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depthcube_array tint_symbol_3, sampler tint_symbol_4) { + textureGather_43025d(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depthcube_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depthcube_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_43025d(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depthcube_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_43025d(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureGather/43025d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/43025d.wgsl.expected.spvasm new file mode 100644 index 0000000000..50439ce0bb --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/43025d.wgsl.expected.spvasm @@ -0,0 +1,102 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 57 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureGather_43025d "textureGather_43025d" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %20 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %27 = OpConstantNull %int + %31 = OpTypeSampledImage %11 + %int_0 = OpConstant %int 0 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %43 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_43025d = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v3float Function %20 + %arg_3 = OpVariable %_ptr_Function_int Function %27 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_2 %20 + OpStore %arg_3 %int_1 + %29 = OpLoad %14 %arg_1 + %30 = OpLoad %11 %arg_0 + %32 = OpSampledImage %31 %30 %29 + %33 = OpLoad %v3float %arg_2 + %34 = OpCompositeExtract %float %33 0 + %35 = OpCompositeExtract %float %33 1 + %36 = OpCompositeExtract %float %33 2 + %38 = OpLoad %int %arg_3 + %37 = OpConvertSToF %float %38 + %39 = OpCompositeConstruct %v4float %34 %35 %36 %37 + %28 = OpImageGather %v4float %32 %39 %int_0 + OpStore %res %28 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %43 + %45 = OpLabel + %46 = OpFunctionCall %void %textureGather_43025d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %48 = OpLabel + %49 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %49 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %52 = OpLabel + %53 = OpFunctionCall %void %textureGather_43025d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %55 = OpLabel + %56 = OpFunctionCall %void %textureGather_43025d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureGather/43025d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/43025d.wgsl.expected.wgsl new file mode 100644 index 0000000000..4abc4a15f7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/43025d.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +@group(1) @binding(0) var arg_0 : texture_depth_cube_array; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureGather_43025d() { + var arg_2 = vec3(); + var arg_3 = 1; + var res : vec4 = textureGather(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_43025d(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_43025d(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_43025d(); +} diff --git a/test/tint/builtins/gen/var/textureGather/49b07f.wgsl b/test/tint/builtins/gen/var/textureGather/49b07f.wgsl new file mode 100644 index 0000000000..b72043a563 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/49b07f.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_2d; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_2d, sampler: sampler, coords: vec2, @const offset: vec2) -> vec4 +fn textureGather_49b07f() { + var arg_3 = vec2(); + var res: vec4 = textureGather(1, arg_1, arg_2, arg_3, vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_49b07f(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_49b07f(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_49b07f(); +} diff --git a/test/tint/builtins/gen/var/textureGather/49b07f.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/49b07f.wgsl.expected.glsl new file mode 100644 index 0000000000..e576f45ad9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/49b07f.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +uniform highp usampler2D arg_1_arg_2; + +void textureGather_49b07f() { + vec2 arg_3 = vec2(0.0f); + uvec4 res = textureGatherOffset(arg_1_arg_2, arg_3, ivec2(0), 1); +} + +vec4 vertex_main() { + textureGather_49b07f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp usampler2D arg_1_arg_2; + +void textureGather_49b07f() { + vec2 arg_3 = vec2(0.0f); + uvec4 res = textureGatherOffset(arg_1_arg_2, arg_3, ivec2(0), 1); +} + +void fragment_main() { + textureGather_49b07f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp usampler2D arg_1_arg_2; + +void textureGather_49b07f() { + vec2 arg_3 = vec2(0.0f); + uvec4 res = textureGatherOffset(arg_1_arg_2, arg_3, ivec2(0), 1); +} + +void compute_main() { + textureGather_49b07f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/49b07f.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureGather/49b07f.wgsl.expected.hlsl new file mode 100644 index 0000000000..42046f3c0d --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/49b07f.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_49b07f() { + float2 arg_3 = (0.0f).xx; + uint4 res = arg_1.GatherGreen(arg_2, arg_3, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_49b07f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_49b07f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_49b07f(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/49b07f.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/49b07f.wgsl.expected.msl new file mode 100644 index 0000000000..b83245ec2f --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/49b07f.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void textureGather_49b07f(texture2d tint_symbol_1, sampler tint_symbol_2) { + float2 arg_3 = float2(0.0f); + uint4 res = tint_symbol_1.gather(tint_symbol_2, arg_3, int2(0), component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_3, sampler tint_symbol_4) { + textureGather_49b07f(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_49b07f(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_49b07f(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureGather/49b07f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/49b07f.wgsl.expected.spvasm new file mode 100644 index 0000000000..bc3d0f9ce2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/49b07f.wgsl.expected.spvasm @@ -0,0 +1,94 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 52 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_49b07f "textureGather_49b07f" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %15 = OpTypeSampler +%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 + %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant + %void = OpTypeVoid + %16 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %21 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %v4uint = OpTypeVector %uint 4 + %28 = OpTypeSampledImage %11 + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %v2int = OpTypeVector %int 2 + %34 = OpConstantNull %v2int +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %37 = OpConstantNull %v4uint + %38 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_49b07f = OpFunction %void None %16 + %19 = OpLabel + %arg_3 = OpVariable %_ptr_Function_v2float Function %21 + %res = OpVariable %_ptr_Function_v4uint Function %37 + OpStore %arg_3 %21 + %26 = OpLoad %15 %arg_2 + %27 = OpLoad %11 %arg_1 + %29 = OpSampledImage %28 %27 %26 + %30 = OpLoad %v2float %arg_3 + %24 = OpImageGather %v4uint %29 %30 %int_1 ConstOffset %34 + OpStore %res %24 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %38 + %40 = OpLabel + %41 = OpFunctionCall %void %textureGather_49b07f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %16 + %43 = OpLabel + %44 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %44 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %16 + %47 = OpLabel + %48 = OpFunctionCall %void %textureGather_49b07f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %16 + %50 = OpLabel + %51 = OpFunctionCall %void %textureGather_49b07f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureGather/49b07f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/49b07f.wgsl.expected.wgsl new file mode 100644 index 0000000000..7153c61424 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/49b07f.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +@group(1) @binding(1) var arg_1 : texture_2d; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_49b07f() { + var arg_3 = vec2(); + var res : vec4 = textureGather(1, arg_1, arg_2, arg_3, vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_49b07f(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_49b07f(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_49b07f(); +} diff --git a/test/tint/builtins/gen/var/textureGather/4b8103.wgsl b/test/tint/builtins/gen/var/textureGather/4b8103.wgsl new file mode 100644 index 0000000000..8cd2108a15 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/4b8103.wgsl @@ -0,0 +1,49 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_2d_array; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, @const offset: vec2) -> vec4 +fn textureGather_4b8103() { + var arg_3 = vec2(); + var arg_4 = 1; + var res: vec4 = textureGather(1, arg_1, arg_2, arg_3, arg_4, vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_4b8103(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_4b8103(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_4b8103(); +} diff --git a/test/tint/builtins/gen/var/textureGather/4b8103.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/4b8103.wgsl.expected.glsl new file mode 100644 index 0000000000..186aab25b4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/4b8103.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +uniform highp sampler2DArray arg_1_arg_2; + +void textureGather_4b8103() { + vec2 arg_3 = vec2(0.0f); + int arg_4 = 1; + vec4 res = textureGatherOffset(arg_1_arg_2, vec3(arg_3, float(arg_4)), ivec2(0), 1); +} + +vec4 vertex_main() { + textureGather_4b8103(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DArray arg_1_arg_2; + +void textureGather_4b8103() { + vec2 arg_3 = vec2(0.0f); + int arg_4 = 1; + vec4 res = textureGatherOffset(arg_1_arg_2, vec3(arg_3, float(arg_4)), ivec2(0), 1); +} + +void fragment_main() { + textureGather_4b8103(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DArray arg_1_arg_2; + +void textureGather_4b8103() { + vec2 arg_3 = vec2(0.0f); + int arg_4 = 1; + vec4 res = textureGatherOffset(arg_1_arg_2, vec3(arg_3, float(arg_4)), ivec2(0), 1); +} + +void compute_main() { + textureGather_4b8103(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/4b8103.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureGather/4b8103.wgsl.expected.hlsl new file mode 100644 index 0000000000..5016110b55 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/4b8103.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +Texture2DArray arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_4b8103() { + float2 arg_3 = (0.0f).xx; + int arg_4 = 1; + float4 res = arg_1.GatherGreen(arg_2, float3(arg_3, float(arg_4)), (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_4b8103(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_4b8103(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_4b8103(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/4b8103.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/4b8103.wgsl.expected.msl new file mode 100644 index 0000000000..2c3b8cd343 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/4b8103.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureGather_4b8103(texture2d_array tint_symbol_1, sampler tint_symbol_2) { + float2 arg_3 = float2(0.0f); + int arg_4 = 1; + float4 res = tint_symbol_1.gather(tint_symbol_2, arg_3, arg_4, int2(0), component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_3, sampler tint_symbol_4) { + textureGather_4b8103(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_4b8103(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_4b8103(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureGather/4b8103.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/4b8103.wgsl.expected.spvasm new file mode 100644 index 0000000000..6b14a0827e --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/4b8103.wgsl.expected.spvasm @@ -0,0 +1,102 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 58 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_4b8103 "textureGather_4b8103" + OpName %arg_3 "arg_3" + OpName %arg_4 "arg_4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_2 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %20 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %27 = OpConstantNull %int + %31 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 + %v2int = OpTypeVector %int 2 + %41 = OpConstantNull %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %44 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_4b8103 = OpFunction %void None %15 + %18 = OpLabel + %arg_3 = OpVariable %_ptr_Function_v2float Function %20 + %arg_4 = OpVariable %_ptr_Function_int Function %27 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_3 %20 + OpStore %arg_4 %int_1 + %29 = OpLoad %14 %arg_2 + %30 = OpLoad %11 %arg_1 + %32 = OpSampledImage %31 %30 %29 + %34 = OpLoad %v2float %arg_3 + %35 = OpCompositeExtract %float %34 0 + %36 = OpCompositeExtract %float %34 1 + %38 = OpLoad %int %arg_4 + %37 = OpConvertSToF %float %38 + %39 = OpCompositeConstruct %v3float %35 %36 %37 + %28 = OpImageGather %v4float %32 %39 %int_1 ConstOffset %41 + OpStore %res %28 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %44 + %46 = OpLabel + %47 = OpFunctionCall %void %textureGather_4b8103 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %49 = OpLabel + %50 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %50 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %53 = OpLabel + %54 = OpFunctionCall %void %textureGather_4b8103 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %56 = OpLabel + %57 = OpFunctionCall %void %textureGather_4b8103 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureGather/4b8103.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/4b8103.wgsl.expected.wgsl new file mode 100644 index 0000000000..1fa629ee20 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/4b8103.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +@group(1) @binding(1) var arg_1 : texture_2d_array; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_4b8103() { + var arg_3 = vec2(); + var arg_4 = 1; + var res : vec4 = textureGather(1, arg_1, arg_2, arg_3, arg_4, vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_4b8103(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_4b8103(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_4b8103(); +} diff --git a/test/tint/builtins/gen/var/textureGather/5266da.wgsl b/test/tint/builtins/gen/var/textureGather/5266da.wgsl new file mode 100644 index 0000000000..3514a736df --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/5266da.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_2d; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_2d, sampler: sampler, coords: vec2) -> vec4 +fn textureGather_5266da() { + var arg_3 = vec2(); + var res: vec4 = textureGather(1, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_5266da(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_5266da(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_5266da(); +} diff --git a/test/tint/builtins/gen/var/textureGather/5266da.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/5266da.wgsl.expected.glsl new file mode 100644 index 0000000000..33c4c0ff6f --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/5266da.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +uniform highp sampler2D arg_1_arg_2; + +void textureGather_5266da() { + vec2 arg_3 = vec2(0.0f); + vec4 res = textureGather(arg_1_arg_2, arg_3, 1); +} + +vec4 vertex_main() { + textureGather_5266da(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2D arg_1_arg_2; + +void textureGather_5266da() { + vec2 arg_3 = vec2(0.0f); + vec4 res = textureGather(arg_1_arg_2, arg_3, 1); +} + +void fragment_main() { + textureGather_5266da(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2D arg_1_arg_2; + +void textureGather_5266da() { + vec2 arg_3 = vec2(0.0f); + vec4 res = textureGather(arg_1_arg_2, arg_3, 1); +} + +void compute_main() { + textureGather_5266da(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/5266da.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureGather/5266da.wgsl.expected.hlsl new file mode 100644 index 0000000000..f449a19774 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/5266da.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_5266da() { + float2 arg_3 = (0.0f).xx; + float4 res = arg_1.GatherGreen(arg_2, arg_3); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_5266da(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_5266da(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_5266da(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/5266da.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/5266da.wgsl.expected.msl new file mode 100644 index 0000000000..09bd3bbd5e --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/5266da.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void textureGather_5266da(texture2d tint_symbol_1, sampler tint_symbol_2) { + float2 arg_3 = float2(0.0f); + float4 res = tint_symbol_1.gather(tint_symbol_2, arg_3, int2(0), component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_3, sampler tint_symbol_4) { + textureGather_5266da(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_5266da(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_5266da(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureGather/5266da.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/5266da.wgsl.expected.spvasm new file mode 100644 index 0000000000..b1bb4b9e89 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/5266da.wgsl.expected.spvasm @@ -0,0 +1,89 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_5266da "textureGather_5266da" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_2 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %20 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %26 = OpTypeSampledImage %11 + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %33 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_5266da = OpFunction %void None %15 + %18 = OpLabel + %arg_3 = OpVariable %_ptr_Function_v2float Function %20 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_3 %20 + %24 = OpLoad %14 %arg_2 + %25 = OpLoad %11 %arg_1 + %27 = OpSampledImage %26 %25 %24 + %28 = OpLoad %v2float %arg_3 + %23 = OpImageGather %v4float %27 %28 %int_1 + OpStore %res %23 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %33 + %35 = OpLabel + %36 = OpFunctionCall %void %textureGather_5266da + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %38 = OpLabel + %39 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %39 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %42 = OpLabel + %43 = OpFunctionCall %void %textureGather_5266da + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %45 = OpLabel + %46 = OpFunctionCall %void %textureGather_5266da + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureGather/5266da.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/5266da.wgsl.expected.wgsl new file mode 100644 index 0000000000..cca1739cb2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/5266da.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +@group(1) @binding(1) var arg_1 : texture_2d; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_5266da() { + var arg_3 = vec2(); + var res : vec4 = textureGather(1, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_5266da(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_5266da(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_5266da(); +} diff --git a/test/tint/builtins/gen/var/textureGather/5ba85f.wgsl b/test/tint/builtins/gen/var/textureGather/5ba85f.wgsl new file mode 100644 index 0000000000..bbf18dd931 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/5ba85f.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_cube; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_cube, sampler: sampler, coords: vec3) -> vec4 +fn textureGather_5ba85f() { + var arg_3 = vec3(); + var res: vec4 = textureGather(1, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_5ba85f(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_5ba85f(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_5ba85f(); +} diff --git a/test/tint/builtins/gen/var/textureGather/5ba85f.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/5ba85f.wgsl.expected.glsl new file mode 100644 index 0000000000..096f596b49 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/5ba85f.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +uniform highp isamplerCube arg_1_arg_2; + +void textureGather_5ba85f() { + vec3 arg_3 = vec3(0.0f); + ivec4 res = textureGather(arg_1_arg_2, arg_3, 1); +} + +vec4 vertex_main() { + textureGather_5ba85f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp isamplerCube arg_1_arg_2; + +void textureGather_5ba85f() { + vec3 arg_3 = vec3(0.0f); + ivec4 res = textureGather(arg_1_arg_2, arg_3, 1); +} + +void fragment_main() { + textureGather_5ba85f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp isamplerCube arg_1_arg_2; + +void textureGather_5ba85f() { + vec3 arg_3 = vec3(0.0f); + ivec4 res = textureGather(arg_1_arg_2, arg_3, 1); +} + +void compute_main() { + textureGather_5ba85f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/5ba85f.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureGather/5ba85f.wgsl.expected.hlsl new file mode 100644 index 0000000000..39a0d15a2e --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/5ba85f.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +TextureCube arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_5ba85f() { + float3 arg_3 = (0.0f).xxx; + int4 res = arg_1.GatherGreen(arg_2, arg_3); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_5ba85f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_5ba85f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_5ba85f(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/5ba85f.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/5ba85f.wgsl.expected.msl new file mode 100644 index 0000000000..23a45a4670 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/5ba85f.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void textureGather_5ba85f(texturecube tint_symbol_1, sampler tint_symbol_2) { + float3 arg_3 = float3(0.0f); + int4 res = tint_symbol_1.gather(tint_symbol_2, arg_3, component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube tint_symbol_3, sampler tint_symbol_4) { + textureGather_5ba85f(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_5ba85f(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texturecube tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_5ba85f(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureGather/5ba85f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/5ba85f.wgsl.expected.spvasm new file mode 100644 index 0000000000..30b40eb280 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/5ba85f.wgsl.expected.spvasm @@ -0,0 +1,91 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 49 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_5ba85f "textureGather_5ba85f" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int Cube 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %15 = OpTypeSampler +%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 + %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant + %void = OpTypeVoid + %16 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %21 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %v4int = OpTypeVector %int 4 + %28 = OpTypeSampledImage %11 + %int_1 = OpConstant %int 1 +%_ptr_Function_v4int = OpTypePointer Function %v4int + %34 = OpConstantNull %v4int + %35 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_5ba85f = OpFunction %void None %16 + %19 = OpLabel + %arg_3 = OpVariable %_ptr_Function_v3float Function %21 + %res = OpVariable %_ptr_Function_v4int Function %34 + OpStore %arg_3 %21 + %26 = OpLoad %15 %arg_2 + %27 = OpLoad %11 %arg_1 + %29 = OpSampledImage %28 %27 %26 + %30 = OpLoad %v3float %arg_3 + %24 = OpImageGather %v4int %29 %30 %int_1 + OpStore %res %24 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %35 + %37 = OpLabel + %38 = OpFunctionCall %void %textureGather_5ba85f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %16 + %40 = OpLabel + %41 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %41 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %16 + %44 = OpLabel + %45 = OpFunctionCall %void %textureGather_5ba85f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %16 + %47 = OpLabel + %48 = OpFunctionCall %void %textureGather_5ba85f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureGather/5ba85f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/5ba85f.wgsl.expected.wgsl new file mode 100644 index 0000000000..bc8269afa7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/5ba85f.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +@group(1) @binding(1) var arg_1 : texture_cube; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_5ba85f() { + var arg_3 = vec3(); + var res : vec4 = textureGather(1, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_5ba85f(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_5ba85f(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_5ba85f(); +} diff --git a/test/tint/builtins/gen/var/textureGather/5bd491.wgsl b/test/tint/builtins/gen/var/textureGather/5bd491.wgsl new file mode 100644 index 0000000000..13d3c92aa4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/5bd491.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_2d; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_2d, sampler: sampler, coords: vec2) -> vec4 +fn textureGather_5bd491() { + var arg_3 = vec2(); + var res: vec4 = textureGather(1, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_5bd491(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_5bd491(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_5bd491(); +} diff --git a/test/tint/builtins/gen/var/textureGather/5bd491.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/5bd491.wgsl.expected.glsl new file mode 100644 index 0000000000..1cb6b09ae3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/5bd491.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +uniform highp usampler2D arg_1_arg_2; + +void textureGather_5bd491() { + vec2 arg_3 = vec2(0.0f); + uvec4 res = textureGather(arg_1_arg_2, arg_3, 1); +} + +vec4 vertex_main() { + textureGather_5bd491(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp usampler2D arg_1_arg_2; + +void textureGather_5bd491() { + vec2 arg_3 = vec2(0.0f); + uvec4 res = textureGather(arg_1_arg_2, arg_3, 1); +} + +void fragment_main() { + textureGather_5bd491(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp usampler2D arg_1_arg_2; + +void textureGather_5bd491() { + vec2 arg_3 = vec2(0.0f); + uvec4 res = textureGather(arg_1_arg_2, arg_3, 1); +} + +void compute_main() { + textureGather_5bd491(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/5bd491.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureGather/5bd491.wgsl.expected.hlsl new file mode 100644 index 0000000000..50701a2fdf --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/5bd491.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_5bd491() { + float2 arg_3 = (0.0f).xx; + uint4 res = arg_1.GatherGreen(arg_2, arg_3); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_5bd491(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_5bd491(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_5bd491(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/5bd491.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/5bd491.wgsl.expected.msl new file mode 100644 index 0000000000..22227a8497 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/5bd491.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void textureGather_5bd491(texture2d tint_symbol_1, sampler tint_symbol_2) { + float2 arg_3 = float2(0.0f); + uint4 res = tint_symbol_1.gather(tint_symbol_2, arg_3, int2(0), component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_3, sampler tint_symbol_4) { + textureGather_5bd491(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_5bd491(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_5bd491(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureGather/5bd491.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/5bd491.wgsl.expected.spvasm new file mode 100644 index 0000000000..601e9883a3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/5bd491.wgsl.expected.spvasm @@ -0,0 +1,92 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 50 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_5bd491 "textureGather_5bd491" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %15 = OpTypeSampler +%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 + %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant + %void = OpTypeVoid + %16 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %21 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %v4uint = OpTypeVector %uint 4 + %28 = OpTypeSampledImage %11 + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %35 = OpConstantNull %v4uint + %36 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_5bd491 = OpFunction %void None %16 + %19 = OpLabel + %arg_3 = OpVariable %_ptr_Function_v2float Function %21 + %res = OpVariable %_ptr_Function_v4uint Function %35 + OpStore %arg_3 %21 + %26 = OpLoad %15 %arg_2 + %27 = OpLoad %11 %arg_1 + %29 = OpSampledImage %28 %27 %26 + %30 = OpLoad %v2float %arg_3 + %24 = OpImageGather %v4uint %29 %30 %int_1 + OpStore %res %24 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %36 + %38 = OpLabel + %39 = OpFunctionCall %void %textureGather_5bd491 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %16 + %41 = OpLabel + %42 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %42 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %16 + %45 = OpLabel + %46 = OpFunctionCall %void %textureGather_5bd491 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %16 + %48 = OpLabel + %49 = OpFunctionCall %void %textureGather_5bd491 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureGather/5bd491.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/5bd491.wgsl.expected.wgsl new file mode 100644 index 0000000000..7e8077e9ed --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/5bd491.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +@group(1) @binding(1) var arg_1 : texture_2d; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_5bd491() { + var arg_3 = vec2(); + var res : vec4 = textureGather(1, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_5bd491(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_5bd491(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_5bd491(); +} diff --git a/test/tint/builtins/gen/var/textureGather/751f8a.wgsl b/test/tint/builtins/gen/var/textureGather/751f8a.wgsl new file mode 100644 index 0000000000..4103e55809 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/751f8a.wgsl @@ -0,0 +1,49 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_cube_array; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_cube_array, sampler: sampler, coords: vec3, array_index: i32) -> vec4 +fn textureGather_751f8a() { + var arg_3 = vec3(); + var arg_4 = 1; + var res: vec4 = textureGather(1, arg_1, arg_2, arg_3, arg_4); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_751f8a(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_751f8a(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_751f8a(); +} diff --git a/test/tint/builtins/gen/var/textureGather/751f8a.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/751f8a.wgsl.expected.glsl new file mode 100644 index 0000000000..17c501c5d1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/751f8a.wgsl.expected.glsl @@ -0,0 +1,84 @@ +SKIP: FAILED + +#version 310 es + +uniform highp samplerCubeArray arg_1_arg_2; + +void textureGather_751f8a() { + vec3 arg_3 = vec3(0.0f); + int arg_4 = 1; + vec4 res = textureGather(arg_1_arg_2, vec4(arg_3, float(arg_4)), 1); +} + +vec4 vertex_main() { + textureGather_751f8a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp samplerCubeArray arg_1_arg_2; + +void textureGather_751f8a() { + vec3 arg_3 = vec3(0.0f); + int arg_4 = 1; + vec4 res = textureGather(arg_1_arg_2, vec4(arg_3, float(arg_4)), 1); +} + +void fragment_main() { + textureGather_751f8a(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'samplerCubeArray' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp samplerCubeArray arg_1_arg_2; + +void textureGather_751f8a() { + vec3 arg_3 = vec3(0.0f); + int arg_4 = 1; + vec4 res = textureGather(arg_1_arg_2, vec4(arg_3, float(arg_4)), 1); +} + +void compute_main() { + textureGather_751f8a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureGather/751f8a.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureGather/751f8a.wgsl.expected.hlsl new file mode 100644 index 0000000000..4b0055f8cf --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/751f8a.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +TextureCubeArray arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_751f8a() { + float3 arg_3 = (0.0f).xxx; + int arg_4 = 1; + float4 res = arg_1.GatherGreen(arg_2, float4(arg_3, float(arg_4))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_751f8a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_751f8a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_751f8a(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/751f8a.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/751f8a.wgsl.expected.msl new file mode 100644 index 0000000000..4b8c748f63 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/751f8a.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureGather_751f8a(texturecube_array tint_symbol_1, sampler tint_symbol_2) { + float3 arg_3 = float3(0.0f); + int arg_4 = 1; + float4 res = tint_symbol_1.gather(tint_symbol_2, arg_3, arg_4, component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube_array tint_symbol_3, sampler tint_symbol_4) { + textureGather_751f8a(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_751f8a(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texturecube_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_751f8a(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureGather/751f8a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/751f8a.wgsl.expected.spvasm new file mode 100644 index 0000000000..d65968a079 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/751f8a.wgsl.expected.spvasm @@ -0,0 +1,101 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 56 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_751f8a "textureGather_751f8a" + OpName %arg_3 "arg_3" + OpName %arg_4 "arg_4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_2 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %20 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %27 = OpConstantNull %int + %31 = OpTypeSampledImage %11 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %42 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_751f8a = OpFunction %void None %15 + %18 = OpLabel + %arg_3 = OpVariable %_ptr_Function_v3float Function %20 + %arg_4 = OpVariable %_ptr_Function_int Function %27 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_3 %20 + OpStore %arg_4 %int_1 + %29 = OpLoad %14 %arg_2 + %30 = OpLoad %11 %arg_1 + %32 = OpSampledImage %31 %30 %29 + %33 = OpLoad %v3float %arg_3 + %34 = OpCompositeExtract %float %33 0 + %35 = OpCompositeExtract %float %33 1 + %36 = OpCompositeExtract %float %33 2 + %38 = OpLoad %int %arg_4 + %37 = OpConvertSToF %float %38 + %39 = OpCompositeConstruct %v4float %34 %35 %36 %37 + %28 = OpImageGather %v4float %32 %39 %int_1 + OpStore %res %28 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %42 + %44 = OpLabel + %45 = OpFunctionCall %void %textureGather_751f8a + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %47 = OpLabel + %48 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %48 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %51 = OpLabel + %52 = OpFunctionCall %void %textureGather_751f8a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %54 = OpLabel + %55 = OpFunctionCall %void %textureGather_751f8a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureGather/751f8a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/751f8a.wgsl.expected.wgsl new file mode 100644 index 0000000000..81f901db8b --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/751f8a.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +@group(1) @binding(1) var arg_1 : texture_cube_array; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_751f8a() { + var arg_3 = vec3(); + var arg_4 = 1; + var res : vec4 = textureGather(1, arg_1, arg_2, arg_3, arg_4); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_751f8a(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_751f8a(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_751f8a(); +} diff --git a/test/tint/builtins/gen/var/textureGather/7c3828.wgsl b/test/tint/builtins/gen/var/textureGather/7c3828.wgsl new file mode 100644 index 0000000000..3ae2518401 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/7c3828.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_2d; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_2d, sampler: sampler, coords: vec2, @const offset: vec2) -> vec4 +fn textureGather_7c3828() { + var arg_3 = vec2(); + var res: vec4 = textureGather(1, arg_1, arg_2, arg_3, vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_7c3828(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_7c3828(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_7c3828(); +} diff --git a/test/tint/builtins/gen/var/textureGather/7c3828.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/7c3828.wgsl.expected.glsl new file mode 100644 index 0000000000..862ebb491b --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/7c3828.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +uniform highp isampler2D arg_1_arg_2; + +void textureGather_7c3828() { + vec2 arg_3 = vec2(0.0f); + ivec4 res = textureGatherOffset(arg_1_arg_2, arg_3, ivec2(0), 1); +} + +vec4 vertex_main() { + textureGather_7c3828(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp isampler2D arg_1_arg_2; + +void textureGather_7c3828() { + vec2 arg_3 = vec2(0.0f); + ivec4 res = textureGatherOffset(arg_1_arg_2, arg_3, ivec2(0), 1); +} + +void fragment_main() { + textureGather_7c3828(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp isampler2D arg_1_arg_2; + +void textureGather_7c3828() { + vec2 arg_3 = vec2(0.0f); + ivec4 res = textureGatherOffset(arg_1_arg_2, arg_3, ivec2(0), 1); +} + +void compute_main() { + textureGather_7c3828(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/7c3828.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureGather/7c3828.wgsl.expected.hlsl new file mode 100644 index 0000000000..af880b4c3c --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/7c3828.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_7c3828() { + float2 arg_3 = (0.0f).xx; + int4 res = arg_1.GatherGreen(arg_2, arg_3, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_7c3828(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_7c3828(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_7c3828(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/7c3828.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/7c3828.wgsl.expected.msl new file mode 100644 index 0000000000..9772d44d29 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/7c3828.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void textureGather_7c3828(texture2d tint_symbol_1, sampler tint_symbol_2) { + float2 arg_3 = float2(0.0f); + int4 res = tint_symbol_1.gather(tint_symbol_2, arg_3, int2(0), component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_3, sampler tint_symbol_4) { + textureGather_7c3828(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_7c3828(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_7c3828(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureGather/7c3828.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/7c3828.wgsl.expected.spvasm new file mode 100644 index 0000000000..18f210e0db --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/7c3828.wgsl.expected.spvasm @@ -0,0 +1,93 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 51 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_7c3828 "textureGather_7c3828" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %15 = OpTypeSampler +%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 + %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant + %void = OpTypeVoid + %16 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %21 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %v4int = OpTypeVector %int 4 + %28 = OpTypeSampledImage %11 + %int_1 = OpConstant %int 1 + %v2int = OpTypeVector %int 2 + %33 = OpConstantNull %v2int +%_ptr_Function_v4int = OpTypePointer Function %v4int + %36 = OpConstantNull %v4int + %37 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_7c3828 = OpFunction %void None %16 + %19 = OpLabel + %arg_3 = OpVariable %_ptr_Function_v2float Function %21 + %res = OpVariable %_ptr_Function_v4int Function %36 + OpStore %arg_3 %21 + %26 = OpLoad %15 %arg_2 + %27 = OpLoad %11 %arg_1 + %29 = OpSampledImage %28 %27 %26 + %30 = OpLoad %v2float %arg_3 + %24 = OpImageGather %v4int %29 %30 %int_1 ConstOffset %33 + OpStore %res %24 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %37 + %39 = OpLabel + %40 = OpFunctionCall %void %textureGather_7c3828 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %16 + %42 = OpLabel + %43 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %43 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %16 + %46 = OpLabel + %47 = OpFunctionCall %void %textureGather_7c3828 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %16 + %49 = OpLabel + %50 = OpFunctionCall %void %textureGather_7c3828 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureGather/7c3828.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/7c3828.wgsl.expected.wgsl new file mode 100644 index 0000000000..701c035da6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/7c3828.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +@group(1) @binding(1) var arg_1 : texture_2d; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_7c3828() { + var arg_3 = vec2(); + var res : vec4 = textureGather(1, arg_1, arg_2, arg_3, vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_7c3828(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_7c3828(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_7c3828(); +} diff --git a/test/tint/builtins/gen/var/textureGather/8b754c.wgsl b/test/tint/builtins/gen/var/textureGather/8b754c.wgsl new file mode 100644 index 0000000000..155ef01431 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/8b754c.wgsl @@ -0,0 +1,49 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_2d_array; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32) -> vec4 +fn textureGather_8b754c() { + var arg_3 = vec2(); + var arg_4 = 1; + var res: vec4 = textureGather(1, arg_1, arg_2, arg_3, arg_4); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_8b754c(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_8b754c(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_8b754c(); +} diff --git a/test/tint/builtins/gen/var/textureGather/8b754c.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/8b754c.wgsl.expected.glsl new file mode 100644 index 0000000000..b7a690a28e --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/8b754c.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +uniform highp isampler2DArray arg_1_arg_2; + +void textureGather_8b754c() { + vec2 arg_3 = vec2(0.0f); + int arg_4 = 1; + ivec4 res = textureGather(arg_1_arg_2, vec3(arg_3, float(arg_4)), 1); +} + +vec4 vertex_main() { + textureGather_8b754c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp isampler2DArray arg_1_arg_2; + +void textureGather_8b754c() { + vec2 arg_3 = vec2(0.0f); + int arg_4 = 1; + ivec4 res = textureGather(arg_1_arg_2, vec3(arg_3, float(arg_4)), 1); +} + +void fragment_main() { + textureGather_8b754c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp isampler2DArray arg_1_arg_2; + +void textureGather_8b754c() { + vec2 arg_3 = vec2(0.0f); + int arg_4 = 1; + ivec4 res = textureGather(arg_1_arg_2, vec3(arg_3, float(arg_4)), 1); +} + +void compute_main() { + textureGather_8b754c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/8b754c.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureGather/8b754c.wgsl.expected.hlsl new file mode 100644 index 0000000000..52dcf0fa89 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/8b754c.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +Texture2DArray arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_8b754c() { + float2 arg_3 = (0.0f).xx; + int arg_4 = 1; + int4 res = arg_1.GatherGreen(arg_2, float3(arg_3, float(arg_4))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_8b754c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_8b754c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_8b754c(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/8b754c.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/8b754c.wgsl.expected.msl new file mode 100644 index 0000000000..171f733930 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/8b754c.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureGather_8b754c(texture2d_array tint_symbol_1, sampler tint_symbol_2) { + float2 arg_3 = float2(0.0f); + int arg_4 = 1; + int4 res = tint_symbol_1.gather(tint_symbol_2, arg_3, arg_4, int2(0), component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_3, sampler tint_symbol_4) { + textureGather_8b754c(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_8b754c(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_8b754c(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureGather/8b754c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/8b754c.wgsl.expected.spvasm new file mode 100644 index 0000000000..09b943b8b0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/8b754c.wgsl.expected.spvasm @@ -0,0 +1,102 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 58 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_8b754c "textureGather_8b754c" + OpName %arg_3 "arg_3" + OpName %arg_4 "arg_4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %15 = OpTypeSampler +%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 + %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant + %void = OpTypeVoid + %16 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %21 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %27 = OpConstantNull %int + %v4int = OpTypeVector %int 4 + %32 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 +%_ptr_Function_v4int = OpTypePointer Function %v4int + %43 = OpConstantNull %v4int + %44 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_8b754c = OpFunction %void None %16 + %19 = OpLabel + %arg_3 = OpVariable %_ptr_Function_v2float Function %21 + %arg_4 = OpVariable %_ptr_Function_int Function %27 + %res = OpVariable %_ptr_Function_v4int Function %43 + OpStore %arg_3 %21 + OpStore %arg_4 %int_1 + %30 = OpLoad %15 %arg_2 + %31 = OpLoad %11 %arg_1 + %33 = OpSampledImage %32 %31 %30 + %35 = OpLoad %v2float %arg_3 + %36 = OpCompositeExtract %float %35 0 + %37 = OpCompositeExtract %float %35 1 + %39 = OpLoad %int %arg_4 + %38 = OpConvertSToF %float %39 + %40 = OpCompositeConstruct %v3float %36 %37 %38 + %28 = OpImageGather %v4int %33 %40 %int_1 + OpStore %res %28 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %44 + %46 = OpLabel + %47 = OpFunctionCall %void %textureGather_8b754c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %16 + %49 = OpLabel + %50 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %50 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %16 + %53 = OpLabel + %54 = OpFunctionCall %void %textureGather_8b754c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %16 + %56 = OpLabel + %57 = OpFunctionCall %void %textureGather_8b754c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureGather/8b754c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/8b754c.wgsl.expected.wgsl new file mode 100644 index 0000000000..7bcabc248c --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/8b754c.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +@group(1) @binding(1) var arg_1 : texture_2d_array; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_8b754c() { + var arg_3 = vec2(); + var arg_4 = 1; + var res : vec4 = textureGather(1, arg_1, arg_2, arg_3, arg_4); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_8b754c(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_8b754c(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_8b754c(); +} diff --git a/test/tint/builtins/gen/var/textureGather/9a6358.wgsl b/test/tint/builtins/gen/var/textureGather/9a6358.wgsl new file mode 100644 index 0000000000..8d662be8e1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/9a6358.wgsl @@ -0,0 +1,49 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d_array; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureGather(texture: texture_depth_2d_array, sampler: sampler, coords: vec2, array_index: i32) -> vec4 +fn textureGather_9a6358() { + var arg_2 = vec2(); + var arg_3 = 1; + var res: vec4 = textureGather(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_9a6358(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_9a6358(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_9a6358(); +} diff --git a/test/tint/builtins/gen/var/textureGather/9a6358.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/9a6358.wgsl.expected.glsl new file mode 100644 index 0000000000..f535b11110 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/9a6358.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureGather_9a6358() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + vec4 res = textureGather(arg_0_arg_1, vec3(arg_2, float(arg_3)), 0.0); +} + +vec4 vertex_main() { + textureGather_9a6358(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureGather_9a6358() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + vec4 res = textureGather(arg_0_arg_1, vec3(arg_2, float(arg_3)), 0.0); +} + +void fragment_main() { + textureGather_9a6358(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureGather_9a6358() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + vec4 res = textureGather(arg_0_arg_1, vec3(arg_2, float(arg_3)), 0.0); +} + +void compute_main() { + textureGather_9a6358(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/9a6358.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureGather/9a6358.wgsl.expected.hlsl new file mode 100644 index 0000000000..00950b5ffd --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/9a6358.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureGather_9a6358() { + float2 arg_2 = (0.0f).xx; + int arg_3 = 1; + float4 res = arg_0.Gather(arg_1, float3(arg_2, float(arg_3))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_9a6358(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_9a6358(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_9a6358(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/9a6358.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/9a6358.wgsl.expected.msl new file mode 100644 index 0000000000..0b4f909995 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/9a6358.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureGather_9a6358(depth2d_array tint_symbol_1, sampler tint_symbol_2) { + float2 arg_2 = float2(0.0f); + int arg_3 = 1; + float4 res = tint_symbol_1.gather(tint_symbol_2, arg_2, arg_3); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d_array tint_symbol_3, sampler tint_symbol_4) { + textureGather_9a6358(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_9a6358(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depth2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_9a6358(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureGather/9a6358.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/9a6358.wgsl.expected.spvasm new file mode 100644 index 0000000000..96ae32ce24 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/9a6358.wgsl.expected.spvasm @@ -0,0 +1,101 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 57 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureGather_9a6358 "textureGather_9a6358" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %20 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %27 = OpConstantNull %int + %31 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 + %int_0 = OpConstant %int 0 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %43 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_9a6358 = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %20 + %arg_3 = OpVariable %_ptr_Function_int Function %27 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_2 %20 + OpStore %arg_3 %int_1 + %29 = OpLoad %14 %arg_1 + %30 = OpLoad %11 %arg_0 + %32 = OpSampledImage %31 %30 %29 + %34 = OpLoad %v2float %arg_2 + %35 = OpCompositeExtract %float %34 0 + %36 = OpCompositeExtract %float %34 1 + %38 = OpLoad %int %arg_3 + %37 = OpConvertSToF %float %38 + %39 = OpCompositeConstruct %v3float %35 %36 %37 + %28 = OpImageGather %v4float %32 %39 %int_0 + OpStore %res %28 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %43 + %45 = OpLabel + %46 = OpFunctionCall %void %textureGather_9a6358 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %48 = OpLabel + %49 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %49 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %52 = OpLabel + %53 = OpFunctionCall %void %textureGather_9a6358 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %55 = OpLabel + %56 = OpFunctionCall %void %textureGather_9a6358 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureGather/9a6358.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/9a6358.wgsl.expected.wgsl new file mode 100644 index 0000000000..91e2ccd243 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/9a6358.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d_array; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureGather_9a6358() { + var arg_2 = vec2(); + var arg_3 = 1; + var res : vec4 = textureGather(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_9a6358(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_9a6358(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_9a6358(); +} diff --git a/test/tint/builtins/gen/var/textureGather/af55b3.wgsl b/test/tint/builtins/gen/var/textureGather/af55b3.wgsl new file mode 100644 index 0000000000..754bffcf00 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/af55b3.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_2d; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_2d, sampler: sampler, coords: vec2, @const offset: vec2) -> vec4 +fn textureGather_af55b3() { + var arg_3 = vec2(); + var res: vec4 = textureGather(1, arg_1, arg_2, arg_3, vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_af55b3(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_af55b3(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_af55b3(); +} diff --git a/test/tint/builtins/gen/var/textureGather/af55b3.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/af55b3.wgsl.expected.glsl new file mode 100644 index 0000000000..ec46313269 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/af55b3.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +uniform highp sampler2D arg_1_arg_2; + +void textureGather_af55b3() { + vec2 arg_3 = vec2(0.0f); + vec4 res = textureGatherOffset(arg_1_arg_2, arg_3, ivec2(0), 1); +} + +vec4 vertex_main() { + textureGather_af55b3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2D arg_1_arg_2; + +void textureGather_af55b3() { + vec2 arg_3 = vec2(0.0f); + vec4 res = textureGatherOffset(arg_1_arg_2, arg_3, ivec2(0), 1); +} + +void fragment_main() { + textureGather_af55b3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2D arg_1_arg_2; + +void textureGather_af55b3() { + vec2 arg_3 = vec2(0.0f); + vec4 res = textureGatherOffset(arg_1_arg_2, arg_3, ivec2(0), 1); +} + +void compute_main() { + textureGather_af55b3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/af55b3.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureGather/af55b3.wgsl.expected.hlsl new file mode 100644 index 0000000000..2cf56d1ba9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/af55b3.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_af55b3() { + float2 arg_3 = (0.0f).xx; + float4 res = arg_1.GatherGreen(arg_2, arg_3, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_af55b3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_af55b3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_af55b3(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/af55b3.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/af55b3.wgsl.expected.msl new file mode 100644 index 0000000000..5bdf570683 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/af55b3.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void textureGather_af55b3(texture2d tint_symbol_1, sampler tint_symbol_2) { + float2 arg_3 = float2(0.0f); + float4 res = tint_symbol_1.gather(tint_symbol_2, arg_3, int2(0), component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_3, sampler tint_symbol_4) { + textureGather_af55b3(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_af55b3(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_af55b3(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureGather/af55b3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/af55b3.wgsl.expected.spvasm new file mode 100644 index 0000000000..7bb9edcb23 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/af55b3.wgsl.expected.spvasm @@ -0,0 +1,91 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 49 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_af55b3 "textureGather_af55b3" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_2 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %20 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %26 = OpTypeSampledImage %11 + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %v2int = OpTypeVector %int 2 + %32 = OpConstantNull %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %35 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_af55b3 = OpFunction %void None %15 + %18 = OpLabel + %arg_3 = OpVariable %_ptr_Function_v2float Function %20 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_3 %20 + %24 = OpLoad %14 %arg_2 + %25 = OpLoad %11 %arg_1 + %27 = OpSampledImage %26 %25 %24 + %28 = OpLoad %v2float %arg_3 + %23 = OpImageGather %v4float %27 %28 %int_1 ConstOffset %32 + OpStore %res %23 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %35 + %37 = OpLabel + %38 = OpFunctionCall %void %textureGather_af55b3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %40 = OpLabel + %41 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %41 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %44 = OpLabel + %45 = OpFunctionCall %void %textureGather_af55b3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %47 = OpLabel + %48 = OpFunctionCall %void %textureGather_af55b3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureGather/af55b3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/af55b3.wgsl.expected.wgsl new file mode 100644 index 0000000000..e0e56dbebf --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/af55b3.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +@group(1) @binding(1) var arg_1 : texture_2d; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_af55b3() { + var arg_3 = vec2(); + var res : vec4 = textureGather(1, arg_1, arg_2, arg_3, vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_af55b3(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_af55b3(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_af55b3(); +} diff --git a/test/tint/builtins/gen/var/textureGather/bb3ac5.wgsl b/test/tint/builtins/gen/var/textureGather/bb3ac5.wgsl new file mode 100644 index 0000000000..a0a33cbbb6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/bb3ac5.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_2d; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_2d, sampler: sampler, coords: vec2) -> vec4 +fn textureGather_bb3ac5() { + var arg_3 = vec2(); + var res: vec4 = textureGather(1, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_bb3ac5(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_bb3ac5(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_bb3ac5(); +} diff --git a/test/tint/builtins/gen/var/textureGather/bb3ac5.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/bb3ac5.wgsl.expected.glsl new file mode 100644 index 0000000000..0c9b449c4f --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/bb3ac5.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +uniform highp isampler2D arg_1_arg_2; + +void textureGather_bb3ac5() { + vec2 arg_3 = vec2(0.0f); + ivec4 res = textureGather(arg_1_arg_2, arg_3, 1); +} + +vec4 vertex_main() { + textureGather_bb3ac5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp isampler2D arg_1_arg_2; + +void textureGather_bb3ac5() { + vec2 arg_3 = vec2(0.0f); + ivec4 res = textureGather(arg_1_arg_2, arg_3, 1); +} + +void fragment_main() { + textureGather_bb3ac5(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp isampler2D arg_1_arg_2; + +void textureGather_bb3ac5() { + vec2 arg_3 = vec2(0.0f); + ivec4 res = textureGather(arg_1_arg_2, arg_3, 1); +} + +void compute_main() { + textureGather_bb3ac5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/bb3ac5.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureGather/bb3ac5.wgsl.expected.hlsl new file mode 100644 index 0000000000..2f718f3661 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/bb3ac5.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_bb3ac5() { + float2 arg_3 = (0.0f).xx; + int4 res = arg_1.GatherGreen(arg_2, arg_3); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_bb3ac5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_bb3ac5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_bb3ac5(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/bb3ac5.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/bb3ac5.wgsl.expected.msl new file mode 100644 index 0000000000..99c8768564 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/bb3ac5.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void textureGather_bb3ac5(texture2d tint_symbol_1, sampler tint_symbol_2) { + float2 arg_3 = float2(0.0f); + int4 res = tint_symbol_1.gather(tint_symbol_2, arg_3, int2(0), component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_3, sampler tint_symbol_4) { + textureGather_bb3ac5(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_bb3ac5(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_bb3ac5(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureGather/bb3ac5.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/bb3ac5.wgsl.expected.spvasm new file mode 100644 index 0000000000..0d15df0fda --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/bb3ac5.wgsl.expected.spvasm @@ -0,0 +1,91 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 49 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_bb3ac5 "textureGather_bb3ac5" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %15 = OpTypeSampler +%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 + %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant + %void = OpTypeVoid + %16 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %21 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %v4int = OpTypeVector %int 4 + %28 = OpTypeSampledImage %11 + %int_1 = OpConstant %int 1 +%_ptr_Function_v4int = OpTypePointer Function %v4int + %34 = OpConstantNull %v4int + %35 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_bb3ac5 = OpFunction %void None %16 + %19 = OpLabel + %arg_3 = OpVariable %_ptr_Function_v2float Function %21 + %res = OpVariable %_ptr_Function_v4int Function %34 + OpStore %arg_3 %21 + %26 = OpLoad %15 %arg_2 + %27 = OpLoad %11 %arg_1 + %29 = OpSampledImage %28 %27 %26 + %30 = OpLoad %v2float %arg_3 + %24 = OpImageGather %v4int %29 %30 %int_1 + OpStore %res %24 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %35 + %37 = OpLabel + %38 = OpFunctionCall %void %textureGather_bb3ac5 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %16 + %40 = OpLabel + %41 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %41 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %16 + %44 = OpLabel + %45 = OpFunctionCall %void %textureGather_bb3ac5 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %16 + %47 = OpLabel + %48 = OpFunctionCall %void %textureGather_bb3ac5 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureGather/bb3ac5.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/bb3ac5.wgsl.expected.wgsl new file mode 100644 index 0000000000..e7eb3e8fad --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/bb3ac5.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +@group(1) @binding(1) var arg_1 : texture_2d; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_bb3ac5() { + var arg_3 = vec2(); + var res : vec4 = textureGather(1, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_bb3ac5(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_bb3ac5(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_bb3ac5(); +} diff --git a/test/tint/builtins/gen/var/textureGather/c0640c.wgsl b/test/tint/builtins/gen/var/textureGather/c0640c.wgsl new file mode 100644 index 0000000000..6c23eb073b --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/c0640c.wgsl @@ -0,0 +1,49 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_cube_array; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_cube_array, sampler: sampler, coords: vec3, array_index: i32) -> vec4 +fn textureGather_c0640c() { + var arg_3 = vec3(); + var arg_4 = 1; + var res: vec4 = textureGather(1, arg_1, arg_2, arg_3, arg_4); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_c0640c(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_c0640c(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_c0640c(); +} diff --git a/test/tint/builtins/gen/var/textureGather/c0640c.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/c0640c.wgsl.expected.glsl new file mode 100644 index 0000000000..a15bb750df --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/c0640c.wgsl.expected.glsl @@ -0,0 +1,84 @@ +SKIP: FAILED + +#version 310 es + +uniform highp isamplerCubeArray arg_1_arg_2; + +void textureGather_c0640c() { + vec3 arg_3 = vec3(0.0f); + int arg_4 = 1; + ivec4 res = textureGather(arg_1_arg_2, vec4(arg_3, float(arg_4)), 1); +} + +vec4 vertex_main() { + textureGather_c0640c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'isamplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp isamplerCubeArray arg_1_arg_2; + +void textureGather_c0640c() { + vec3 arg_3 = vec3(0.0f); + int arg_4 = 1; + ivec4 res = textureGather(arg_1_arg_2, vec4(arg_3, float(arg_4)), 1); +} + +void fragment_main() { + textureGather_c0640c(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'isamplerCubeArray' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp isamplerCubeArray arg_1_arg_2; + +void textureGather_c0640c() { + vec3 arg_3 = vec3(0.0f); + int arg_4 = 1; + ivec4 res = textureGather(arg_1_arg_2, vec4(arg_3, float(arg_4)), 1); +} + +void compute_main() { + textureGather_c0640c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'isamplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureGather/c0640c.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureGather/c0640c.wgsl.expected.hlsl new file mode 100644 index 0000000000..76b208b9f9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/c0640c.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +TextureCubeArray arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_c0640c() { + float3 arg_3 = (0.0f).xxx; + int arg_4 = 1; + int4 res = arg_1.GatherGreen(arg_2, float4(arg_3, float(arg_4))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_c0640c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_c0640c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_c0640c(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/c0640c.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/c0640c.wgsl.expected.msl new file mode 100644 index 0000000000..9e5a33ba67 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/c0640c.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureGather_c0640c(texturecube_array tint_symbol_1, sampler tint_symbol_2) { + float3 arg_3 = float3(0.0f); + int arg_4 = 1; + int4 res = tint_symbol_1.gather(tint_symbol_2, arg_3, arg_4, component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube_array tint_symbol_3, sampler tint_symbol_4) { + textureGather_c0640c(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_c0640c(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texturecube_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_c0640c(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureGather/c0640c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/c0640c.wgsl.expected.spvasm new file mode 100644 index 0000000000..1a0206bfb9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/c0640c.wgsl.expected.spvasm @@ -0,0 +1,103 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 58 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_c0640c "textureGather_c0640c" + OpName %arg_3 "arg_3" + OpName %arg_4 "arg_4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %15 = OpTypeSampler +%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 + %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant + %void = OpTypeVoid + %16 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %21 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %27 = OpConstantNull %int + %v4int = OpTypeVector %int 4 + %32 = OpTypeSampledImage %11 +%_ptr_Function_v4int = OpTypePointer Function %v4int + %43 = OpConstantNull %v4int + %44 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_c0640c = OpFunction %void None %16 + %19 = OpLabel + %arg_3 = OpVariable %_ptr_Function_v3float Function %21 + %arg_4 = OpVariable %_ptr_Function_int Function %27 + %res = OpVariable %_ptr_Function_v4int Function %43 + OpStore %arg_3 %21 + OpStore %arg_4 %int_1 + %30 = OpLoad %15 %arg_2 + %31 = OpLoad %11 %arg_1 + %33 = OpSampledImage %32 %31 %30 + %34 = OpLoad %v3float %arg_3 + %35 = OpCompositeExtract %float %34 0 + %36 = OpCompositeExtract %float %34 1 + %37 = OpCompositeExtract %float %34 2 + %39 = OpLoad %int %arg_4 + %38 = OpConvertSToF %float %39 + %40 = OpCompositeConstruct %v4float %35 %36 %37 %38 + %28 = OpImageGather %v4int %33 %40 %int_1 + OpStore %res %28 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %44 + %46 = OpLabel + %47 = OpFunctionCall %void %textureGather_c0640c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %16 + %49 = OpLabel + %50 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %50 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %16 + %53 = OpLabel + %54 = OpFunctionCall %void %textureGather_c0640c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %16 + %56 = OpLabel + %57 = OpFunctionCall %void %textureGather_c0640c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureGather/c0640c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/c0640c.wgsl.expected.wgsl new file mode 100644 index 0000000000..da3cf25865 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/c0640c.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +@group(1) @binding(1) var arg_1 : texture_cube_array; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_c0640c() { + var arg_3 = vec3(); + var arg_4 = 1; + var res : vec4 = textureGather(1, arg_1, arg_2, arg_3, arg_4); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_c0640c(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_c0640c(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_c0640c(); +} diff --git a/test/tint/builtins/gen/var/textureGather/d1f187.wgsl b/test/tint/builtins/gen/var/textureGather/d1f187.wgsl new file mode 100644 index 0000000000..f6546dbc7c --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/d1f187.wgsl @@ -0,0 +1,49 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_2d_array; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, @const offset: vec2) -> vec4 +fn textureGather_d1f187() { + var arg_3 = vec2(); + var arg_4 = 1; + var res: vec4 = textureGather(1, arg_1, arg_2, arg_3, arg_4, vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_d1f187(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_d1f187(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_d1f187(); +} diff --git a/test/tint/builtins/gen/var/textureGather/d1f187.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/d1f187.wgsl.expected.glsl new file mode 100644 index 0000000000..cf015a2672 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/d1f187.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +uniform highp usampler2DArray arg_1_arg_2; + +void textureGather_d1f187() { + vec2 arg_3 = vec2(0.0f); + int arg_4 = 1; + uvec4 res = textureGatherOffset(arg_1_arg_2, vec3(arg_3, float(arg_4)), ivec2(0), 1); +} + +vec4 vertex_main() { + textureGather_d1f187(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp usampler2DArray arg_1_arg_2; + +void textureGather_d1f187() { + vec2 arg_3 = vec2(0.0f); + int arg_4 = 1; + uvec4 res = textureGatherOffset(arg_1_arg_2, vec3(arg_3, float(arg_4)), ivec2(0), 1); +} + +void fragment_main() { + textureGather_d1f187(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp usampler2DArray arg_1_arg_2; + +void textureGather_d1f187() { + vec2 arg_3 = vec2(0.0f); + int arg_4 = 1; + uvec4 res = textureGatherOffset(arg_1_arg_2, vec3(arg_3, float(arg_4)), ivec2(0), 1); +} + +void compute_main() { + textureGather_d1f187(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/d1f187.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureGather/d1f187.wgsl.expected.hlsl new file mode 100644 index 0000000000..6fdf9e4239 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/d1f187.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +Texture2DArray arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_d1f187() { + float2 arg_3 = (0.0f).xx; + int arg_4 = 1; + uint4 res = arg_1.GatherGreen(arg_2, float3(arg_3, float(arg_4)), (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_d1f187(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_d1f187(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_d1f187(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/d1f187.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/d1f187.wgsl.expected.msl new file mode 100644 index 0000000000..a2e3383148 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/d1f187.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureGather_d1f187(texture2d_array tint_symbol_1, sampler tint_symbol_2) { + float2 arg_3 = float2(0.0f); + int arg_4 = 1; + uint4 res = tint_symbol_1.gather(tint_symbol_2, arg_3, arg_4, int2(0), component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_3, sampler tint_symbol_4) { + textureGather_d1f187(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_d1f187(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_d1f187(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureGather/d1f187.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/d1f187.wgsl.expected.spvasm new file mode 100644 index 0000000000..f88d541acb --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/d1f187.wgsl.expected.spvasm @@ -0,0 +1,105 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 61 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_d1f187 "textureGather_d1f187" + OpName %arg_3 "arg_3" + OpName %arg_4 "arg_4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %15 = OpTypeSampler +%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 + %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant + %void = OpTypeVoid + %16 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %21 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %28 = OpConstantNull %int + %v4uint = OpTypeVector %uint 4 + %33 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 + %v2int = OpTypeVector %int 2 + %43 = OpConstantNull %v2int +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %46 = OpConstantNull %v4uint + %47 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_d1f187 = OpFunction %void None %16 + %19 = OpLabel + %arg_3 = OpVariable %_ptr_Function_v2float Function %21 + %arg_4 = OpVariable %_ptr_Function_int Function %28 + %res = OpVariable %_ptr_Function_v4uint Function %46 + OpStore %arg_3 %21 + OpStore %arg_4 %int_1 + %31 = OpLoad %15 %arg_2 + %32 = OpLoad %11 %arg_1 + %34 = OpSampledImage %33 %32 %31 + %36 = OpLoad %v2float %arg_3 + %37 = OpCompositeExtract %float %36 0 + %38 = OpCompositeExtract %float %36 1 + %40 = OpLoad %int %arg_4 + %39 = OpConvertSToF %float %40 + %41 = OpCompositeConstruct %v3float %37 %38 %39 + %29 = OpImageGather %v4uint %34 %41 %int_1 ConstOffset %43 + OpStore %res %29 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %47 + %49 = OpLabel + %50 = OpFunctionCall %void %textureGather_d1f187 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %16 + %52 = OpLabel + %53 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %53 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %16 + %56 = OpLabel + %57 = OpFunctionCall %void %textureGather_d1f187 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %16 + %59 = OpLabel + %60 = OpFunctionCall %void %textureGather_d1f187 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureGather/d1f187.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/d1f187.wgsl.expected.wgsl new file mode 100644 index 0000000000..93aa44d9ef --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/d1f187.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +@group(1) @binding(1) var arg_1 : texture_2d_array; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_d1f187() { + var arg_3 = vec2(); + var arg_4 = 1; + var res : vec4 = textureGather(1, arg_1, arg_2, arg_3, arg_4, vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_d1f187(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_d1f187(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_d1f187(); +} diff --git a/test/tint/builtins/gen/var/textureGather/d90605.wgsl b/test/tint/builtins/gen/var/textureGather/d90605.wgsl new file mode 100644 index 0000000000..c813243b5a --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/d90605.wgsl @@ -0,0 +1,49 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d_array; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureGather(texture: texture_depth_2d_array, sampler: sampler, coords: vec2, array_index: i32, @const offset: vec2) -> vec4 +fn textureGather_d90605() { + var arg_2 = vec2(); + var arg_3 = 1; + var res: vec4 = textureGather(arg_0, arg_1, arg_2, arg_3, vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_d90605(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_d90605(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_d90605(); +} diff --git a/test/tint/builtins/gen/var/textureGather/d90605.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/d90605.wgsl.expected.glsl new file mode 100644 index 0000000000..698dd66a03 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/d90605.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureGather_d90605() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + vec4 res = textureGatherOffset(arg_0_arg_1, vec3(arg_2, float(arg_3)), 0.0, ivec2(0)); +} + +vec4 vertex_main() { + textureGather_d90605(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureGather_d90605() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + vec4 res = textureGatherOffset(arg_0_arg_1, vec3(arg_2, float(arg_3)), 0.0, ivec2(0)); +} + +void fragment_main() { + textureGather_d90605(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureGather_d90605() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + vec4 res = textureGatherOffset(arg_0_arg_1, vec3(arg_2, float(arg_3)), 0.0, ivec2(0)); +} + +void compute_main() { + textureGather_d90605(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/d90605.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureGather/d90605.wgsl.expected.hlsl new file mode 100644 index 0000000000..961f7f3b57 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/d90605.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureGather_d90605() { + float2 arg_2 = (0.0f).xx; + int arg_3 = 1; + float4 res = arg_0.Gather(arg_1, float3(arg_2, float(arg_3)), (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_d90605(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_d90605(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_d90605(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/d90605.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/d90605.wgsl.expected.msl new file mode 100644 index 0000000000..b5074d22c5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/d90605.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureGather_d90605(depth2d_array tint_symbol_1, sampler tint_symbol_2) { + float2 arg_2 = float2(0.0f); + int arg_3 = 1; + float4 res = tint_symbol_1.gather(tint_symbol_2, arg_2, arg_3, int2(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d_array tint_symbol_3, sampler tint_symbol_4) { + textureGather_d90605(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_d90605(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depth2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_d90605(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureGather/d90605.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/d90605.wgsl.expected.spvasm new file mode 100644 index 0000000000..2c1da3faf7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/d90605.wgsl.expected.spvasm @@ -0,0 +1,103 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 59 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureGather_d90605 "textureGather_d90605" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %20 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %27 = OpConstantNull %int + %31 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 + %int_0 = OpConstant %int 0 + %v2int = OpTypeVector %int 2 + %42 = OpConstantNull %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %45 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_d90605 = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %20 + %arg_3 = OpVariable %_ptr_Function_int Function %27 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_2 %20 + OpStore %arg_3 %int_1 + %29 = OpLoad %14 %arg_1 + %30 = OpLoad %11 %arg_0 + %32 = OpSampledImage %31 %30 %29 + %34 = OpLoad %v2float %arg_2 + %35 = OpCompositeExtract %float %34 0 + %36 = OpCompositeExtract %float %34 1 + %38 = OpLoad %int %arg_3 + %37 = OpConvertSToF %float %38 + %39 = OpCompositeConstruct %v3float %35 %36 %37 + %28 = OpImageGather %v4float %32 %39 %int_0 ConstOffset %42 + OpStore %res %28 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %45 + %47 = OpLabel + %48 = OpFunctionCall %void %textureGather_d90605 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %50 = OpLabel + %51 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %51 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %54 = OpLabel + %55 = OpFunctionCall %void %textureGather_d90605 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %57 = OpLabel + %58 = OpFunctionCall %void %textureGather_d90605 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureGather/d90605.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/d90605.wgsl.expected.wgsl new file mode 100644 index 0000000000..be99bc531c --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/d90605.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d_array; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureGather_d90605() { + var arg_2 = vec2(); + var arg_3 = 1; + var res : vec4 = textureGather(arg_0, arg_1, arg_2, arg_3, vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_d90605(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_d90605(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_d90605(); +} diff --git a/test/tint/builtins/gen/var/textureGather/e9d390.wgsl b/test/tint/builtins/gen/var/textureGather/e9d390.wgsl new file mode 100644 index 0000000000..afee0450d8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/e9d390.wgsl @@ -0,0 +1,49 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_2d_array; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, @const offset: vec2) -> vec4 +fn textureGather_e9d390() { + var arg_3 = vec2(); + var arg_4 = 1; + var res: vec4 = textureGather(1, arg_1, arg_2, arg_3, arg_4, vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_e9d390(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_e9d390(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_e9d390(); +} diff --git a/test/tint/builtins/gen/var/textureGather/e9d390.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/e9d390.wgsl.expected.glsl new file mode 100644 index 0000000000..51dbcc162e --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/e9d390.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +uniform highp isampler2DArray arg_1_arg_2; + +void textureGather_e9d390() { + vec2 arg_3 = vec2(0.0f); + int arg_4 = 1; + ivec4 res = textureGatherOffset(arg_1_arg_2, vec3(arg_3, float(arg_4)), ivec2(0), 1); +} + +vec4 vertex_main() { + textureGather_e9d390(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp isampler2DArray arg_1_arg_2; + +void textureGather_e9d390() { + vec2 arg_3 = vec2(0.0f); + int arg_4 = 1; + ivec4 res = textureGatherOffset(arg_1_arg_2, vec3(arg_3, float(arg_4)), ivec2(0), 1); +} + +void fragment_main() { + textureGather_e9d390(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp isampler2DArray arg_1_arg_2; + +void textureGather_e9d390() { + vec2 arg_3 = vec2(0.0f); + int arg_4 = 1; + ivec4 res = textureGatherOffset(arg_1_arg_2, vec3(arg_3, float(arg_4)), ivec2(0), 1); +} + +void compute_main() { + textureGather_e9d390(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/e9d390.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureGather/e9d390.wgsl.expected.hlsl new file mode 100644 index 0000000000..303164a498 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/e9d390.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +Texture2DArray arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_e9d390() { + float2 arg_3 = (0.0f).xx; + int arg_4 = 1; + int4 res = arg_1.GatherGreen(arg_2, float3(arg_3, float(arg_4)), (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_e9d390(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_e9d390(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_e9d390(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/e9d390.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/e9d390.wgsl.expected.msl new file mode 100644 index 0000000000..6d75549436 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/e9d390.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureGather_e9d390(texture2d_array tint_symbol_1, sampler tint_symbol_2) { + float2 arg_3 = float2(0.0f); + int arg_4 = 1; + int4 res = tint_symbol_1.gather(tint_symbol_2, arg_3, arg_4, int2(0), component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_3, sampler tint_symbol_4) { + textureGather_e9d390(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_e9d390(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_e9d390(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureGather/e9d390.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/e9d390.wgsl.expected.spvasm new file mode 100644 index 0000000000..0748d70cad --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/e9d390.wgsl.expected.spvasm @@ -0,0 +1,104 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 60 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_e9d390 "textureGather_e9d390" + OpName %arg_3 "arg_3" + OpName %arg_4 "arg_4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %15 = OpTypeSampler +%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 + %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant + %void = OpTypeVoid + %16 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %21 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %27 = OpConstantNull %int + %v4int = OpTypeVector %int 4 + %32 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 + %v2int = OpTypeVector %int 2 + %42 = OpConstantNull %v2int +%_ptr_Function_v4int = OpTypePointer Function %v4int + %45 = OpConstantNull %v4int + %46 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_e9d390 = OpFunction %void None %16 + %19 = OpLabel + %arg_3 = OpVariable %_ptr_Function_v2float Function %21 + %arg_4 = OpVariable %_ptr_Function_int Function %27 + %res = OpVariable %_ptr_Function_v4int Function %45 + OpStore %arg_3 %21 + OpStore %arg_4 %int_1 + %30 = OpLoad %15 %arg_2 + %31 = OpLoad %11 %arg_1 + %33 = OpSampledImage %32 %31 %30 + %35 = OpLoad %v2float %arg_3 + %36 = OpCompositeExtract %float %35 0 + %37 = OpCompositeExtract %float %35 1 + %39 = OpLoad %int %arg_4 + %38 = OpConvertSToF %float %39 + %40 = OpCompositeConstruct %v3float %36 %37 %38 + %28 = OpImageGather %v4int %33 %40 %int_1 ConstOffset %42 + OpStore %res %28 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %46 + %48 = OpLabel + %49 = OpFunctionCall %void %textureGather_e9d390 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %16 + %51 = OpLabel + %52 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %52 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %16 + %55 = OpLabel + %56 = OpFunctionCall %void %textureGather_e9d390 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %16 + %58 = OpLabel + %59 = OpFunctionCall %void %textureGather_e9d390 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureGather/e9d390.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/e9d390.wgsl.expected.wgsl new file mode 100644 index 0000000000..5b73c9d106 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/e9d390.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +@group(1) @binding(1) var arg_1 : texture_2d_array; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_e9d390() { + var arg_3 = vec2(); + var arg_4 = 1; + var res : vec4 = textureGather(1, arg_1, arg_2, arg_3, arg_4, vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_e9d390(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_e9d390(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_e9d390(); +} diff --git a/test/tint/builtins/gen/var/textureGather/f2c6e3.wgsl b/test/tint/builtins/gen/var/textureGather/f2c6e3.wgsl new file mode 100644 index 0000000000..e68bee7f32 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/f2c6e3.wgsl @@ -0,0 +1,49 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_cube_array; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_cube_array, sampler: sampler, coords: vec3, array_index: i32) -> vec4 +fn textureGather_f2c6e3() { + var arg_3 = vec3(); + var arg_4 = 1; + var res: vec4 = textureGather(1, arg_1, arg_2, arg_3, arg_4); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_f2c6e3(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_f2c6e3(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_f2c6e3(); +} diff --git a/test/tint/builtins/gen/var/textureGather/f2c6e3.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/f2c6e3.wgsl.expected.glsl new file mode 100644 index 0000000000..0b0838a02b --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/f2c6e3.wgsl.expected.glsl @@ -0,0 +1,84 @@ +SKIP: FAILED + +#version 310 es + +uniform highp usamplerCubeArray arg_1_arg_2; + +void textureGather_f2c6e3() { + vec3 arg_3 = vec3(0.0f); + int arg_4 = 1; + uvec4 res = textureGather(arg_1_arg_2, vec4(arg_3, float(arg_4)), 1); +} + +vec4 vertex_main() { + textureGather_f2c6e3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'usamplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp usamplerCubeArray arg_1_arg_2; + +void textureGather_f2c6e3() { + vec3 arg_3 = vec3(0.0f); + int arg_4 = 1; + uvec4 res = textureGather(arg_1_arg_2, vec4(arg_3, float(arg_4)), 1); +} + +void fragment_main() { + textureGather_f2c6e3(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'usamplerCubeArray' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp usamplerCubeArray arg_1_arg_2; + +void textureGather_f2c6e3() { + vec3 arg_3 = vec3(0.0f); + int arg_4 = 1; + uvec4 res = textureGather(arg_1_arg_2, vec4(arg_3, float(arg_4)), 1); +} + +void compute_main() { + textureGather_f2c6e3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'usamplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureGather/f2c6e3.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureGather/f2c6e3.wgsl.expected.hlsl new file mode 100644 index 0000000000..e7b6ba868b --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/f2c6e3.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +TextureCubeArray arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_f2c6e3() { + float3 arg_3 = (0.0f).xxx; + int arg_4 = 1; + uint4 res = arg_1.GatherGreen(arg_2, float4(arg_3, float(arg_4))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_f2c6e3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_f2c6e3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_f2c6e3(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/f2c6e3.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/f2c6e3.wgsl.expected.msl new file mode 100644 index 0000000000..088082f722 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/f2c6e3.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureGather_f2c6e3(texturecube_array tint_symbol_1, sampler tint_symbol_2) { + float3 arg_3 = float3(0.0f); + int arg_4 = 1; + uint4 res = tint_symbol_1.gather(tint_symbol_2, arg_3, arg_4, component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube_array tint_symbol_3, sampler tint_symbol_4) { + textureGather_f2c6e3(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_f2c6e3(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texturecube_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_f2c6e3(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureGather/f2c6e3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/f2c6e3.wgsl.expected.spvasm new file mode 100644 index 0000000000..2fba92b77f --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/f2c6e3.wgsl.expected.spvasm @@ -0,0 +1,104 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 59 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_f2c6e3 "textureGather_f2c6e3" + OpName %arg_3 "arg_3" + OpName %arg_4 "arg_4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %15 = OpTypeSampler +%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 + %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant + %void = OpTypeVoid + %16 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %21 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %28 = OpConstantNull %int + %v4uint = OpTypeVector %uint 4 + %33 = OpTypeSampledImage %11 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %44 = OpConstantNull %v4uint + %45 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_f2c6e3 = OpFunction %void None %16 + %19 = OpLabel + %arg_3 = OpVariable %_ptr_Function_v3float Function %21 + %arg_4 = OpVariable %_ptr_Function_int Function %28 + %res = OpVariable %_ptr_Function_v4uint Function %44 + OpStore %arg_3 %21 + OpStore %arg_4 %int_1 + %31 = OpLoad %15 %arg_2 + %32 = OpLoad %11 %arg_1 + %34 = OpSampledImage %33 %32 %31 + %35 = OpLoad %v3float %arg_3 + %36 = OpCompositeExtract %float %35 0 + %37 = OpCompositeExtract %float %35 1 + %38 = OpCompositeExtract %float %35 2 + %40 = OpLoad %int %arg_4 + %39 = OpConvertSToF %float %40 + %41 = OpCompositeConstruct %v4float %36 %37 %38 %39 + %29 = OpImageGather %v4uint %34 %41 %int_1 + OpStore %res %29 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %45 + %47 = OpLabel + %48 = OpFunctionCall %void %textureGather_f2c6e3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %16 + %50 = OpLabel + %51 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %51 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %16 + %54 = OpLabel + %55 = OpFunctionCall %void %textureGather_f2c6e3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %16 + %57 = OpLabel + %58 = OpFunctionCall %void %textureGather_f2c6e3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureGather/f2c6e3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/f2c6e3.wgsl.expected.wgsl new file mode 100644 index 0000000000..a12cb2e79a --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/f2c6e3.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +@group(1) @binding(1) var arg_1 : texture_cube_array; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_f2c6e3() { + var arg_3 = vec3(); + var arg_4 = 1; + var res : vec4 = textureGather(1, arg_1, arg_2, arg_3, arg_4); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGather_f2c6e3(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGather_f2c6e3(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGather_f2c6e3(); +} diff --git a/test/tint/builtins/gen/var/textureGatherCompare/182fd4.wgsl b/test/tint/builtins/gen/var/textureGatherCompare/182fd4.wgsl new file mode 100644 index 0000000000..c4cd7b290b --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/182fd4.wgsl @@ -0,0 +1,49 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_cube; +@group(1) @binding(1) var arg_1: sampler_comparison; + +// fn textureGatherCompare(texture: texture_depth_cube, sampler: sampler_comparison, coords: vec3, depth_ref: f32) -> vec4 +fn textureGatherCompare_182fd4() { + var arg_2 = vec3(); + var arg_3 = 1.0; + var res: vec4 = textureGatherCompare(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGatherCompare_182fd4(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGatherCompare_182fd4(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGatherCompare_182fd4(); +} diff --git a/test/tint/builtins/gen/var/textureGatherCompare/182fd4.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGatherCompare/182fd4.wgsl.expected.glsl new file mode 100644 index 0000000000..af1dd4da82 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/182fd4.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +uniform highp samplerCubeShadow arg_0_arg_1; + +void textureGatherCompare_182fd4() { + vec3 arg_2 = vec3(0.0f); + float arg_3 = 1.0f; + vec4 res = textureGather(arg_0_arg_1, arg_2, arg_3); +} + +vec4 vertex_main() { + textureGatherCompare_182fd4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp samplerCubeShadow arg_0_arg_1; + +void textureGatherCompare_182fd4() { + vec3 arg_2 = vec3(0.0f); + float arg_3 = 1.0f; + vec4 res = textureGather(arg_0_arg_1, arg_2, arg_3); +} + +void fragment_main() { + textureGatherCompare_182fd4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp samplerCubeShadow arg_0_arg_1; + +void textureGatherCompare_182fd4() { + vec3 arg_2 = vec3(0.0f); + float arg_3 = 1.0f; + vec4 res = textureGather(arg_0_arg_1, arg_2, arg_3); +} + +void compute_main() { + textureGatherCompare_182fd4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGatherCompare/182fd4.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureGatherCompare/182fd4.wgsl.expected.hlsl new file mode 100644 index 0000000000..294d4d3441 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/182fd4.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +TextureCube arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureGatherCompare_182fd4() { + float3 arg_2 = (0.0f).xxx; + float arg_3 = 1.0f; + float4 res = arg_0.GatherCmp(arg_1, arg_2, arg_3); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGatherCompare_182fd4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGatherCompare_182fd4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGatherCompare_182fd4(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGatherCompare/182fd4.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGatherCompare/182fd4.wgsl.expected.msl new file mode 100644 index 0000000000..5f3be12095 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/182fd4.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureGatherCompare_182fd4(depthcube tint_symbol_1, sampler tint_symbol_2) { + float3 arg_2 = float3(0.0f); + float arg_3 = 1.0f; + float4 res = tint_symbol_1.gather_compare(tint_symbol_2, arg_2, arg_3); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depthcube tint_symbol_3, sampler tint_symbol_4) { + textureGatherCompare_182fd4(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depthcube tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depthcube tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGatherCompare_182fd4(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depthcube tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGatherCompare_182fd4(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureGatherCompare/182fd4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGatherCompare/182fd4.wgsl.expected.spvasm new file mode 100644 index 0000000000..e8bd4b7ef1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/182fd4.wgsl.expected.spvasm @@ -0,0 +1,92 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 48 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureGatherCompare_182fd4 "textureGatherCompare_182fd4" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float Cube 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %20 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %29 = OpTypeSampledImage %11 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %35 = OpTypeFunction %v4float +%textureGatherCompare_182fd4 = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v3float Function %20 + %arg_3 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_2 %20 + OpStore %arg_3 %float_1 + %27 = OpLoad %14 %arg_1 + %28 = OpLoad %11 %arg_0 + %30 = OpSampledImage %29 %28 %27 + %31 = OpLoad %v3float %arg_2 + %32 = OpLoad %float %arg_3 + %26 = OpImageDrefGather %v4float %30 %31 %32 + OpStore %res %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %35 + %37 = OpLabel + %38 = OpFunctionCall %void %textureGatherCompare_182fd4 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %40 = OpLabel + %41 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %41 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %43 = OpLabel + %44 = OpFunctionCall %void %textureGatherCompare_182fd4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %46 = OpLabel + %47 = OpFunctionCall %void %textureGatherCompare_182fd4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureGatherCompare/182fd4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGatherCompare/182fd4.wgsl.expected.wgsl new file mode 100644 index 0000000000..14cdd2b55c --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/182fd4.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +@group(1) @binding(0) var arg_0 : texture_depth_cube; + +@group(1) @binding(1) var arg_1 : sampler_comparison; + +fn textureGatherCompare_182fd4() { + var arg_2 = vec3(); + var arg_3 = 1.0; + var res : vec4 = textureGatherCompare(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGatherCompare_182fd4(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGatherCompare_182fd4(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGatherCompare_182fd4(); +} diff --git a/test/tint/builtins/gen/var/textureGatherCompare/313add.wgsl b/test/tint/builtins/gen/var/textureGatherCompare/313add.wgsl new file mode 100644 index 0000000000..e7dcda61cc --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/313add.wgsl @@ -0,0 +1,49 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d; +@group(1) @binding(1) var arg_1: sampler_comparison; + +// fn textureGatherCompare(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2, depth_ref: f32, @const offset: vec2) -> vec4 +fn textureGatherCompare_313add() { + var arg_2 = vec2(); + var arg_3 = 1.0; + var res: vec4 = textureGatherCompare(arg_0, arg_1, arg_2, arg_3, vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGatherCompare_313add(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGatherCompare_313add(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGatherCompare_313add(); +} diff --git a/test/tint/builtins/gen/var/textureGatherCompare/313add.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGatherCompare/313add.wgsl.expected.glsl new file mode 100644 index 0000000000..951aa5ab94 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/313add.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureGatherCompare_313add() { + vec2 arg_2 = vec2(0.0f); + float arg_3 = 1.0f; + vec4 res = textureGatherOffset(arg_0_arg_1, arg_2, arg_3, ivec2(0)); +} + +vec4 vertex_main() { + textureGatherCompare_313add(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureGatherCompare_313add() { + vec2 arg_2 = vec2(0.0f); + float arg_3 = 1.0f; + vec4 res = textureGatherOffset(arg_0_arg_1, arg_2, arg_3, ivec2(0)); +} + +void fragment_main() { + textureGatherCompare_313add(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureGatherCompare_313add() { + vec2 arg_2 = vec2(0.0f); + float arg_3 = 1.0f; + vec4 res = textureGatherOffset(arg_0_arg_1, arg_2, arg_3, ivec2(0)); +} + +void compute_main() { + textureGatherCompare_313add(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGatherCompare/313add.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureGatherCompare/313add.wgsl.expected.hlsl new file mode 100644 index 0000000000..c92a22bdaf --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/313add.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +Texture2D arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureGatherCompare_313add() { + float2 arg_2 = (0.0f).xx; + float arg_3 = 1.0f; + float4 res = arg_0.GatherCmp(arg_1, arg_2, arg_3, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGatherCompare_313add(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGatherCompare_313add(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGatherCompare_313add(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGatherCompare/313add.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGatherCompare/313add.wgsl.expected.msl new file mode 100644 index 0000000000..48629383d9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/313add.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureGatherCompare_313add(depth2d tint_symbol_1, sampler tint_symbol_2) { + float2 arg_2 = float2(0.0f); + float arg_3 = 1.0f; + float4 res = tint_symbol_1.gather_compare(tint_symbol_2, arg_2, arg_3, int2(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d tint_symbol_3, sampler tint_symbol_4) { + textureGatherCompare_313add(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGatherCompare_313add(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depth2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGatherCompare_313add(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureGatherCompare/313add.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGatherCompare/313add.wgsl.expected.spvasm new file mode 100644 index 0000000000..fe55f7a924 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/313add.wgsl.expected.spvasm @@ -0,0 +1,95 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 51 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureGatherCompare_313add "textureGatherCompare_313add" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %20 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %29 = OpTypeSampledImage %11 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %35 = OpConstantNull %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %38 = OpTypeFunction %v4float +%textureGatherCompare_313add = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %20 + %arg_3 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_2 %20 + OpStore %arg_3 %float_1 + %27 = OpLoad %14 %arg_1 + %28 = OpLoad %11 %arg_0 + %30 = OpSampledImage %29 %28 %27 + %31 = OpLoad %v2float %arg_2 + %32 = OpLoad %float %arg_3 + %26 = OpImageDrefGather %v4float %30 %31 %32 ConstOffset %35 + OpStore %res %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %38 + %40 = OpLabel + %41 = OpFunctionCall %void %textureGatherCompare_313add + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %43 = OpLabel + %44 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %44 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %46 = OpLabel + %47 = OpFunctionCall %void %textureGatherCompare_313add + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %49 = OpLabel + %50 = OpFunctionCall %void %textureGatherCompare_313add + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureGatherCompare/313add.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGatherCompare/313add.wgsl.expected.wgsl new file mode 100644 index 0000000000..280870d4f4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/313add.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d; + +@group(1) @binding(1) var arg_1 : sampler_comparison; + +fn textureGatherCompare_313add() { + var arg_2 = vec2(); + var arg_3 = 1.0; + var res : vec4 = textureGatherCompare(arg_0, arg_1, arg_2, arg_3, vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGatherCompare_313add(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGatherCompare_313add(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGatherCompare_313add(); +} diff --git a/test/tint/builtins/gen/var/textureGatherCompare/60d2d1.wgsl b/test/tint/builtins/gen/var/textureGatherCompare/60d2d1.wgsl new file mode 100644 index 0000000000..279f1cc13a --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/60d2d1.wgsl @@ -0,0 +1,50 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_cube_array; +@group(1) @binding(1) var arg_1: sampler_comparison; + +// fn textureGatherCompare(texture: texture_depth_cube_array, sampler: sampler_comparison, coords: vec3, array_index: i32, depth_ref: f32) -> vec4 +fn textureGatherCompare_60d2d1() { + var arg_2 = vec3(); + var arg_3 = 1; + var arg_4 = 1.0; + var res: vec4 = textureGatherCompare(arg_0, arg_1, arg_2, arg_3, arg_4); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGatherCompare_60d2d1(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGatherCompare_60d2d1(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGatherCompare_60d2d1(); +} diff --git a/test/tint/builtins/gen/var/textureGatherCompare/60d2d1.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGatherCompare/60d2d1.wgsl.expected.glsl new file mode 100644 index 0000000000..33e06ee954 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/60d2d1.wgsl.expected.glsl @@ -0,0 +1,87 @@ +SKIP: FAILED + +#version 310 es + +uniform highp samplerCubeArrayShadow arg_0_arg_1; + +void textureGatherCompare_60d2d1() { + vec3 arg_2 = vec3(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + vec4 res = textureGather(arg_0_arg_1, vec4(arg_2, float(arg_3)), arg_4); +} + +vec4 vertex_main() { + textureGatherCompare_60d2d1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArrayShadow' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp samplerCubeArrayShadow arg_0_arg_1; + +void textureGatherCompare_60d2d1() { + vec3 arg_2 = vec3(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + vec4 res = textureGather(arg_0_arg_1, vec4(arg_2, float(arg_3)), arg_4); +} + +void fragment_main() { + textureGatherCompare_60d2d1(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'samplerCubeArrayShadow' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp samplerCubeArrayShadow arg_0_arg_1; + +void textureGatherCompare_60d2d1() { + vec3 arg_2 = vec3(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + vec4 res = textureGather(arg_0_arg_1, vec4(arg_2, float(arg_3)), arg_4); +} + +void compute_main() { + textureGatherCompare_60d2d1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArrayShadow' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureGatherCompare/60d2d1.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureGatherCompare/60d2d1.wgsl.expected.hlsl new file mode 100644 index 0000000000..a0284d85ec --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/60d2d1.wgsl.expected.hlsl @@ -0,0 +1,36 @@ +TextureCubeArray arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureGatherCompare_60d2d1() { + float3 arg_2 = (0.0f).xxx; + int arg_3 = 1; + float arg_4 = 1.0f; + float4 res = arg_0.GatherCmp(arg_1, float4(arg_2, float(arg_3)), arg_4); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGatherCompare_60d2d1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGatherCompare_60d2d1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGatherCompare_60d2d1(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGatherCompare/60d2d1.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGatherCompare/60d2d1.wgsl.expected.msl new file mode 100644 index 0000000000..682a170df8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/60d2d1.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureGatherCompare_60d2d1(depthcube_array tint_symbol_1, sampler tint_symbol_2) { + float3 arg_2 = float3(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + float4 res = tint_symbol_1.gather_compare(tint_symbol_2, arg_2, arg_3, arg_4); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depthcube_array tint_symbol_3, sampler tint_symbol_4) { + textureGatherCompare_60d2d1(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depthcube_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depthcube_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGatherCompare_60d2d1(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depthcube_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGatherCompare_60d2d1(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureGatherCompare/60d2d1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGatherCompare/60d2d1.wgsl.expected.spvasm new file mode 100644 index 0000000000..660f0f304f --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/60d2d1.wgsl.expected.spvasm @@ -0,0 +1,106 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 59 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureGatherCompare_60d2d1 "textureGatherCompare_60d2d1" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %arg_4 "arg_4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %20 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %27 = OpConstantNull %int + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %34 = OpTypeSampledImage %11 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %46 = OpTypeFunction %v4float +%textureGatherCompare_60d2d1 = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v3float Function %20 + %arg_3 = OpVariable %_ptr_Function_int Function %27 + %arg_4 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_2 %20 + OpStore %arg_3 %int_1 + OpStore %arg_4 %float_1 + %32 = OpLoad %14 %arg_1 + %33 = OpLoad %11 %arg_0 + %35 = OpSampledImage %34 %33 %32 + %36 = OpLoad %v3float %arg_2 + %37 = OpCompositeExtract %float %36 0 + %38 = OpCompositeExtract %float %36 1 + %39 = OpCompositeExtract %float %36 2 + %41 = OpLoad %int %arg_3 + %40 = OpConvertSToF %float %41 + %42 = OpCompositeConstruct %v4float %37 %38 %39 %40 + %43 = OpLoad %float %arg_4 + %31 = OpImageDrefGather %v4float %35 %42 %43 + OpStore %res %31 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %46 + %48 = OpLabel + %49 = OpFunctionCall %void %textureGatherCompare_60d2d1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %51 = OpLabel + %52 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %52 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %54 = OpLabel + %55 = OpFunctionCall %void %textureGatherCompare_60d2d1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %57 = OpLabel + %58 = OpFunctionCall %void %textureGatherCompare_60d2d1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureGatherCompare/60d2d1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGatherCompare/60d2d1.wgsl.expected.wgsl new file mode 100644 index 0000000000..630a5af3d9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/60d2d1.wgsl.expected.wgsl @@ -0,0 +1,26 @@ +@group(1) @binding(0) var arg_0 : texture_depth_cube_array; + +@group(1) @binding(1) var arg_1 : sampler_comparison; + +fn textureGatherCompare_60d2d1() { + var arg_2 = vec3(); + var arg_3 = 1; + var arg_4 = 1.0; + var res : vec4 = textureGatherCompare(arg_0, arg_1, arg_2, arg_3, arg_4); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGatherCompare_60d2d1(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGatherCompare_60d2d1(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGatherCompare_60d2d1(); +} diff --git a/test/tint/builtins/gen/var/textureGatherCompare/6d9352.wgsl b/test/tint/builtins/gen/var/textureGatherCompare/6d9352.wgsl new file mode 100644 index 0000000000..4f8562bf2b --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/6d9352.wgsl @@ -0,0 +1,49 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d; +@group(1) @binding(1) var arg_1: sampler_comparison; + +// fn textureGatherCompare(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2, depth_ref: f32) -> vec4 +fn textureGatherCompare_6d9352() { + var arg_2 = vec2(); + var arg_3 = 1.0; + var res: vec4 = textureGatherCompare(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGatherCompare_6d9352(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGatherCompare_6d9352(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGatherCompare_6d9352(); +} diff --git a/test/tint/builtins/gen/var/textureGatherCompare/6d9352.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGatherCompare/6d9352.wgsl.expected.glsl new file mode 100644 index 0000000000..b57e6630f6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/6d9352.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureGatherCompare_6d9352() { + vec2 arg_2 = vec2(0.0f); + float arg_3 = 1.0f; + vec4 res = textureGather(arg_0_arg_1, arg_2, arg_3); +} + +vec4 vertex_main() { + textureGatherCompare_6d9352(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureGatherCompare_6d9352() { + vec2 arg_2 = vec2(0.0f); + float arg_3 = 1.0f; + vec4 res = textureGather(arg_0_arg_1, arg_2, arg_3); +} + +void fragment_main() { + textureGatherCompare_6d9352(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureGatherCompare_6d9352() { + vec2 arg_2 = vec2(0.0f); + float arg_3 = 1.0f; + vec4 res = textureGather(arg_0_arg_1, arg_2, arg_3); +} + +void compute_main() { + textureGatherCompare_6d9352(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGatherCompare/6d9352.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureGatherCompare/6d9352.wgsl.expected.hlsl new file mode 100644 index 0000000000..6c7d0f4904 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/6d9352.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +Texture2D arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureGatherCompare_6d9352() { + float2 arg_2 = (0.0f).xx; + float arg_3 = 1.0f; + float4 res = arg_0.GatherCmp(arg_1, arg_2, arg_3); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGatherCompare_6d9352(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGatherCompare_6d9352(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGatherCompare_6d9352(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGatherCompare/6d9352.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGatherCompare/6d9352.wgsl.expected.msl new file mode 100644 index 0000000000..ce423455f3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/6d9352.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureGatherCompare_6d9352(depth2d tint_symbol_1, sampler tint_symbol_2) { + float2 arg_2 = float2(0.0f); + float arg_3 = 1.0f; + float4 res = tint_symbol_1.gather_compare(tint_symbol_2, arg_2, arg_3); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d tint_symbol_3, sampler tint_symbol_4) { + textureGatherCompare_6d9352(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGatherCompare_6d9352(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depth2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGatherCompare_6d9352(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureGatherCompare/6d9352.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGatherCompare/6d9352.wgsl.expected.spvasm new file mode 100644 index 0000000000..0a6a85730d --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/6d9352.wgsl.expected.spvasm @@ -0,0 +1,92 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 48 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureGatherCompare_6d9352 "textureGatherCompare_6d9352" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %20 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %29 = OpTypeSampledImage %11 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %35 = OpTypeFunction %v4float +%textureGatherCompare_6d9352 = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %20 + %arg_3 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_2 %20 + OpStore %arg_3 %float_1 + %27 = OpLoad %14 %arg_1 + %28 = OpLoad %11 %arg_0 + %30 = OpSampledImage %29 %28 %27 + %31 = OpLoad %v2float %arg_2 + %32 = OpLoad %float %arg_3 + %26 = OpImageDrefGather %v4float %30 %31 %32 + OpStore %res %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %35 + %37 = OpLabel + %38 = OpFunctionCall %void %textureGatherCompare_6d9352 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %40 = OpLabel + %41 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %41 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %43 = OpLabel + %44 = OpFunctionCall %void %textureGatherCompare_6d9352 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %46 = OpLabel + %47 = OpFunctionCall %void %textureGatherCompare_6d9352 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureGatherCompare/6d9352.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGatherCompare/6d9352.wgsl.expected.wgsl new file mode 100644 index 0000000000..b45c6fd084 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/6d9352.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d; + +@group(1) @binding(1) var arg_1 : sampler_comparison; + +fn textureGatherCompare_6d9352() { + var arg_2 = vec2(); + var arg_3 = 1.0; + var res : vec4 = textureGatherCompare(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGatherCompare_6d9352(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGatherCompare_6d9352(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGatherCompare_6d9352(); +} diff --git a/test/tint/builtins/gen/var/textureGatherCompare/783e65.wgsl b/test/tint/builtins/gen/var/textureGatherCompare/783e65.wgsl new file mode 100644 index 0000000000..5215238c4a --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/783e65.wgsl @@ -0,0 +1,50 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d_array; +@group(1) @binding(1) var arg_1: sampler_comparison; + +// fn textureGatherCompare(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2, array_index: i32, depth_ref: f32) -> vec4 +fn textureGatherCompare_783e65() { + var arg_2 = vec2(); + var arg_3 = 1; + var arg_4 = 1.0; + var res: vec4 = textureGatherCompare(arg_0, arg_1, arg_2, arg_3, arg_4); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGatherCompare_783e65(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGatherCompare_783e65(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGatherCompare_783e65(); +} diff --git a/test/tint/builtins/gen/var/textureGatherCompare/783e65.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGatherCompare/783e65.wgsl.expected.glsl new file mode 100644 index 0000000000..84f32d58df --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/783e65.wgsl.expected.glsl @@ -0,0 +1,64 @@ +#version 310 es + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureGatherCompare_783e65() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + vec4 res = textureGather(arg_0_arg_1, vec3(arg_2, float(arg_3)), arg_4); +} + +vec4 vertex_main() { + textureGatherCompare_783e65(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureGatherCompare_783e65() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + vec4 res = textureGather(arg_0_arg_1, vec3(arg_2, float(arg_3)), arg_4); +} + +void fragment_main() { + textureGatherCompare_783e65(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureGatherCompare_783e65() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + vec4 res = textureGather(arg_0_arg_1, vec3(arg_2, float(arg_3)), arg_4); +} + +void compute_main() { + textureGatherCompare_783e65(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGatherCompare/783e65.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureGatherCompare/783e65.wgsl.expected.hlsl new file mode 100644 index 0000000000..c0b2cced51 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/783e65.wgsl.expected.hlsl @@ -0,0 +1,36 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureGatherCompare_783e65() { + float2 arg_2 = (0.0f).xx; + int arg_3 = 1; + float arg_4 = 1.0f; + float4 res = arg_0.GatherCmp(arg_1, float3(arg_2, float(arg_3)), arg_4); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGatherCompare_783e65(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGatherCompare_783e65(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGatherCompare_783e65(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGatherCompare/783e65.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGatherCompare/783e65.wgsl.expected.msl new file mode 100644 index 0000000000..b6aade7f31 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/783e65.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureGatherCompare_783e65(depth2d_array tint_symbol_1, sampler tint_symbol_2) { + float2 arg_2 = float2(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + float4 res = tint_symbol_1.gather_compare(tint_symbol_2, arg_2, arg_3, arg_4); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d_array tint_symbol_3, sampler tint_symbol_4) { + textureGatherCompare_783e65(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGatherCompare_783e65(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depth2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGatherCompare_783e65(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureGatherCompare/783e65.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGatherCompare/783e65.wgsl.expected.spvasm new file mode 100644 index 0000000000..9b37b338ef --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/783e65.wgsl.expected.spvasm @@ -0,0 +1,105 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 59 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureGatherCompare_783e65 "textureGatherCompare_783e65" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %arg_4 "arg_4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %20 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %27 = OpConstantNull %int + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %34 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %46 = OpTypeFunction %v4float +%textureGatherCompare_783e65 = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %20 + %arg_3 = OpVariable %_ptr_Function_int Function %27 + %arg_4 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_2 %20 + OpStore %arg_3 %int_1 + OpStore %arg_4 %float_1 + %32 = OpLoad %14 %arg_1 + %33 = OpLoad %11 %arg_0 + %35 = OpSampledImage %34 %33 %32 + %37 = OpLoad %v2float %arg_2 + %38 = OpCompositeExtract %float %37 0 + %39 = OpCompositeExtract %float %37 1 + %41 = OpLoad %int %arg_3 + %40 = OpConvertSToF %float %41 + %42 = OpCompositeConstruct %v3float %38 %39 %40 + %43 = OpLoad %float %arg_4 + %31 = OpImageDrefGather %v4float %35 %42 %43 + OpStore %res %31 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %46 + %48 = OpLabel + %49 = OpFunctionCall %void %textureGatherCompare_783e65 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %51 = OpLabel + %52 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %52 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %54 = OpLabel + %55 = OpFunctionCall %void %textureGatherCompare_783e65 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %57 = OpLabel + %58 = OpFunctionCall %void %textureGatherCompare_783e65 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureGatherCompare/783e65.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGatherCompare/783e65.wgsl.expected.wgsl new file mode 100644 index 0000000000..9ce6640352 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/783e65.wgsl.expected.wgsl @@ -0,0 +1,26 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d_array; + +@group(1) @binding(1) var arg_1 : sampler_comparison; + +fn textureGatherCompare_783e65() { + var arg_2 = vec2(); + var arg_3 = 1; + var arg_4 = 1.0; + var res : vec4 = textureGatherCompare(arg_0, arg_1, arg_2, arg_3, arg_4); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGatherCompare_783e65(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGatherCompare_783e65(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGatherCompare_783e65(); +} diff --git a/test/tint/builtins/gen/var/textureGatherCompare/f585cc.wgsl b/test/tint/builtins/gen/var/textureGatherCompare/f585cc.wgsl new file mode 100644 index 0000000000..17d15e20a1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/f585cc.wgsl @@ -0,0 +1,50 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d_array; +@group(1) @binding(1) var arg_1: sampler_comparison; + +// fn textureGatherCompare(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2, array_index: i32, depth_ref: f32, @const offset: vec2) -> vec4 +fn textureGatherCompare_f585cc() { + var arg_2 = vec2(); + var arg_3 = 1; + var arg_4 = 1.0; + var res: vec4 = textureGatherCompare(arg_0, arg_1, arg_2, arg_3, arg_4, vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGatherCompare_f585cc(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGatherCompare_f585cc(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGatherCompare_f585cc(); +} diff --git a/test/tint/builtins/gen/var/textureGatherCompare/f585cc.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGatherCompare/f585cc.wgsl.expected.glsl new file mode 100644 index 0000000000..8ae1b0adc1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/f585cc.wgsl.expected.glsl @@ -0,0 +1,64 @@ +#version 310 es + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureGatherCompare_f585cc() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + vec4 res = textureGatherOffset(arg_0_arg_1, vec3(arg_2, float(arg_3)), arg_4, ivec2(0)); +} + +vec4 vertex_main() { + textureGatherCompare_f585cc(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureGatherCompare_f585cc() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + vec4 res = textureGatherOffset(arg_0_arg_1, vec3(arg_2, float(arg_3)), arg_4, ivec2(0)); +} + +void fragment_main() { + textureGatherCompare_f585cc(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureGatherCompare_f585cc() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + vec4 res = textureGatherOffset(arg_0_arg_1, vec3(arg_2, float(arg_3)), arg_4, ivec2(0)); +} + +void compute_main() { + textureGatherCompare_f585cc(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGatherCompare/f585cc.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureGatherCompare/f585cc.wgsl.expected.hlsl new file mode 100644 index 0000000000..eef0720cda --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/f585cc.wgsl.expected.hlsl @@ -0,0 +1,36 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureGatherCompare_f585cc() { + float2 arg_2 = (0.0f).xx; + int arg_3 = 1; + float arg_4 = 1.0f; + float4 res = arg_0.GatherCmp(arg_1, float3(arg_2, float(arg_3)), arg_4, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGatherCompare_f585cc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGatherCompare_f585cc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGatherCompare_f585cc(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGatherCompare/f585cc.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGatherCompare/f585cc.wgsl.expected.msl new file mode 100644 index 0000000000..31ed159b29 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/f585cc.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureGatherCompare_f585cc(depth2d_array tint_symbol_1, sampler tint_symbol_2) { + float2 arg_2 = float2(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + float4 res = tint_symbol_1.gather_compare(tint_symbol_2, arg_2, arg_3, arg_4, int2(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d_array tint_symbol_3, sampler tint_symbol_4) { + textureGatherCompare_f585cc(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGatherCompare_f585cc(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depth2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGatherCompare_f585cc(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureGatherCompare/f585cc.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGatherCompare/f585cc.wgsl.expected.spvasm new file mode 100644 index 0000000000..9d23a2274a --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/f585cc.wgsl.expected.spvasm @@ -0,0 +1,107 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 61 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureGatherCompare_f585cc "textureGatherCompare_f585cc" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %arg_4 "arg_4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %20 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %27 = OpConstantNull %int + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %34 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 + %v2int = OpTypeVector %int 2 + %45 = OpConstantNull %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %48 = OpTypeFunction %v4float +%textureGatherCompare_f585cc = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %20 + %arg_3 = OpVariable %_ptr_Function_int Function %27 + %arg_4 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_2 %20 + OpStore %arg_3 %int_1 + OpStore %arg_4 %float_1 + %32 = OpLoad %14 %arg_1 + %33 = OpLoad %11 %arg_0 + %35 = OpSampledImage %34 %33 %32 + %37 = OpLoad %v2float %arg_2 + %38 = OpCompositeExtract %float %37 0 + %39 = OpCompositeExtract %float %37 1 + %41 = OpLoad %int %arg_3 + %40 = OpConvertSToF %float %41 + %42 = OpCompositeConstruct %v3float %38 %39 %40 + %43 = OpLoad %float %arg_4 + %31 = OpImageDrefGather %v4float %35 %42 %43 ConstOffset %45 + OpStore %res %31 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %48 + %50 = OpLabel + %51 = OpFunctionCall %void %textureGatherCompare_f585cc + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %53 = OpLabel + %54 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %54 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %56 = OpLabel + %57 = OpFunctionCall %void %textureGatherCompare_f585cc + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %59 = OpLabel + %60 = OpFunctionCall %void %textureGatherCompare_f585cc + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureGatherCompare/f585cc.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGatherCompare/f585cc.wgsl.expected.wgsl new file mode 100644 index 0000000000..6281ea00e5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/f585cc.wgsl.expected.wgsl @@ -0,0 +1,26 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d_array; + +@group(1) @binding(1) var arg_1 : sampler_comparison; + +fn textureGatherCompare_f585cc() { + var arg_2 = vec2(); + var arg_3 = 1; + var arg_4 = 1.0; + var res : vec4 = textureGatherCompare(arg_0, arg_1, arg_2, arg_3, arg_4, vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureGatherCompare_f585cc(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureGatherCompare_f585cc(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureGatherCompare_f585cc(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/19cf87.wgsl b/test/tint/builtins/gen/var/textureLoad/19cf87.wgsl new file mode 100644 index 0000000000..1f8fe73af5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/19cf87.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d; + +// fn textureLoad(texture: texture_depth_2d, coords: vec2, level: i32) -> f32 +fn textureLoad_19cf87() { + var arg_1 = vec2(); + var arg_2 = 0; + var res: f32 = textureLoad(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_19cf87(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureLoad_19cf87(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureLoad_19cf87(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/19cf87.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/19cf87.wgsl.expected.glsl new file mode 100644 index 0000000000..fb34ff94ec --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/19cf87.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +uniform highp sampler2D arg_0_1; +void textureLoad_19cf87() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 0; + float res = texelFetch(arg_0_1, arg_1, arg_2).x; +} + +vec4 vertex_main() { + textureLoad_19cf87(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2D arg_0_1; +void textureLoad_19cf87() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 0; + float res = texelFetch(arg_0_1, arg_1, arg_2).x; +} + +void fragment_main() { + textureLoad_19cf87(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2D arg_0_1; +void textureLoad_19cf87() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 0; + float res = texelFetch(arg_0_1, arg_1, arg_2).x; +} + +void compute_main() { + textureLoad_19cf87(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/19cf87.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureLoad/19cf87.wgsl.expected.hlsl new file mode 100644 index 0000000000..af201f2382 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/19cf87.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_0 : register(t0, space1); + +void textureLoad_19cf87() { + int2 arg_1 = (0).xx; + int arg_2 = 0; + float res = arg_0.Load(int3(arg_1, arg_2)).x; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_19cf87(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_19cf87(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_19cf87(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/19cf87.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/19cf87.wgsl.expected.msl new file mode 100644 index 0000000000..d8455913c5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/19cf87.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureLoad_19cf87(depth2d tint_symbol_1) { + int2 arg_1 = int2(0); + int arg_2 = 0; + float res = tint_symbol_1.read(uint2(arg_1), arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d tint_symbol_2) { + textureLoad_19cf87(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d tint_symbol_4 [[texture(0)]]) { + textureLoad_19cf87(tint_symbol_4); + return; +} + +kernel void compute_main(depth2d tint_symbol_5 [[texture(0)]]) { + textureLoad_19cf87(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureLoad/19cf87.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/19cf87.wgsl.expected.spvasm new file mode 100644 index 0000000000..62372885de --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/19cf87.wgsl.expected.spvasm @@ -0,0 +1,86 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureLoad_19cf87 "textureLoad_19cf87" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %18 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %21 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int +%_ptr_Function_float = OpTypePointer Function %float + %31 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureLoad_19cf87 = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %18 + %arg_2 = OpVariable %_ptr_Function_int Function %21 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_1 %18 + OpStore %arg_2 %21 + %26 = OpLoad %11 %arg_0 + %27 = OpLoad %v2int %arg_1 + %28 = OpLoad %int %arg_2 + %25 = OpImageFetch %v4float %26 %27 Lod %28 + %24 = OpCompositeExtract %float %25 0 + OpStore %res %24 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %31 + %33 = OpLabel + %34 = OpFunctionCall %void %textureLoad_19cf87 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %37 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %40 = OpLabel + %41 = OpFunctionCall %void %textureLoad_19cf87 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %43 = OpLabel + %44 = OpFunctionCall %void %textureLoad_19cf87 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureLoad/19cf87.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/19cf87.wgsl.expected.wgsl new file mode 100644 index 0000000000..86140df447 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/19cf87.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d; + +fn textureLoad_19cf87() { + var arg_1 = vec2(); + var arg_2 = 0; + var res : f32 = textureLoad(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_19cf87(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureLoad_19cf87(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureLoad_19cf87(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/1b8588.wgsl b/test/tint/builtins/gen/var/textureLoad/1b8588.wgsl new file mode 100644 index 0000000000..de34cc8fc6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/1b8588.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_1d; + +// fn textureLoad(texture: texture_1d, coords: i32, level: i32) -> vec4 +fn textureLoad_1b8588() { + var arg_1 = 1; + var arg_2 = 0; + var res: vec4 = textureLoad(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_1b8588(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureLoad_1b8588(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureLoad_1b8588(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/1b8588.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/1b8588.wgsl.expected.glsl new file mode 100644 index 0000000000..7a48c97905 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/1b8588.wgsl.expected.glsl @@ -0,0 +1,81 @@ +SKIP: FAILED + +#version 310 es + +uniform highp usampler1D arg_0_1; +void textureLoad_1b8588() { + int arg_1 = 1; + int arg_2 = 0; + uvec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +vec4 vertex_main() { + textureLoad_1b8588(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'usampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp usampler1D arg_0_1; +void textureLoad_1b8588() { + int arg_1 = 1; + int arg_2 = 0; + uvec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +void fragment_main() { + textureLoad_1b8588(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'usampler1D' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp usampler1D arg_0_1; +void textureLoad_1b8588() { + int arg_1 = 1; + int arg_2 = 0; + uvec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +void compute_main() { + textureLoad_1b8588(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'usampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureLoad/1b8588.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureLoad/1b8588.wgsl.expected.hlsl new file mode 100644 index 0000000000..8a7976a797 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/1b8588.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +Texture1D arg_0 : register(t0, space1); + +void textureLoad_1b8588() { + int arg_1 = 1; + int arg_2 = 0; + uint4 res = arg_0.Load(int2(arg_1, arg_2)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_1b8588(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_1b8588(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_1b8588(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/1b8588.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/1b8588.wgsl.expected.msl new file mode 100644 index 0000000000..ba0109281c --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/1b8588.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureLoad_1b8588(texture1d tint_symbol_1) { + int arg_1 = 1; + int arg_2 = 0; + uint4 res = tint_symbol_1.read(uint(arg_1), 0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureLoad_1b8588(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureLoad_1b8588(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureLoad_1b8588(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureLoad/1b8588.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/1b8588.wgsl.expected.spvasm new file mode 100644 index 0000000000..b68a825a44 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/1b8588.wgsl.expected.spvasm @@ -0,0 +1,87 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpCapability Sampled1D + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureLoad_1b8588 "textureLoad_1b8588" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 1D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %v4uint = OpTypeVector %uint 4 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %30 = OpConstantNull %v4uint + %31 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureLoad_1b8588 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %21 + %arg_2 = OpVariable %_ptr_Function_int Function %21 + %res = OpVariable %_ptr_Function_v4uint Function %30 + OpStore %arg_1 %int_1 + OpStore %arg_2 %21 + %25 = OpLoad %11 %arg_0 + %26 = OpLoad %int %arg_1 + %27 = OpLoad %int %arg_2 + %23 = OpImageFetch %v4uint %25 %26 Lod %27 + OpStore %res %23 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %31 + %33 = OpLabel + %34 = OpFunctionCall %void %textureLoad_1b8588 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %36 = OpLabel + %37 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %37 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %40 = OpLabel + %41 = OpFunctionCall %void %textureLoad_1b8588 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %43 = OpLabel + %44 = OpFunctionCall %void %textureLoad_1b8588 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureLoad/1b8588.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/1b8588.wgsl.expected.wgsl new file mode 100644 index 0000000000..5d581f2e17 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/1b8588.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_1d; + +fn textureLoad_1b8588() { + var arg_1 = 1; + var arg_2 = 0; + var res : vec4 = textureLoad(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_1b8588(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureLoad_1b8588(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureLoad_1b8588(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/1f2016.wgsl b/test/tint/builtins/gen/var/textureLoad/1f2016.wgsl new file mode 100644 index 0000000000..26e385b6fc --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/1f2016.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_3d; + +// fn textureLoad(texture: texture_3d, coords: vec3, level: i32) -> vec4 +fn textureLoad_1f2016() { + var arg_1 = vec3(); + var arg_2 = 0; + var res: vec4 = textureLoad(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_1f2016(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureLoad_1f2016(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureLoad_1f2016(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/1f2016.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/1f2016.wgsl.expected.glsl new file mode 100644 index 0000000000..4e6193ef7f --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/1f2016.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +uniform highp sampler3D arg_0_1; +void textureLoad_1f2016() { + ivec3 arg_1 = ivec3(0); + int arg_2 = 0; + vec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +vec4 vertex_main() { + textureLoad_1f2016(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler3D arg_0_1; +void textureLoad_1f2016() { + ivec3 arg_1 = ivec3(0); + int arg_2 = 0; + vec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +void fragment_main() { + textureLoad_1f2016(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler3D arg_0_1; +void textureLoad_1f2016() { + ivec3 arg_1 = ivec3(0); + int arg_2 = 0; + vec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +void compute_main() { + textureLoad_1f2016(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/1f2016.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureLoad/1f2016.wgsl.expected.hlsl new file mode 100644 index 0000000000..9a90498483 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/1f2016.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +Texture3D arg_0 : register(t0, space1); + +void textureLoad_1f2016() { + int3 arg_1 = (0).xxx; + int arg_2 = 0; + float4 res = arg_0.Load(int4(arg_1, arg_2)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_1f2016(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_1f2016(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_1f2016(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/1f2016.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/1f2016.wgsl.expected.msl new file mode 100644 index 0000000000..843d5a49dc --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/1f2016.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureLoad_1f2016(texture3d tint_symbol_1) { + int3 arg_1 = int3(0); + int arg_2 = 0; + float4 res = tint_symbol_1.read(uint3(arg_1), arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureLoad_1f2016(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureLoad_1f2016(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureLoad_1f2016(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureLoad/1f2016.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/1f2016.wgsl.expected.spvasm new file mode 100644 index 0000000000..d3bd5ef3c7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/1f2016.wgsl.expected.spvasm @@ -0,0 +1,85 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureLoad_1f2016 "textureLoad_1f2016" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 3D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %18 = OpConstantNull %v3int +%_ptr_Function_v3int = OpTypePointer Function %v3int + %21 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %30 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureLoad_1f2016 = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v3int Function %18 + %arg_2 = OpVariable %_ptr_Function_int Function %21 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_1 %18 + OpStore %arg_2 %21 + %25 = OpLoad %11 %arg_0 + %26 = OpLoad %v3int %arg_1 + %27 = OpLoad %int %arg_2 + %24 = OpImageFetch %v4float %25 %26 Lod %27 + OpStore %res %24 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %textureLoad_1f2016 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %35 = OpLabel + %36 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %36 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %39 = OpLabel + %40 = OpFunctionCall %void %textureLoad_1f2016 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %42 = OpLabel + %43 = OpFunctionCall %void %textureLoad_1f2016 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureLoad/1f2016.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/1f2016.wgsl.expected.wgsl new file mode 100644 index 0000000000..75576c8214 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/1f2016.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_3d; + +fn textureLoad_1f2016() { + var arg_1 = vec3(); + var arg_2 = 0; + var res : vec4 = textureLoad(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_1f2016(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureLoad_1f2016(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureLoad_1f2016(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/484344.wgsl b/test/tint/builtins/gen/var/textureLoad/484344.wgsl new file mode 100644 index 0000000000..3d7622853e --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/484344.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d; + +// fn textureLoad(texture: texture_2d, coords: vec2, level: i32) -> vec4 +fn textureLoad_484344() { + var arg_1 = vec2(); + var arg_2 = 0; + var res: vec4 = textureLoad(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_484344(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureLoad_484344(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureLoad_484344(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/484344.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/484344.wgsl.expected.glsl new file mode 100644 index 0000000000..437375735a --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/484344.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +uniform highp sampler2D arg_0_1; +void textureLoad_484344() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 0; + vec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +vec4 vertex_main() { + textureLoad_484344(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2D arg_0_1; +void textureLoad_484344() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 0; + vec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +void fragment_main() { + textureLoad_484344(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2D arg_0_1; +void textureLoad_484344() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 0; + vec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +void compute_main() { + textureLoad_484344(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/484344.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureLoad/484344.wgsl.expected.hlsl new file mode 100644 index 0000000000..26f5c566d9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/484344.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_0 : register(t0, space1); + +void textureLoad_484344() { + int2 arg_1 = (0).xx; + int arg_2 = 0; + float4 res = arg_0.Load(int3(arg_1, arg_2)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_484344(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_484344(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_484344(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/484344.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/484344.wgsl.expected.msl new file mode 100644 index 0000000000..cc878b2e12 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/484344.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureLoad_484344(texture2d tint_symbol_1) { + int2 arg_1 = int2(0); + int arg_2 = 0; + float4 res = tint_symbol_1.read(uint2(arg_1), arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureLoad_484344(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureLoad_484344(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureLoad_484344(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureLoad/484344.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/484344.wgsl.expected.spvasm new file mode 100644 index 0000000000..f1c45187a3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/484344.wgsl.expected.spvasm @@ -0,0 +1,85 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureLoad_484344 "textureLoad_484344" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %18 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %21 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %30 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureLoad_484344 = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %18 + %arg_2 = OpVariable %_ptr_Function_int Function %21 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_1 %18 + OpStore %arg_2 %21 + %25 = OpLoad %11 %arg_0 + %26 = OpLoad %v2int %arg_1 + %27 = OpLoad %int %arg_2 + %24 = OpImageFetch %v4float %25 %26 Lod %27 + OpStore %res %24 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %textureLoad_484344 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %35 = OpLabel + %36 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %36 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %39 = OpLabel + %40 = OpFunctionCall %void %textureLoad_484344 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %42 = OpLabel + %43 = OpFunctionCall %void %textureLoad_484344 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureLoad/484344.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/484344.wgsl.expected.wgsl new file mode 100644 index 0000000000..e8b9067f96 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/484344.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_2d; + +fn textureLoad_484344() { + var arg_1 = vec2(); + var arg_2 = 0; + var res : vec4 = textureLoad(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_484344(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureLoad_484344(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureLoad_484344(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/4fd803.wgsl b/test/tint/builtins/gen/var/textureLoad/4fd803.wgsl new file mode 100644 index 0000000000..feb2dd260b --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/4fd803.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_3d; + +// fn textureLoad(texture: texture_3d, coords: vec3, level: i32) -> vec4 +fn textureLoad_4fd803() { + var arg_1 = vec3(); + var arg_2 = 0; + var res: vec4 = textureLoad(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_4fd803(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureLoad_4fd803(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureLoad_4fd803(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/4fd803.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/4fd803.wgsl.expected.glsl new file mode 100644 index 0000000000..d0ac1aba0d --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/4fd803.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +uniform highp isampler3D arg_0_1; +void textureLoad_4fd803() { + ivec3 arg_1 = ivec3(0); + int arg_2 = 0; + ivec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +vec4 vertex_main() { + textureLoad_4fd803(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp isampler3D arg_0_1; +void textureLoad_4fd803() { + ivec3 arg_1 = ivec3(0); + int arg_2 = 0; + ivec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +void fragment_main() { + textureLoad_4fd803(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp isampler3D arg_0_1; +void textureLoad_4fd803() { + ivec3 arg_1 = ivec3(0); + int arg_2 = 0; + ivec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +void compute_main() { + textureLoad_4fd803(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/4fd803.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureLoad/4fd803.wgsl.expected.hlsl new file mode 100644 index 0000000000..62f5574e15 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/4fd803.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +Texture3D arg_0 : register(t0, space1); + +void textureLoad_4fd803() { + int3 arg_1 = (0).xxx; + int arg_2 = 0; + int4 res = arg_0.Load(int4(arg_1, arg_2)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_4fd803(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_4fd803(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_4fd803(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/4fd803.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/4fd803.wgsl.expected.msl new file mode 100644 index 0000000000..0b3b14432a --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/4fd803.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureLoad_4fd803(texture3d tint_symbol_1) { + int3 arg_1 = int3(0); + int arg_2 = 0; + int4 res = tint_symbol_1.read(uint3(arg_1), arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureLoad_4fd803(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureLoad_4fd803(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureLoad_4fd803(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureLoad/4fd803.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/4fd803.wgsl.expected.spvasm new file mode 100644 index 0000000000..003f85d191 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/4fd803.wgsl.expected.spvasm @@ -0,0 +1,87 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 46 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureLoad_4fd803 "textureLoad_4fd803" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 3D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v3int = OpTypeVector %int 3 + %18 = OpConstantNull %v3int +%_ptr_Function_v3int = OpTypePointer Function %v3int + %21 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %v4int = OpTypeVector %int 4 +%_ptr_Function_v4int = OpTypePointer Function %v4int + %31 = OpConstantNull %v4int + %32 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureLoad_4fd803 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v3int Function %18 + %arg_2 = OpVariable %_ptr_Function_int Function %21 + %res = OpVariable %_ptr_Function_v4int Function %31 + OpStore %arg_1 %18 + OpStore %arg_2 %21 + %26 = OpLoad %11 %arg_0 + %27 = OpLoad %v3int %arg_1 + %28 = OpLoad %int %arg_2 + %24 = OpImageFetch %v4int %26 %27 Lod %28 + OpStore %res %24 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %32 + %34 = OpLabel + %35 = OpFunctionCall %void %textureLoad_4fd803 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %37 = OpLabel + %38 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %38 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %41 = OpLabel + %42 = OpFunctionCall %void %textureLoad_4fd803 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %44 = OpLabel + %45 = OpFunctionCall %void %textureLoad_4fd803 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureLoad/4fd803.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/4fd803.wgsl.expected.wgsl new file mode 100644 index 0000000000..b6c2086adb --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/4fd803.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_3d; + +fn textureLoad_4fd803() { + var arg_1 = vec3(); + var arg_2 = 0; + var res : vec4 = textureLoad(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_4fd803(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureLoad_4fd803(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureLoad_4fd803(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/5a2f9d.wgsl b/test/tint/builtins/gen/var/textureLoad/5a2f9d.wgsl new file mode 100644 index 0000000000..70e70e409f --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/5a2f9d.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_1d; + +// fn textureLoad(texture: texture_1d, coords: i32, level: i32) -> vec4 +fn textureLoad_5a2f9d() { + var arg_1 = 1; + var arg_2 = 0; + var res: vec4 = textureLoad(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_5a2f9d(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureLoad_5a2f9d(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureLoad_5a2f9d(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/5a2f9d.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/5a2f9d.wgsl.expected.glsl new file mode 100644 index 0000000000..4c2d0e6e5c --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/5a2f9d.wgsl.expected.glsl @@ -0,0 +1,81 @@ +SKIP: FAILED + +#version 310 es + +uniform highp isampler1D arg_0_1; +void textureLoad_5a2f9d() { + int arg_1 = 1; + int arg_2 = 0; + ivec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +vec4 vertex_main() { + textureLoad_5a2f9d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'isampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp isampler1D arg_0_1; +void textureLoad_5a2f9d() { + int arg_1 = 1; + int arg_2 = 0; + ivec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +void fragment_main() { + textureLoad_5a2f9d(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'isampler1D' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp isampler1D arg_0_1; +void textureLoad_5a2f9d() { + int arg_1 = 1; + int arg_2 = 0; + ivec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +void compute_main() { + textureLoad_5a2f9d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'isampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureLoad/5a2f9d.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureLoad/5a2f9d.wgsl.expected.hlsl new file mode 100644 index 0000000000..6560358766 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/5a2f9d.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +Texture1D arg_0 : register(t0, space1); + +void textureLoad_5a2f9d() { + int arg_1 = 1; + int arg_2 = 0; + int4 res = arg_0.Load(int2(arg_1, arg_2)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_5a2f9d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_5a2f9d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_5a2f9d(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/5a2f9d.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/5a2f9d.wgsl.expected.msl new file mode 100644 index 0000000000..f2f8860f96 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/5a2f9d.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureLoad_5a2f9d(texture1d tint_symbol_1) { + int arg_1 = 1; + int arg_2 = 0; + int4 res = tint_symbol_1.read(uint(arg_1), 0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureLoad_5a2f9d(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureLoad_5a2f9d(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureLoad_5a2f9d(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureLoad/5a2f9d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/5a2f9d.wgsl.expected.spvasm new file mode 100644 index 0000000000..f4ceb92563 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/5a2f9d.wgsl.expected.spvasm @@ -0,0 +1,86 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpCapability Sampled1D + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureLoad_5a2f9d "textureLoad_5a2f9d" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 1D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %20 = OpConstantNull %int + %v4int = OpTypeVector %int 4 +%_ptr_Function_v4int = OpTypePointer Function %v4int + %29 = OpConstantNull %v4int + %30 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureLoad_5a2f9d = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %20 + %arg_2 = OpVariable %_ptr_Function_int Function %20 + %res = OpVariable %_ptr_Function_v4int Function %29 + OpStore %arg_1 %int_1 + OpStore %arg_2 %20 + %24 = OpLoad %11 %arg_0 + %25 = OpLoad %int %arg_1 + %26 = OpLoad %int %arg_2 + %22 = OpImageFetch %v4int %24 %25 Lod %26 + OpStore %res %22 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %textureLoad_5a2f9d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %36 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %39 = OpLabel + %40 = OpFunctionCall %void %textureLoad_5a2f9d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %42 = OpLabel + %43 = OpFunctionCall %void %textureLoad_5a2f9d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureLoad/5a2f9d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/5a2f9d.wgsl.expected.wgsl new file mode 100644 index 0000000000..c78620ef9d --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/5a2f9d.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_1d; + +fn textureLoad_5a2f9d() { + var arg_1 = 1; + var arg_2 = 0; + var res : vec4 = textureLoad(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_5a2f9d(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureLoad_5a2f9d(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureLoad_5a2f9d(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/6154d4.wgsl b/test/tint/builtins/gen/var/textureLoad/6154d4.wgsl new file mode 100644 index 0000000000..a165d74508 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/6154d4.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d; + +// fn textureLoad(texture: texture_2d, coords: vec2, level: i32) -> vec4 +fn textureLoad_6154d4() { + var arg_1 = vec2(); + var arg_2 = 0; + var res: vec4 = textureLoad(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_6154d4(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureLoad_6154d4(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureLoad_6154d4(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/6154d4.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/6154d4.wgsl.expected.glsl new file mode 100644 index 0000000000..5fe0e2b19a --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/6154d4.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +uniform highp usampler2D arg_0_1; +void textureLoad_6154d4() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 0; + uvec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +vec4 vertex_main() { + textureLoad_6154d4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp usampler2D arg_0_1; +void textureLoad_6154d4() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 0; + uvec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +void fragment_main() { + textureLoad_6154d4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp usampler2D arg_0_1; +void textureLoad_6154d4() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 0; + uvec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +void compute_main() { + textureLoad_6154d4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/6154d4.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureLoad/6154d4.wgsl.expected.hlsl new file mode 100644 index 0000000000..38bda4923b --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/6154d4.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_0 : register(t0, space1); + +void textureLoad_6154d4() { + int2 arg_1 = (0).xx; + int arg_2 = 0; + uint4 res = arg_0.Load(int3(arg_1, arg_2)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_6154d4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_6154d4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_6154d4(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/6154d4.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/6154d4.wgsl.expected.msl new file mode 100644 index 0000000000..ab70ff6a7f --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/6154d4.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureLoad_6154d4(texture2d tint_symbol_1) { + int2 arg_1 = int2(0); + int arg_2 = 0; + uint4 res = tint_symbol_1.read(uint2(arg_1), arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureLoad_6154d4(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureLoad_6154d4(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureLoad_6154d4(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureLoad/6154d4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/6154d4.wgsl.expected.spvasm new file mode 100644 index 0000000000..e670096868 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/6154d4.wgsl.expected.spvasm @@ -0,0 +1,88 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureLoad_6154d4 "textureLoad_6154d4" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %19 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %22 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %v4uint = OpTypeVector %uint 4 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %32 = OpConstantNull %v4uint + %33 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureLoad_6154d4 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %19 + %arg_2 = OpVariable %_ptr_Function_int Function %22 + %res = OpVariable %_ptr_Function_v4uint Function %32 + OpStore %arg_1 %19 + OpStore %arg_2 %22 + %27 = OpLoad %11 %arg_0 + %28 = OpLoad %v2int %arg_1 + %29 = OpLoad %int %arg_2 + %25 = OpImageFetch %v4uint %27 %28 Lod %29 + OpStore %res %25 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %33 + %35 = OpLabel + %36 = OpFunctionCall %void %textureLoad_6154d4 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %38 = OpLabel + %39 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %39 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %42 = OpLabel + %43 = OpFunctionCall %void %textureLoad_6154d4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %45 = OpLabel + %46 = OpFunctionCall %void %textureLoad_6154d4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureLoad/6154d4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/6154d4.wgsl.expected.wgsl new file mode 100644 index 0000000000..f58a9da230 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/6154d4.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_2d; + +fn textureLoad_6154d4() { + var arg_1 = vec2(); + var arg_2 = 0; + var res : vec4 = textureLoad(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_6154d4(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureLoad_6154d4(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureLoad_6154d4(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/6273b1.wgsl b/test/tint/builtins/gen/var/textureLoad/6273b1.wgsl new file mode 100644 index 0000000000..5d6029c557 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/6273b1.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_multisampled_2d; + +// fn textureLoad(texture: texture_depth_multisampled_2d, coords: vec2, sample_index: i32) -> f32 +fn textureLoad_6273b1() { + var arg_1 = vec2(); + var arg_2 = 1; + var res: f32 = textureLoad(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_6273b1(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureLoad_6273b1(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureLoad_6273b1(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/6273b1.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/6273b1.wgsl.expected.glsl new file mode 100644 index 0000000000..ae0115fb00 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/6273b1.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +uniform highp sampler2DMS arg_0_1; +void textureLoad_6273b1() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + float res = texelFetch(arg_0_1, arg_1, arg_2).x; +} + +vec4 vertex_main() { + textureLoad_6273b1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DMS arg_0_1; +void textureLoad_6273b1() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + float res = texelFetch(arg_0_1, arg_1, arg_2).x; +} + +void fragment_main() { + textureLoad_6273b1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DMS arg_0_1; +void textureLoad_6273b1() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + float res = texelFetch(arg_0_1, arg_1, arg_2).x; +} + +void compute_main() { + textureLoad_6273b1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/6273b1.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureLoad/6273b1.wgsl.expected.hlsl new file mode 100644 index 0000000000..b05e1bbdd4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/6273b1.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +Texture2DMS arg_0 : register(t0, space1); + +void textureLoad_6273b1() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + float res = arg_0.Load(int3(arg_1, 0), arg_2).x; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_6273b1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_6273b1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_6273b1(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/6273b1.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/6273b1.wgsl.expected.msl new file mode 100644 index 0000000000..05fb393457 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/6273b1.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureLoad_6273b1(depth2d_ms tint_symbol_1) { + int2 arg_1 = int2(0); + int arg_2 = 1; + float res = tint_symbol_1.read(uint2(arg_1), arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d_ms tint_symbol_2) { + textureLoad_6273b1(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d_ms tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d_ms tint_symbol_4 [[texture(0)]]) { + textureLoad_6273b1(tint_symbol_4); + return; +} + +kernel void compute_main(depth2d_ms tint_symbol_5 [[texture(0)]]) { + textureLoad_6273b1(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureLoad/6273b1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/6273b1.wgsl.expected.spvasm new file mode 100644 index 0000000000..4ed02fb712 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/6273b1.wgsl.expected.spvasm @@ -0,0 +1,87 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 46 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureLoad_6273b1 "textureLoad_6273b1" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 1 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %18 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int +%_ptr_Function_float = OpTypePointer Function %float + %32 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureLoad_6273b1 = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %18 + %arg_2 = OpVariable %_ptr_Function_int Function %24 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_1 %18 + OpStore %arg_2 %int_1 + %27 = OpLoad %11 %arg_0 + %28 = OpLoad %v2int %arg_1 + %29 = OpLoad %int %arg_2 + %26 = OpImageFetch %v4float %27 %28 Sample %29 + %25 = OpCompositeExtract %float %26 0 + OpStore %res %25 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %32 + %34 = OpLabel + %35 = OpFunctionCall %void %textureLoad_6273b1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %37 = OpLabel + %38 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %38 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %41 = OpLabel + %42 = OpFunctionCall %void %textureLoad_6273b1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %44 = OpLabel + %45 = OpFunctionCall %void %textureLoad_6273b1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureLoad/6273b1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/6273b1.wgsl.expected.wgsl new file mode 100644 index 0000000000..98a60a0219 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/6273b1.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_depth_multisampled_2d; + +fn textureLoad_6273b1() { + var arg_1 = vec2(); + var arg_2 = 1; + var res : f32 = textureLoad(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_6273b1(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureLoad_6273b1(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureLoad_6273b1(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/79e697.wgsl b/test/tint/builtins/gen/var/textureLoad/79e697.wgsl new file mode 100644 index 0000000000..555abca6bb --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/79e697.wgsl @@ -0,0 +1,49 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; + +// fn textureLoad(texture: texture_2d_array, coords: vec2, array_index: i32, level: i32) -> vec4 +fn textureLoad_79e697() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = 0; + var res: vec4 = textureLoad(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_79e697(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureLoad_79e697(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureLoad_79e697(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/79e697.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/79e697.wgsl.expected.glsl new file mode 100644 index 0000000000..2ddb0881e0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/79e697.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +uniform highp isampler2DArray arg_0_1; +void textureLoad_79e697() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + int arg_3 = 0; + ivec4 res = texelFetch(arg_0_1, ivec3(arg_1, arg_2), arg_3); +} + +vec4 vertex_main() { + textureLoad_79e697(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp isampler2DArray arg_0_1; +void textureLoad_79e697() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + int arg_3 = 0; + ivec4 res = texelFetch(arg_0_1, ivec3(arg_1, arg_2), arg_3); +} + +void fragment_main() { + textureLoad_79e697(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp isampler2DArray arg_0_1; +void textureLoad_79e697() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + int arg_3 = 0; + ivec4 res = texelFetch(arg_0_1, ivec3(arg_1, arg_2), arg_3); +} + +void compute_main() { + textureLoad_79e697(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/79e697.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureLoad/79e697.wgsl.expected.hlsl new file mode 100644 index 0000000000..058dfb24b4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/79e697.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureLoad_79e697() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + int arg_3 = 0; + int4 res = arg_0.Load(int4(int3(arg_1, arg_2), arg_3)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_79e697(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_79e697(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_79e697(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/79e697.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/79e697.wgsl.expected.msl new file mode 100644 index 0000000000..b2e557e911 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/79e697.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureLoad_79e697(texture2d_array tint_symbol_1) { + int2 arg_1 = int2(0); + int arg_2 = 1; + int arg_3 = 0; + int4 res = tint_symbol_1.read(uint2(arg_1), arg_2, arg_3); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureLoad_79e697(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureLoad_79e697(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureLoad_79e697(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureLoad/79e697.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/79e697.wgsl.expected.spvasm new file mode 100644 index 0000000000..ccc82966e9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/79e697.wgsl.expected.spvasm @@ -0,0 +1,96 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 53 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureLoad_79e697 "textureLoad_79e697" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v2int = OpTypeVector %int 2 + %18 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int + %v4int = OpTypeVector %int 4 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v4int = OpTypePointer Function %v4int + %38 = OpConstantNull %v4int + %39 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureLoad_79e697 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %18 + %arg_2 = OpVariable %_ptr_Function_int Function %24 + %arg_3 = OpVariable %_ptr_Function_int Function %24 + %res = OpVariable %_ptr_Function_v4int Function %38 + OpStore %arg_1 %18 + OpStore %arg_2 %int_1 + OpStore %arg_3 %24 + %28 = OpLoad %11 %arg_0 + %30 = OpLoad %v2int %arg_1 + %31 = OpCompositeExtract %int %30 0 + %32 = OpCompositeExtract %int %30 1 + %33 = OpLoad %int %arg_2 + %34 = OpCompositeConstruct %v3int %31 %32 %33 + %35 = OpLoad %int %arg_3 + %26 = OpImageFetch %v4int %28 %34 Lod %35 + OpStore %res %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %39 + %41 = OpLabel + %42 = OpFunctionCall %void %textureLoad_79e697 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %44 = OpLabel + %45 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %45 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %48 = OpLabel + %49 = OpFunctionCall %void %textureLoad_79e697 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %51 = OpLabel + %52 = OpFunctionCall %void %textureLoad_79e697 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureLoad/79e697.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/79e697.wgsl.expected.wgsl new file mode 100644 index 0000000000..4ab97b8b43 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/79e697.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +fn textureLoad_79e697() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = 0; + var res : vec4 = textureLoad(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_79e697(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureLoad_79e697(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureLoad_79e697(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/7c90e5.wgsl b/test/tint/builtins/gen/var/textureLoad/7c90e5.wgsl new file mode 100644 index 0000000000..e6ae43375e --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/7c90e5.wgsl @@ -0,0 +1,49 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; + +// fn textureLoad(texture: texture_2d_array, coords: vec2, array_index: i32, level: i32) -> vec4 +fn textureLoad_7c90e5() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = 0; + var res: vec4 = textureLoad(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_7c90e5(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureLoad_7c90e5(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureLoad_7c90e5(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/7c90e5.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/7c90e5.wgsl.expected.glsl new file mode 100644 index 0000000000..8777502719 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/7c90e5.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +uniform highp usampler2DArray arg_0_1; +void textureLoad_7c90e5() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + int arg_3 = 0; + uvec4 res = texelFetch(arg_0_1, ivec3(arg_1, arg_2), arg_3); +} + +vec4 vertex_main() { + textureLoad_7c90e5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp usampler2DArray arg_0_1; +void textureLoad_7c90e5() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + int arg_3 = 0; + uvec4 res = texelFetch(arg_0_1, ivec3(arg_1, arg_2), arg_3); +} + +void fragment_main() { + textureLoad_7c90e5(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp usampler2DArray arg_0_1; +void textureLoad_7c90e5() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + int arg_3 = 0; + uvec4 res = texelFetch(arg_0_1, ivec3(arg_1, arg_2), arg_3); +} + +void compute_main() { + textureLoad_7c90e5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/7c90e5.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureLoad/7c90e5.wgsl.expected.hlsl new file mode 100644 index 0000000000..eac35c3ca4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/7c90e5.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureLoad_7c90e5() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + int arg_3 = 0; + uint4 res = arg_0.Load(int4(int3(arg_1, arg_2), arg_3)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_7c90e5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_7c90e5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_7c90e5(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/7c90e5.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/7c90e5.wgsl.expected.msl new file mode 100644 index 0000000000..12ab5a86b7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/7c90e5.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureLoad_7c90e5(texture2d_array tint_symbol_1) { + int2 arg_1 = int2(0); + int arg_2 = 1; + int arg_3 = 0; + uint4 res = tint_symbol_1.read(uint2(arg_1), arg_2, arg_3); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureLoad_7c90e5(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureLoad_7c90e5(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureLoad_7c90e5(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureLoad/7c90e5.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/7c90e5.wgsl.expected.spvasm new file mode 100644 index 0000000000..d0e8a8dd18 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/7c90e5.wgsl.expected.spvasm @@ -0,0 +1,97 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 54 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureLoad_7c90e5 "textureLoad_7c90e5" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %19 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %25 = OpConstantNull %int + %v4uint = OpTypeVector %uint 4 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %39 = OpConstantNull %v4uint + %40 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureLoad_7c90e5 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %19 + %arg_2 = OpVariable %_ptr_Function_int Function %25 + %arg_3 = OpVariable %_ptr_Function_int Function %25 + %res = OpVariable %_ptr_Function_v4uint Function %39 + OpStore %arg_1 %19 + OpStore %arg_2 %int_1 + OpStore %arg_3 %25 + %29 = OpLoad %11 %arg_0 + %31 = OpLoad %v2int %arg_1 + %32 = OpCompositeExtract %int %31 0 + %33 = OpCompositeExtract %int %31 1 + %34 = OpLoad %int %arg_2 + %35 = OpCompositeConstruct %v3int %32 %33 %34 + %36 = OpLoad %int %arg_3 + %27 = OpImageFetch %v4uint %29 %35 Lod %36 + OpStore %res %27 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %40 + %42 = OpLabel + %43 = OpFunctionCall %void %textureLoad_7c90e5 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %45 = OpLabel + %46 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %46 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %49 = OpLabel + %50 = OpFunctionCall %void %textureLoad_7c90e5 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %52 = OpLabel + %53 = OpFunctionCall %void %textureLoad_7c90e5 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureLoad/7c90e5.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/7c90e5.wgsl.expected.wgsl new file mode 100644 index 0000000000..f6852e1d75 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/7c90e5.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +fn textureLoad_7c90e5() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = 0; + var res : vec4 = textureLoad(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_7c90e5(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureLoad_7c90e5(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureLoad_7c90e5(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/81c381.wgsl b/test/tint/builtins/gen/var/textureLoad/81c381.wgsl new file mode 100644 index 0000000000..45d48d4a14 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/81c381.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_1d; + +// fn textureLoad(texture: texture_1d, coords: i32, level: i32) -> vec4 +fn textureLoad_81c381() { + var arg_1 = 1; + var arg_2 = 0; + var res: vec4 = textureLoad(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_81c381(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureLoad_81c381(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureLoad_81c381(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/81c381.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/81c381.wgsl.expected.glsl new file mode 100644 index 0000000000..33ebb737cd --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/81c381.wgsl.expected.glsl @@ -0,0 +1,81 @@ +SKIP: FAILED + +#version 310 es + +uniform highp sampler1D arg_0_1; +void textureLoad_81c381() { + int arg_1 = 1; + int arg_2 = 0; + vec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +vec4 vertex_main() { + textureLoad_81c381(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'sampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp sampler1D arg_0_1; +void textureLoad_81c381() { + int arg_1 = 1; + int arg_2 = 0; + vec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +void fragment_main() { + textureLoad_81c381(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'sampler1D' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp sampler1D arg_0_1; +void textureLoad_81c381() { + int arg_1 = 1; + int arg_2 = 0; + vec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +void compute_main() { + textureLoad_81c381(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'sampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureLoad/81c381.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureLoad/81c381.wgsl.expected.hlsl new file mode 100644 index 0000000000..f125cbe389 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/81c381.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +Texture1D arg_0 : register(t0, space1); + +void textureLoad_81c381() { + int arg_1 = 1; + int arg_2 = 0; + float4 res = arg_0.Load(int2(arg_1, arg_2)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_81c381(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_81c381(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_81c381(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/81c381.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/81c381.wgsl.expected.msl new file mode 100644 index 0000000000..96b31841cf --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/81c381.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureLoad_81c381(texture1d tint_symbol_1) { + int arg_1 = 1; + int arg_2 = 0; + float4 res = tint_symbol_1.read(uint(arg_1), 0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureLoad_81c381(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureLoad_81c381(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureLoad_81c381(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureLoad/81c381.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/81c381.wgsl.expected.spvasm new file mode 100644 index 0000000000..d4d8ae6ee7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/81c381.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 42 +; Schema: 0 + OpCapability Shader + OpCapability Sampled1D + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureLoad_81c381 "textureLoad_81c381" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 1D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %20 = OpConstantNull %int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %28 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureLoad_81c381 = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %20 + %arg_2 = OpVariable %_ptr_Function_int Function %20 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_1 %int_1 + OpStore %arg_2 %20 + %23 = OpLoad %11 %arg_0 + %24 = OpLoad %int %arg_1 + %25 = OpLoad %int %arg_2 + %22 = OpImageFetch %v4float %23 %24 Lod %25 + OpStore %res %22 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %28 + %30 = OpLabel + %31 = OpFunctionCall %void %textureLoad_81c381 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %33 = OpLabel + %34 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %34 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %37 = OpLabel + %38 = OpFunctionCall %void %textureLoad_81c381 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %40 = OpLabel + %41 = OpFunctionCall %void %textureLoad_81c381 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureLoad/81c381.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/81c381.wgsl.expected.wgsl new file mode 100644 index 0000000000..3ada1acff1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/81c381.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_1d; + +fn textureLoad_81c381() { + var arg_1 = 1; + var arg_2 = 0; + var res : vec4 = textureLoad(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_81c381(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureLoad_81c381(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureLoad_81c381(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/87be85.wgsl b/test/tint/builtins/gen/var/textureLoad/87be85.wgsl new file mode 100644 index 0000000000..a32ef3901c --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/87be85.wgsl @@ -0,0 +1,49 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; + +// fn textureLoad(texture: texture_2d_array, coords: vec2, array_index: i32, level: i32) -> vec4 +fn textureLoad_87be85() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = 0; + var res: vec4 = textureLoad(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_87be85(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureLoad_87be85(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureLoad_87be85(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/87be85.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/87be85.wgsl.expected.glsl new file mode 100644 index 0000000000..d7e3830703 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/87be85.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +uniform highp sampler2DArray arg_0_1; +void textureLoad_87be85() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + int arg_3 = 0; + vec4 res = texelFetch(arg_0_1, ivec3(arg_1, arg_2), arg_3); +} + +vec4 vertex_main() { + textureLoad_87be85(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DArray arg_0_1; +void textureLoad_87be85() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + int arg_3 = 0; + vec4 res = texelFetch(arg_0_1, ivec3(arg_1, arg_2), arg_3); +} + +void fragment_main() { + textureLoad_87be85(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DArray arg_0_1; +void textureLoad_87be85() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + int arg_3 = 0; + vec4 res = texelFetch(arg_0_1, ivec3(arg_1, arg_2), arg_3); +} + +void compute_main() { + textureLoad_87be85(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/87be85.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureLoad/87be85.wgsl.expected.hlsl new file mode 100644 index 0000000000..b22cbff7a8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/87be85.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureLoad_87be85() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + int arg_3 = 0; + float4 res = arg_0.Load(int4(int3(arg_1, arg_2), arg_3)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_87be85(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_87be85(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_87be85(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/87be85.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/87be85.wgsl.expected.msl new file mode 100644 index 0000000000..fd2e590093 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/87be85.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureLoad_87be85(texture2d_array tint_symbol_1) { + int2 arg_1 = int2(0); + int arg_2 = 1; + int arg_3 = 0; + float4 res = tint_symbol_1.read(uint2(arg_1), arg_2, arg_3); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureLoad_87be85(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureLoad_87be85(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureLoad_87be85(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureLoad/87be85.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/87be85.wgsl.expected.spvasm new file mode 100644 index 0000000000..4894eba84b --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/87be85.wgsl.expected.spvasm @@ -0,0 +1,94 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 51 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureLoad_87be85 "textureLoad_87be85" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %18 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int + %v3int = OpTypeVector %int 3 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %37 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureLoad_87be85 = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %18 + %arg_2 = OpVariable %_ptr_Function_int Function %24 + %arg_3 = OpVariable %_ptr_Function_int Function %24 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_1 %18 + OpStore %arg_2 %int_1 + OpStore %arg_3 %24 + %27 = OpLoad %11 %arg_0 + %29 = OpLoad %v2int %arg_1 + %30 = OpCompositeExtract %int %29 0 + %31 = OpCompositeExtract %int %29 1 + %32 = OpLoad %int %arg_2 + %33 = OpCompositeConstruct %v3int %30 %31 %32 + %34 = OpLoad %int %arg_3 + %26 = OpImageFetch %v4float %27 %33 Lod %34 + OpStore %res %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %37 + %39 = OpLabel + %40 = OpFunctionCall %void %textureLoad_87be85 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %42 = OpLabel + %43 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %43 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %46 = OpLabel + %47 = OpFunctionCall %void %textureLoad_87be85 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %49 = OpLabel + %50 = OpFunctionCall %void %textureLoad_87be85 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureLoad/87be85.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/87be85.wgsl.expected.wgsl new file mode 100644 index 0000000000..a033a61265 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/87be85.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +fn textureLoad_87be85() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = 0; + var res : vec4 = textureLoad(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_87be85(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureLoad_87be85(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureLoad_87be85(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl b/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl new file mode 100644 index 0000000000..1f98b4d3a7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_external; + +// fn textureLoad(texture: texture_external, coords: vec2) -> vec4 +fn textureLoad_8acf41() { + var arg_1 = vec2(); + var res: vec4 = textureLoad(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_8acf41(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureLoad_8acf41(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureLoad_8acf41(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.glsl new file mode 100644 index 0000000000..5f0b29c7a6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.glsl @@ -0,0 +1,225 @@ +SKIP: FAILED + +#version 310 es + +struct GammaTransferParams { + float G; + float A; + float B; + float C; + float D; + float E; + float F; + uint padding; +}; + +struct ExternalTextureParams { + uint numPlanes; + mat3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + mat3 gamutConversionMatrix; +}; + +layout(binding = 2) uniform ExternalTextureParams_1 { + uint numPlanes; + mat3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + mat3 gamutConversionMatrix; +} ext_tex_params; + +vec3 gammaCorrection(vec3 v, GammaTransferParams params) { + bvec3 cond = lessThan(abs(v), vec3(params.D)); + vec3 t = (sign(v) * ((params.C * abs(v)) + params.F)); + vec3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), vec3(params.G)) + params.E)); + return mix(f, t, cond); +} + +vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, ivec2 coord, ExternalTextureParams params) { + vec3 color = vec3(0.0f, 0.0f, 0.0f); + if ((params.numPlanes == 1u)) { + color = texelFetch(plane0_1, coord, 0).rgb; + } else { + color = (vec4(texelFetch(plane0_1, coord, 0).r, texelFetch(plane1_1, coord, 0).rg, 1.0f) * params.yuvToRgbConversionMatrix); + } + color = gammaCorrection(color, params.gammaDecodeParams); + color = (params.gamutConversionMatrix * color); + color = gammaCorrection(color, params.gammaEncodeParams); + return vec4(color, 1.0f); +} + +uniform highp sampler2D arg_0_1; +uniform highp sampler2D ext_tex_plane_1_1; +void textureLoad_8acf41() { + ivec2 arg_1 = ivec2(0); + vec4 res = textureLoadExternal(arg_0_1, ext_tex_plane_1_1, arg_1, ext_tex_params); +} + +vec4 vertex_main() { + textureLoad_8acf41(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:54: 'textureLoadExternal' : no matching overloaded function found +ERROR: 0:54: '=' : cannot convert from ' const float' to ' temp highp 4-component vector of float' +ERROR: 0:54: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +struct GammaTransferParams { + float G; + float A; + float B; + float C; + float D; + float E; + float F; + uint padding; +}; + +struct ExternalTextureParams { + uint numPlanes; + mat3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + mat3 gamutConversionMatrix; +}; + +layout(binding = 2) uniform ExternalTextureParams_1 { + uint numPlanes; + mat3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + mat3 gamutConversionMatrix; +} ext_tex_params; + +vec3 gammaCorrection(vec3 v, GammaTransferParams params) { + bvec3 cond = lessThan(abs(v), vec3(params.D)); + vec3 t = (sign(v) * ((params.C * abs(v)) + params.F)); + vec3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), vec3(params.G)) + params.E)); + return mix(f, t, cond); +} + +vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, ivec2 coord, ExternalTextureParams params) { + vec3 color = vec3(0.0f, 0.0f, 0.0f); + if ((params.numPlanes == 1u)) { + color = texelFetch(plane0_1, coord, 0).rgb; + } else { + color = (vec4(texelFetch(plane0_1, coord, 0).r, texelFetch(plane1_1, coord, 0).rg, 1.0f) * params.yuvToRgbConversionMatrix); + } + color = gammaCorrection(color, params.gammaDecodeParams); + color = (params.gamutConversionMatrix * color); + color = gammaCorrection(color, params.gammaEncodeParams); + return vec4(color, 1.0f); +} + +uniform highp sampler2D arg_0_1; +uniform highp sampler2D ext_tex_plane_1_1; +void textureLoad_8acf41() { + ivec2 arg_1 = ivec2(0); + vec4 res = textureLoadExternal(arg_0_1, ext_tex_plane_1_1, arg_1, ext_tex_params); +} + +void fragment_main() { + textureLoad_8acf41(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:55: 'textureLoadExternal' : no matching overloaded function found +ERROR: 0:55: '=' : cannot convert from ' const float' to ' temp mediump 4-component vector of float' +ERROR: 0:55: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es + +struct GammaTransferParams { + float G; + float A; + float B; + float C; + float D; + float E; + float F; + uint padding; +}; + +struct ExternalTextureParams { + uint numPlanes; + mat3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + mat3 gamutConversionMatrix; +}; + +layout(binding = 2) uniform ExternalTextureParams_1 { + uint numPlanes; + mat3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + mat3 gamutConversionMatrix; +} ext_tex_params; + +vec3 gammaCorrection(vec3 v, GammaTransferParams params) { + bvec3 cond = lessThan(abs(v), vec3(params.D)); + vec3 t = (sign(v) * ((params.C * abs(v)) + params.F)); + vec3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), vec3(params.G)) + params.E)); + return mix(f, t, cond); +} + +vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, ivec2 coord, ExternalTextureParams params) { + vec3 color = vec3(0.0f, 0.0f, 0.0f); + if ((params.numPlanes == 1u)) { + color = texelFetch(plane0_1, coord, 0).rgb; + } else { + color = (vec4(texelFetch(plane0_1, coord, 0).r, texelFetch(plane1_1, coord, 0).rg, 1.0f) * params.yuvToRgbConversionMatrix); + } + color = gammaCorrection(color, params.gammaDecodeParams); + color = (params.gamutConversionMatrix * color); + color = gammaCorrection(color, params.gammaEncodeParams); + return vec4(color, 1.0f); +} + +uniform highp sampler2D arg_0_1; +uniform highp sampler2D ext_tex_plane_1_1; +void textureLoad_8acf41() { + ivec2 arg_1 = ivec2(0); + vec4 res = textureLoadExternal(arg_0_1, ext_tex_plane_1_1, arg_1, ext_tex_params); +} + +void compute_main() { + textureLoad_8acf41(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:54: 'textureLoadExternal' : no matching overloaded function found +ERROR: 0:54: '=' : cannot convert from ' const float' to ' temp highp 4-component vector of float' +ERROR: 0:54: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.hlsl new file mode 100644 index 0000000000..010b3825a8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.hlsl @@ -0,0 +1,108 @@ +struct GammaTransferParams { + float G; + float A; + float B; + float C; + float D; + float E; + float F; + uint padding; +}; +struct ExternalTextureParams { + uint numPlanes; + float3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + float3x3 gamutConversionMatrix; +}; + +Texture2D ext_tex_plane_1 : register(t1, space1); +cbuffer cbuffer_ext_tex_params : register(b2, space1) { + uint4 ext_tex_params[11]; +}; +Texture2D arg_0 : register(t0, space1); + +float3 gammaCorrection(float3 v, GammaTransferParams params) { + const bool3 cond = (abs(v) < float3((params.D).xxx)); + const float3 t = (sign(v) * ((params.C * abs(v)) + params.F)); + const float3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), float3((params.G).xxx)) + params.E)); + return (cond ? t : f); +} + +float4 textureLoadExternal(Texture2D plane0, Texture2D plane1, int2 coord, ExternalTextureParams params) { + float3 color = float3(0.0f, 0.0f, 0.0f); + if ((params.numPlanes == 1u)) { + color = plane0.Load(int3(coord, 0)).rgb; + } else { + color = mul(params.yuvToRgbConversionMatrix, float4(plane0.Load(int3(coord, 0)).r, plane1.Load(int3(coord, 0)).rg, 1.0f)); + } + color = gammaCorrection(color, params.gammaDecodeParams); + color = mul(color, params.gamutConversionMatrix); + color = gammaCorrection(color, params.gammaEncodeParams); + return float4(color, 1.0f); +} + +float3x4 tint_symbol_3(uint4 buffer[11], uint offset) { + const uint scalar_offset = ((offset + 0u)) / 4; + const uint scalar_offset_1 = ((offset + 16u)) / 4; + const uint scalar_offset_2 = ((offset + 32u)) / 4; + return float3x4(asfloat(buffer[scalar_offset / 4]), asfloat(buffer[scalar_offset_1 / 4]), asfloat(buffer[scalar_offset_2 / 4])); +} + +GammaTransferParams tint_symbol_5(uint4 buffer[11], uint offset) { + const uint scalar_offset_3 = ((offset + 0u)) / 4; + const uint scalar_offset_4 = ((offset + 4u)) / 4; + const uint scalar_offset_5 = ((offset + 8u)) / 4; + const uint scalar_offset_6 = ((offset + 12u)) / 4; + const uint scalar_offset_7 = ((offset + 16u)) / 4; + const uint scalar_offset_8 = ((offset + 20u)) / 4; + const uint scalar_offset_9 = ((offset + 24u)) / 4; + const uint scalar_offset_10 = ((offset + 28u)) / 4; + const GammaTransferParams tint_symbol_9 = {asfloat(buffer[scalar_offset_3 / 4][scalar_offset_3 % 4]), asfloat(buffer[scalar_offset_4 / 4][scalar_offset_4 % 4]), asfloat(buffer[scalar_offset_5 / 4][scalar_offset_5 % 4]), asfloat(buffer[scalar_offset_6 / 4][scalar_offset_6 % 4]), asfloat(buffer[scalar_offset_7 / 4][scalar_offset_7 % 4]), asfloat(buffer[scalar_offset_8 / 4][scalar_offset_8 % 4]), asfloat(buffer[scalar_offset_9 / 4][scalar_offset_9 % 4]), buffer[scalar_offset_10 / 4][scalar_offset_10 % 4]}; + return tint_symbol_9; +} + +float3x3 tint_symbol_7(uint4 buffer[11], uint offset) { + const uint scalar_offset_11 = ((offset + 0u)) / 4; + const uint scalar_offset_12 = ((offset + 16u)) / 4; + const uint scalar_offset_13 = ((offset + 32u)) / 4; + return float3x3(asfloat(buffer[scalar_offset_11 / 4].xyz), asfloat(buffer[scalar_offset_12 / 4].xyz), asfloat(buffer[scalar_offset_13 / 4].xyz)); +} + +ExternalTextureParams tint_symbol_1(uint4 buffer[11], uint offset) { + const uint scalar_offset_14 = ((offset + 0u)) / 4; + const ExternalTextureParams tint_symbol_10 = {buffer[scalar_offset_14 / 4][scalar_offset_14 % 4], tint_symbol_3(buffer, (offset + 16u)), tint_symbol_5(buffer, (offset + 64u)), tint_symbol_5(buffer, (offset + 96u)), tint_symbol_7(buffer, (offset + 128u))}; + return tint_symbol_10; +} + +void textureLoad_8acf41() { + int2 arg_1 = (0).xx; + float4 res = textureLoadExternal(arg_0, ext_tex_plane_1, arg_1, tint_symbol_1(ext_tex_params, 0u)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_8acf41(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_8acf41(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_8acf41(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.msl new file mode 100644 index 0000000000..bd83a8ef99 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.msl @@ -0,0 +1,74 @@ +#include + +using namespace metal; +struct GammaTransferParams { + /* 0x0000 */ float G; + /* 0x0004 */ float A; + /* 0x0008 */ float B; + /* 0x000c */ float C; + /* 0x0010 */ float D; + /* 0x0014 */ float E; + /* 0x0018 */ float F; + /* 0x001c */ uint padding; +}; + +struct ExternalTextureParams { + /* 0x0000 */ uint numPlanes; + /* 0x0004 */ int8_t tint_pad[12]; + /* 0x0010 */ float3x4 yuvToRgbConversionMatrix; + /* 0x0040 */ GammaTransferParams gammaDecodeParams; + /* 0x0060 */ GammaTransferParams gammaEncodeParams; + /* 0x0080 */ float3x3 gamutConversionMatrix; +}; + +float3 gammaCorrection(float3 v, GammaTransferParams params) { + bool3 const cond = (fabs(v) < float3(params.D)); + float3 const t = (sign(v) * ((params.C * fabs(v)) + params.F)); + float3 const f = (sign(v) * (pow(((params.A * fabs(v)) + params.B), float3(params.G)) + params.E)); + return select(f, t, cond); +} + +float4 textureLoadExternal(texture2d plane0, texture2d plane1, int2 coord, ExternalTextureParams params) { + float3 color = 0.0f; + if ((params.numPlanes == 1u)) { + color = float4(plane0.read(uint2(coord), 0)).rgb; + } else { + color = (float4(plane0.read(uint2(coord), 0)[0], float4(plane1.read(uint2(coord), 0)).rg, 1.0f) * params.yuvToRgbConversionMatrix); + } + color = gammaCorrection(color, params.gammaDecodeParams); + color = (params.gamutConversionMatrix * color); + color = gammaCorrection(color, params.gammaEncodeParams); + return float4(color, 1.0f); +} + +void textureLoad_8acf41(texture2d tint_symbol_1, texture2d tint_symbol_2, const constant ExternalTextureParams* const tint_symbol_3) { + int2 arg_1 = int2(0); + float4 res = textureLoadExternal(tint_symbol_1, tint_symbol_2, arg_1, *(tint_symbol_3)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_4, texture2d tint_symbol_5, const constant ExternalTextureParams* const tint_symbol_6) { + textureLoad_8acf41(tint_symbol_4, tint_symbol_5, tint_symbol_6); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_7 [[texture(0)]], texture2d tint_symbol_8 [[texture(1)]], const constant ExternalTextureParams* tint_symbol_9 [[buffer(2)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_7, tint_symbol_8, tint_symbol_9); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_10 [[texture(0)]], texture2d tint_symbol_11 [[texture(1)]], const constant ExternalTextureParams* tint_symbol_12 [[buffer(2)]]) { + textureLoad_8acf41(tint_symbol_10, tint_symbol_11, tint_symbol_12); + return; +} + +kernel void compute_main(texture2d tint_symbol_13 [[texture(0)]], texture2d tint_symbol_14 [[texture(1)]], const constant ExternalTextureParams* tint_symbol_15 [[buffer(2)]]) { + textureLoad_8acf41(tint_symbol_13, tint_symbol_14, tint_symbol_15); + return; +} + diff --git a/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.spvasm new file mode 100644 index 0000000000..2c3a9024e7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.spvasm @@ -0,0 +1,233 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 132 +; Schema: 0 + OpCapability Shader + %27 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %ext_tex_plane_1 "ext_tex_plane_1" + OpName %ExternalTextureParams "ExternalTextureParams" + OpMemberName %ExternalTextureParams 0 "numPlanes" + OpMemberName %ExternalTextureParams 1 "yuvToRgbConversionMatrix" + OpMemberName %ExternalTextureParams 2 "gammaDecodeParams" + OpName %GammaTransferParams "GammaTransferParams" + OpMemberName %GammaTransferParams 0 "G" + OpMemberName %GammaTransferParams 1 "A" + OpMemberName %GammaTransferParams 2 "B" + OpMemberName %GammaTransferParams 3 "C" + OpMemberName %GammaTransferParams 4 "D" + OpMemberName %GammaTransferParams 5 "E" + OpMemberName %GammaTransferParams 6 "F" + OpMemberName %GammaTransferParams 7 "padding" + OpMemberName %ExternalTextureParams 3 "gammaEncodeParams" + OpMemberName %ExternalTextureParams 4 "gamutConversionMatrix" + OpName %ext_tex_params "ext_tex_params" + OpName %arg_0 "arg_0" + OpName %gammaCorrection "gammaCorrection" + OpName %v "v" + OpName %params "params" + OpName %textureLoadExternal "textureLoadExternal" + OpName %plane0 "plane0" + OpName %plane1 "plane1" + OpName %coord "coord" + OpName %params_0 "params" + OpName %color "color" + OpName %textureLoad_8acf41 "textureLoad_8acf41" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %ext_tex_plane_1 DescriptorSet 1 + OpDecorate %ext_tex_plane_1 Binding 1 + OpDecorate %ExternalTextureParams Block + OpMemberDecorate %ExternalTextureParams 0 Offset 0 + OpMemberDecorate %ExternalTextureParams 1 Offset 16 + OpMemberDecorate %ExternalTextureParams 1 ColMajor + OpMemberDecorate %ExternalTextureParams 1 MatrixStride 16 + OpMemberDecorate %ExternalTextureParams 2 Offset 64 + OpMemberDecorate %GammaTransferParams 0 Offset 0 + OpMemberDecorate %GammaTransferParams 1 Offset 4 + OpMemberDecorate %GammaTransferParams 2 Offset 8 + OpMemberDecorate %GammaTransferParams 3 Offset 12 + OpMemberDecorate %GammaTransferParams 4 Offset 16 + OpMemberDecorate %GammaTransferParams 5 Offset 20 + OpMemberDecorate %GammaTransferParams 6 Offset 24 + OpMemberDecorate %GammaTransferParams 7 Offset 28 + OpMemberDecorate %ExternalTextureParams 3 Offset 96 + OpMemberDecorate %ExternalTextureParams 4 Offset 128 + OpMemberDecorate %ExternalTextureParams 4 ColMajor + OpMemberDecorate %ExternalTextureParams 4 MatrixStride 16 + OpDecorate %ext_tex_params NonWritable + OpDecorate %ext_tex_params DescriptorSet 1 + OpDecorate %ext_tex_params Binding 2 + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 +%ext_tex_plane_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %uint = OpTypeInt 32 0 +%mat3v4float = OpTypeMatrix %v4float 3 +%GammaTransferParams = OpTypeStruct %float %float %float %float %float %float %float %uint + %v3float = OpTypeVector %float 3 +%mat3v3float = OpTypeMatrix %v3float 3 +%ExternalTextureParams = OpTypeStruct %uint %mat3v4float %GammaTransferParams %GammaTransferParams %mat3v3float +%_ptr_Uniform_ExternalTextureParams = OpTypePointer Uniform %ExternalTextureParams +%ext_tex_params = OpVariable %_ptr_Uniform_ExternalTextureParams Uniform + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %21 = OpTypeFunction %v3float %v3float %GammaTransferParams + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %41 = OpConstantNull %v3float + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %61 = OpTypeFunction %v4float %11 %11 %v2int %ExternalTextureParams + %uint_1 = OpConstant %uint 1 + %78 = OpConstantNull %int + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %void = OpTypeVoid + %105 = OpTypeFunction %void + %109 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %119 = OpTypeFunction %v4float +%gammaCorrection = OpFunction %v3float None %21 + %v = OpFunctionParameter %v3float + %params = OpFunctionParameter %GammaTransferParams + %25 = OpLabel + %39 = OpVariable %_ptr_Function_v3float Function %41 + %51 = OpVariable %_ptr_Function_v3float Function %41 + %57 = OpVariable %_ptr_Function_v3float Function %41 + %26 = OpExtInst %v3float %27 FAbs %v + %28 = OpCompositeExtract %float %params 4 + %29 = OpCompositeConstruct %v3float %28 %28 %28 + %30 = OpFOrdLessThan %v3bool %26 %29 + %33 = OpExtInst %v3float %27 FSign %v + %34 = OpCompositeExtract %float %params 3 + %35 = OpExtInst %v3float %27 FAbs %v + %36 = OpVectorTimesScalar %v3float %35 %34 + %37 = OpCompositeExtract %float %params 6 + %42 = OpCompositeConstruct %v3float %37 %37 %37 + %38 = OpFAdd %v3float %36 %42 + %43 = OpFMul %v3float %33 %38 + %44 = OpExtInst %v3float %27 FSign %v + %46 = OpCompositeExtract %float %params 1 + %47 = OpExtInst %v3float %27 FAbs %v + %48 = OpVectorTimesScalar %v3float %47 %46 + %49 = OpCompositeExtract %float %params 2 + %52 = OpCompositeConstruct %v3float %49 %49 %49 + %50 = OpFAdd %v3float %48 %52 + %53 = OpCompositeExtract %float %params 0 + %54 = OpCompositeConstruct %v3float %53 %53 %53 + %45 = OpExtInst %v3float %27 Pow %50 %54 + %55 = OpCompositeExtract %float %params 5 + %58 = OpCompositeConstruct %v3float %55 %55 %55 + %56 = OpFAdd %v3float %45 %58 + %59 = OpFMul %v3float %44 %56 + %60 = OpSelect %v3float %30 %43 %59 + OpReturnValue %60 + OpFunctionEnd +%textureLoadExternal = OpFunction %v4float None %61 + %plane0 = OpFunctionParameter %11 + %plane1 = OpFunctionParameter %11 + %coord = OpFunctionParameter %v2int + %params_0 = OpFunctionParameter %ExternalTextureParams + %69 = OpLabel + %color = OpVariable %_ptr_Function_v3float Function %41 + %71 = OpCompositeExtract %uint %params_0 0 + %73 = OpIEqual %bool %71 %uint_1 + OpSelectionMerge %74 None + OpBranchConditional %73 %75 %76 + %75 = OpLabel + %77 = OpImageFetch %v4float %plane0 %coord Lod %78 + %79 = OpVectorShuffle %v3float %77 %77 0 1 2 + OpStore %color %79 + OpBranch %74 + %76 = OpLabel + %80 = OpImageFetch %v4float %plane0 %coord Lod %78 + %81 = OpCompositeExtract %float %80 0 + %82 = OpImageFetch %v4float %plane1 %coord Lod %78 + %84 = OpVectorShuffle %v2float %82 %82 0 1 + %85 = OpCompositeExtract %float %84 0 + %86 = OpCompositeExtract %float %84 1 + %88 = OpCompositeConstruct %v4float %81 %85 %86 %float_1 + %89 = OpCompositeExtract %mat3v4float %params_0 1 + %90 = OpVectorTimesMatrix %v3float %88 %89 + OpStore %color %90 + OpBranch %74 + %74 = OpLabel + %92 = OpLoad %v3float %color + %93 = OpCompositeExtract %GammaTransferParams %params_0 2 + %91 = OpFunctionCall %v3float %gammaCorrection %92 %93 + OpStore %color %91 + %94 = OpCompositeExtract %mat3v3float %params_0 4 + %95 = OpLoad %v3float %color + %96 = OpMatrixTimesVector %v3float %94 %95 + OpStore %color %96 + %98 = OpLoad %v3float %color + %99 = OpCompositeExtract %GammaTransferParams %params_0 3 + %97 = OpFunctionCall %v3float %gammaCorrection %98 %99 + OpStore %color %97 + %100 = OpLoad %v3float %color + %101 = OpCompositeExtract %float %100 0 + %102 = OpCompositeExtract %float %100 1 + %103 = OpCompositeExtract %float %100 2 + %104 = OpCompositeConstruct %v4float %101 %102 %103 %float_1 + OpReturnValue %104 + OpFunctionEnd +%textureLoad_8acf41 = OpFunction %void None %105 + %108 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %109 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_1 %109 + %113 = OpLoad %11 %arg_0 + %114 = OpLoad %11 %ext_tex_plane_1 + %115 = OpLoad %v2int %arg_1 + %116 = OpLoad %ExternalTextureParams %ext_tex_params + %112 = OpFunctionCall %v4float %textureLoadExternal %113 %114 %115 %116 + OpStore %res %112 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %119 + %121 = OpLabel + %122 = OpFunctionCall %void %textureLoad_8acf41 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %105 + %124 = OpLabel + %125 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %125 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %105 + %127 = OpLabel + %128 = OpFunctionCall %void %textureLoad_8acf41 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %105 + %130 = OpLabel + %131 = OpFunctionCall %void %textureLoad_8acf41 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.wgsl new file mode 100644 index 0000000000..bcabc7d31c --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +@group(1) @binding(0) var arg_0 : texture_external; + +fn textureLoad_8acf41() { + var arg_1 = vec2(); + var res : vec4 = textureLoad(arg_0, arg_1); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_8acf41(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureLoad_8acf41(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureLoad_8acf41(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/9b2667.wgsl b/test/tint/builtins/gen/var/textureLoad/9b2667.wgsl new file mode 100644 index 0000000000..437dd0ab01 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/9b2667.wgsl @@ -0,0 +1,49 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d_array; + +// fn textureLoad(texture: texture_depth_2d_array, coords: vec2, array_index: i32, level: i32) -> f32 +fn textureLoad_9b2667() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = 0; + var res: f32 = textureLoad(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_9b2667(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureLoad_9b2667(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureLoad_9b2667(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/9b2667.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/9b2667.wgsl.expected.glsl new file mode 100644 index 0000000000..59244ebd33 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/9b2667.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +uniform highp sampler2DArray arg_0_1; +void textureLoad_9b2667() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + int arg_3 = 0; + float res = texelFetch(arg_0_1, ivec3(arg_1, arg_2), arg_3).x; +} + +vec4 vertex_main() { + textureLoad_9b2667(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DArray arg_0_1; +void textureLoad_9b2667() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + int arg_3 = 0; + float res = texelFetch(arg_0_1, ivec3(arg_1, arg_2), arg_3).x; +} + +void fragment_main() { + textureLoad_9b2667(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DArray arg_0_1; +void textureLoad_9b2667() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + int arg_3 = 0; + float res = texelFetch(arg_0_1, ivec3(arg_1, arg_2), arg_3).x; +} + +void compute_main() { + textureLoad_9b2667(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/9b2667.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureLoad/9b2667.wgsl.expected.hlsl new file mode 100644 index 0000000000..b354532f59 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/9b2667.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureLoad_9b2667() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + int arg_3 = 0; + float res = arg_0.Load(int4(int3(arg_1, arg_2), arg_3)).x; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_9b2667(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_9b2667(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_9b2667(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/9b2667.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/9b2667.wgsl.expected.msl new file mode 100644 index 0000000000..456f44dc53 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/9b2667.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureLoad_9b2667(depth2d_array tint_symbol_1) { + int2 arg_1 = int2(0); + int arg_2 = 1; + int arg_3 = 0; + float res = tint_symbol_1.read(uint2(arg_1), arg_2, arg_3); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d_array tint_symbol_2) { + textureLoad_9b2667(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d_array tint_symbol_4 [[texture(0)]]) { + textureLoad_9b2667(tint_symbol_4); + return; +} + +kernel void compute_main(depth2d_array tint_symbol_5 [[texture(0)]]) { + textureLoad_9b2667(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureLoad/9b2667.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/9b2667.wgsl.expected.spvasm new file mode 100644 index 0000000000..4d0af88d1c --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/9b2667.wgsl.expected.spvasm @@ -0,0 +1,95 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 52 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureLoad_9b2667 "textureLoad_9b2667" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %18 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int + %v3int = OpTypeVector %int 3 +%_ptr_Function_float = OpTypePointer Function %float + %38 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureLoad_9b2667 = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %18 + %arg_2 = OpVariable %_ptr_Function_int Function %24 + %arg_3 = OpVariable %_ptr_Function_int Function %24 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_1 %18 + OpStore %arg_2 %int_1 + OpStore %arg_3 %24 + %28 = OpLoad %11 %arg_0 + %30 = OpLoad %v2int %arg_1 + %31 = OpCompositeExtract %int %30 0 + %32 = OpCompositeExtract %int %30 1 + %33 = OpLoad %int %arg_2 + %34 = OpCompositeConstruct %v3int %31 %32 %33 + %35 = OpLoad %int %arg_3 + %27 = OpImageFetch %v4float %28 %34 Lod %35 + %26 = OpCompositeExtract %float %27 0 + OpStore %res %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %38 + %40 = OpLabel + %41 = OpFunctionCall %void %textureLoad_9b2667 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %43 = OpLabel + %44 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %44 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %47 = OpLabel + %48 = OpFunctionCall %void %textureLoad_9b2667 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %50 = OpLabel + %51 = OpFunctionCall %void %textureLoad_9b2667 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureLoad/9b2667.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/9b2667.wgsl.expected.wgsl new file mode 100644 index 0000000000..157799ea7f --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/9b2667.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d_array; + +fn textureLoad_9b2667() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = 0; + var res : f32 = textureLoad(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_9b2667(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureLoad_9b2667(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureLoad_9b2667(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/a583c9.wgsl b/test/tint/builtins/gen/var/textureLoad/a583c9.wgsl new file mode 100644 index 0000000000..da8572a45d --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/a583c9.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_multisampled_2d; + +// fn textureLoad(texture: texture_multisampled_2d, coords: vec2, sample_index: i32) -> vec4 +fn textureLoad_a583c9() { + var arg_1 = vec2(); + var arg_2 = 1; + var res: vec4 = textureLoad(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_a583c9(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureLoad_a583c9(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureLoad_a583c9(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/a583c9.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/a583c9.wgsl.expected.glsl new file mode 100644 index 0000000000..2d7faeccad --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/a583c9.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +uniform highp sampler2DMS arg_0_1; +void textureLoad_a583c9() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + vec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +vec4 vertex_main() { + textureLoad_a583c9(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DMS arg_0_1; +void textureLoad_a583c9() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + vec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +void fragment_main() { + textureLoad_a583c9(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DMS arg_0_1; +void textureLoad_a583c9() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + vec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +void compute_main() { + textureLoad_a583c9(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/a583c9.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureLoad/a583c9.wgsl.expected.hlsl new file mode 100644 index 0000000000..c8c40f9263 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/a583c9.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +Texture2DMS arg_0 : register(t0, space1); + +void textureLoad_a583c9() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + float4 res = arg_0.Load(arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_a583c9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_a583c9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_a583c9(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/a583c9.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/a583c9.wgsl.expected.msl new file mode 100644 index 0000000000..666d009f2f --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/a583c9.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureLoad_a583c9(texture2d_ms tint_symbol_1) { + int2 arg_1 = int2(0); + int arg_2 = 1; + float4 res = tint_symbol_1.read(uint2(arg_1), arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_ms tint_symbol_2) { + textureLoad_a583c9(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_ms tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_ms tint_symbol_4 [[texture(0)]]) { + textureLoad_a583c9(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_ms tint_symbol_5 [[texture(0)]]) { + textureLoad_a583c9(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureLoad/a583c9.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/a583c9.wgsl.expected.spvasm new file mode 100644 index 0000000000..c9e24f9b84 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/a583c9.wgsl.expected.spvasm @@ -0,0 +1,86 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureLoad_a583c9 "textureLoad_a583c9" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 1 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %18 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %31 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureLoad_a583c9 = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %18 + %arg_2 = OpVariable %_ptr_Function_int Function %24 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_1 %18 + OpStore %arg_2 %int_1 + %26 = OpLoad %11 %arg_0 + %27 = OpLoad %v2int %arg_1 + %28 = OpLoad %int %arg_2 + %25 = OpImageFetch %v4float %26 %27 Sample %28 + OpStore %res %25 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %31 + %33 = OpLabel + %34 = OpFunctionCall %void %textureLoad_a583c9 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %37 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %40 = OpLabel + %41 = OpFunctionCall %void %textureLoad_a583c9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %43 = OpLabel + %44 = OpFunctionCall %void %textureLoad_a583c9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureLoad/a583c9.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/a583c9.wgsl.expected.wgsl new file mode 100644 index 0000000000..2e45ae4644 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/a583c9.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_multisampled_2d; + +fn textureLoad_a583c9() { + var arg_1 = vec2(); + var arg_2 = 1; + var res : vec4 = textureLoad(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_a583c9(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureLoad_a583c9(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureLoad_a583c9(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/a9a9f5.wgsl b/test/tint/builtins/gen/var/textureLoad/a9a9f5.wgsl new file mode 100644 index 0000000000..2b35241ef8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/a9a9f5.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_3d; + +// fn textureLoad(texture: texture_3d, coords: vec3, level: i32) -> vec4 +fn textureLoad_a9a9f5() { + var arg_1 = vec3(); + var arg_2 = 0; + var res: vec4 = textureLoad(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_a9a9f5(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureLoad_a9a9f5(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureLoad_a9a9f5(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/a9a9f5.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/a9a9f5.wgsl.expected.glsl new file mode 100644 index 0000000000..66f2e8ca7c --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/a9a9f5.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +uniform highp usampler3D arg_0_1; +void textureLoad_a9a9f5() { + ivec3 arg_1 = ivec3(0); + int arg_2 = 0; + uvec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +vec4 vertex_main() { + textureLoad_a9a9f5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp usampler3D arg_0_1; +void textureLoad_a9a9f5() { + ivec3 arg_1 = ivec3(0); + int arg_2 = 0; + uvec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +void fragment_main() { + textureLoad_a9a9f5(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp usampler3D arg_0_1; +void textureLoad_a9a9f5() { + ivec3 arg_1 = ivec3(0); + int arg_2 = 0; + uvec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +void compute_main() { + textureLoad_a9a9f5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/a9a9f5.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureLoad/a9a9f5.wgsl.expected.hlsl new file mode 100644 index 0000000000..a44b10ec40 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/a9a9f5.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +Texture3D arg_0 : register(t0, space1); + +void textureLoad_a9a9f5() { + int3 arg_1 = (0).xxx; + int arg_2 = 0; + uint4 res = arg_0.Load(int4(arg_1, arg_2)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_a9a9f5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_a9a9f5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_a9a9f5(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/a9a9f5.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/a9a9f5.wgsl.expected.msl new file mode 100644 index 0000000000..a5491a65ce --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/a9a9f5.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureLoad_a9a9f5(texture3d tint_symbol_1) { + int3 arg_1 = int3(0); + int arg_2 = 0; + uint4 res = tint_symbol_1.read(uint3(arg_1), arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureLoad_a9a9f5(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureLoad_a9a9f5(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureLoad_a9a9f5(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureLoad/a9a9f5.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/a9a9f5.wgsl.expected.spvasm new file mode 100644 index 0000000000..234a175fbd --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/a9a9f5.wgsl.expected.spvasm @@ -0,0 +1,88 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureLoad_a9a9f5 "textureLoad_a9a9f5" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 3D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %19 = OpConstantNull %v3int +%_ptr_Function_v3int = OpTypePointer Function %v3int + %22 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %v4uint = OpTypeVector %uint 4 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %32 = OpConstantNull %v4uint + %33 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureLoad_a9a9f5 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v3int Function %19 + %arg_2 = OpVariable %_ptr_Function_int Function %22 + %res = OpVariable %_ptr_Function_v4uint Function %32 + OpStore %arg_1 %19 + OpStore %arg_2 %22 + %27 = OpLoad %11 %arg_0 + %28 = OpLoad %v3int %arg_1 + %29 = OpLoad %int %arg_2 + %25 = OpImageFetch %v4uint %27 %28 Lod %29 + OpStore %res %25 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %33 + %35 = OpLabel + %36 = OpFunctionCall %void %textureLoad_a9a9f5 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %38 = OpLabel + %39 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %39 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %42 = OpLabel + %43 = OpFunctionCall %void %textureLoad_a9a9f5 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %45 = OpLabel + %46 = OpFunctionCall %void %textureLoad_a9a9f5 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureLoad/a9a9f5.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/a9a9f5.wgsl.expected.wgsl new file mode 100644 index 0000000000..93a3b77347 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/a9a9f5.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_3d; + +fn textureLoad_a9a9f5() { + var arg_1 = vec3(); + var arg_2 = 0; + var res : vec4 = textureLoad(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_a9a9f5(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureLoad_a9a9f5(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureLoad_a9a9f5(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/c2a480.wgsl b/test/tint/builtins/gen/var/textureLoad/c2a480.wgsl new file mode 100644 index 0000000000..62944a9f1e --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/c2a480.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d; + +// fn textureLoad(texture: texture_2d, coords: vec2, level: i32) -> vec4 +fn textureLoad_c2a480() { + var arg_1 = vec2(); + var arg_2 = 0; + var res: vec4 = textureLoad(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_c2a480(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureLoad_c2a480(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureLoad_c2a480(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/c2a480.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/c2a480.wgsl.expected.glsl new file mode 100644 index 0000000000..17b4070fee --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/c2a480.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +uniform highp isampler2D arg_0_1; +void textureLoad_c2a480() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 0; + ivec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +vec4 vertex_main() { + textureLoad_c2a480(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp isampler2D arg_0_1; +void textureLoad_c2a480() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 0; + ivec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +void fragment_main() { + textureLoad_c2a480(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp isampler2D arg_0_1; +void textureLoad_c2a480() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 0; + ivec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +void compute_main() { + textureLoad_c2a480(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/c2a480.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureLoad/c2a480.wgsl.expected.hlsl new file mode 100644 index 0000000000..772ad7ddaf --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/c2a480.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_0 : register(t0, space1); + +void textureLoad_c2a480() { + int2 arg_1 = (0).xx; + int arg_2 = 0; + int4 res = arg_0.Load(int3(arg_1, arg_2)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_c2a480(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_c2a480(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_c2a480(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/c2a480.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/c2a480.wgsl.expected.msl new file mode 100644 index 0000000000..8aa51f457d --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/c2a480.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureLoad_c2a480(texture2d tint_symbol_1) { + int2 arg_1 = int2(0); + int arg_2 = 0; + int4 res = tint_symbol_1.read(uint2(arg_1), arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureLoad_c2a480(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureLoad_c2a480(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureLoad_c2a480(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureLoad/c2a480.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/c2a480.wgsl.expected.spvasm new file mode 100644 index 0000000000..60ed5452ef --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/c2a480.wgsl.expected.spvasm @@ -0,0 +1,87 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 46 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureLoad_c2a480 "textureLoad_c2a480" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v2int = OpTypeVector %int 2 + %18 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %21 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %v4int = OpTypeVector %int 4 +%_ptr_Function_v4int = OpTypePointer Function %v4int + %31 = OpConstantNull %v4int + %32 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureLoad_c2a480 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %18 + %arg_2 = OpVariable %_ptr_Function_int Function %21 + %res = OpVariable %_ptr_Function_v4int Function %31 + OpStore %arg_1 %18 + OpStore %arg_2 %21 + %26 = OpLoad %11 %arg_0 + %27 = OpLoad %v2int %arg_1 + %28 = OpLoad %int %arg_2 + %24 = OpImageFetch %v4int %26 %27 Lod %28 + OpStore %res %24 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %32 + %34 = OpLabel + %35 = OpFunctionCall %void %textureLoad_c2a480 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %37 = OpLabel + %38 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %38 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %41 = OpLabel + %42 = OpFunctionCall %void %textureLoad_c2a480 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %44 = OpLabel + %45 = OpFunctionCall %void %textureLoad_c2a480 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureLoad/c2a480.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/c2a480.wgsl.expected.wgsl new file mode 100644 index 0000000000..a28a80c6ec --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/c2a480.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_2d; + +fn textureLoad_c2a480() { + var arg_1 = vec2(); + var arg_2 = 0; + var res : vec4 = textureLoad(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_c2a480(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureLoad_c2a480(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureLoad_c2a480(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/c378ee.wgsl b/test/tint/builtins/gen/var/textureLoad/c378ee.wgsl new file mode 100644 index 0000000000..fad4ac3cf4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/c378ee.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_multisampled_2d; + +// fn textureLoad(texture: texture_multisampled_2d, coords: vec2, sample_index: i32) -> vec4 +fn textureLoad_c378ee() { + var arg_1 = vec2(); + var arg_2 = 1; + var res: vec4 = textureLoad(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_c378ee(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureLoad_c378ee(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureLoad_c378ee(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/c378ee.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/c378ee.wgsl.expected.glsl new file mode 100644 index 0000000000..9d3f844571 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/c378ee.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +uniform highp usampler2DMS arg_0_1; +void textureLoad_c378ee() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + uvec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +vec4 vertex_main() { + textureLoad_c378ee(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp usampler2DMS arg_0_1; +void textureLoad_c378ee() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + uvec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +void fragment_main() { + textureLoad_c378ee(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp usampler2DMS arg_0_1; +void textureLoad_c378ee() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + uvec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +void compute_main() { + textureLoad_c378ee(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/c378ee.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureLoad/c378ee.wgsl.expected.hlsl new file mode 100644 index 0000000000..20193dae9a --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/c378ee.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +Texture2DMS arg_0 : register(t0, space1); + +void textureLoad_c378ee() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + uint4 res = arg_0.Load(arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_c378ee(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_c378ee(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_c378ee(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/c378ee.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/c378ee.wgsl.expected.msl new file mode 100644 index 0000000000..c6192ce47f --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/c378ee.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureLoad_c378ee(texture2d_ms tint_symbol_1) { + int2 arg_1 = int2(0); + int arg_2 = 1; + uint4 res = tint_symbol_1.read(uint2(arg_1), arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_ms tint_symbol_2) { + textureLoad_c378ee(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_ms tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_ms tint_symbol_4 [[texture(0)]]) { + textureLoad_c378ee(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_ms tint_symbol_5 [[texture(0)]]) { + textureLoad_c378ee(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureLoad/c378ee.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/c378ee.wgsl.expected.spvasm new file mode 100644 index 0000000000..190f4acf34 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/c378ee.wgsl.expected.spvasm @@ -0,0 +1,89 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 48 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureLoad_c378ee "textureLoad_c378ee" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 0 1 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %19 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %25 = OpConstantNull %int + %v4uint = OpTypeVector %uint 4 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %33 = OpConstantNull %v4uint + %34 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureLoad_c378ee = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %19 + %arg_2 = OpVariable %_ptr_Function_int Function %25 + %res = OpVariable %_ptr_Function_v4uint Function %33 + OpStore %arg_1 %19 + OpStore %arg_2 %int_1 + %28 = OpLoad %11 %arg_0 + %29 = OpLoad %v2int %arg_1 + %30 = OpLoad %int %arg_2 + %26 = OpImageFetch %v4uint %28 %29 Sample %30 + OpStore %res %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %34 + %36 = OpLabel + %37 = OpFunctionCall %void %textureLoad_c378ee + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %39 = OpLabel + %40 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %40 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %43 = OpLabel + %44 = OpFunctionCall %void %textureLoad_c378ee + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %46 = OpLabel + %47 = OpFunctionCall %void %textureLoad_c378ee + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureLoad/c378ee.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/c378ee.wgsl.expected.wgsl new file mode 100644 index 0000000000..b957d4affd --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/c378ee.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_multisampled_2d; + +fn textureLoad_c378ee() { + var arg_1 = vec2(); + var arg_2 = 1; + var res : vec4 = textureLoad(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_c378ee(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureLoad_c378ee(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureLoad_c378ee(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/e3d2cc.wgsl b/test/tint/builtins/gen/var/textureLoad/e3d2cc.wgsl new file mode 100644 index 0000000000..a8f4f099e3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/e3d2cc.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_multisampled_2d; + +// fn textureLoad(texture: texture_multisampled_2d, coords: vec2, sample_index: i32) -> vec4 +fn textureLoad_e3d2cc() { + var arg_1 = vec2(); + var arg_2 = 1; + var res: vec4 = textureLoad(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_e3d2cc(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureLoad_e3d2cc(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureLoad_e3d2cc(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/e3d2cc.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/e3d2cc.wgsl.expected.glsl new file mode 100644 index 0000000000..6c70fb265b --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/e3d2cc.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +uniform highp isampler2DMS arg_0_1; +void textureLoad_e3d2cc() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + ivec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +vec4 vertex_main() { + textureLoad_e3d2cc(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp isampler2DMS arg_0_1; +void textureLoad_e3d2cc() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + ivec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +void fragment_main() { + textureLoad_e3d2cc(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp isampler2DMS arg_0_1; +void textureLoad_e3d2cc() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + ivec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +void compute_main() { + textureLoad_e3d2cc(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/e3d2cc.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureLoad/e3d2cc.wgsl.expected.hlsl new file mode 100644 index 0000000000..2599303c42 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/e3d2cc.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +Texture2DMS arg_0 : register(t0, space1); + +void textureLoad_e3d2cc() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + int4 res = arg_0.Load(arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_e3d2cc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_e3d2cc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_e3d2cc(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/e3d2cc.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/e3d2cc.wgsl.expected.msl new file mode 100644 index 0000000000..37f3ac3d45 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/e3d2cc.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureLoad_e3d2cc(texture2d_ms tint_symbol_1) { + int2 arg_1 = int2(0); + int arg_2 = 1; + int4 res = tint_symbol_1.read(uint2(arg_1), arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_ms tint_symbol_2) { + textureLoad_e3d2cc(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_ms tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_ms tint_symbol_4 [[texture(0)]]) { + textureLoad_e3d2cc(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_ms tint_symbol_5 [[texture(0)]]) { + textureLoad_e3d2cc(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureLoad/e3d2cc.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/e3d2cc.wgsl.expected.spvasm new file mode 100644 index 0000000000..31837df0fb --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/e3d2cc.wgsl.expected.spvasm @@ -0,0 +1,88 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureLoad_e3d2cc "textureLoad_e3d2cc" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 0 1 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v2int = OpTypeVector %int 2 + %18 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int + %v4int = OpTypeVector %int 4 +%_ptr_Function_v4int = OpTypePointer Function %v4int + %32 = OpConstantNull %v4int + %33 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureLoad_e3d2cc = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %18 + %arg_2 = OpVariable %_ptr_Function_int Function %24 + %res = OpVariable %_ptr_Function_v4int Function %32 + OpStore %arg_1 %18 + OpStore %arg_2 %int_1 + %27 = OpLoad %11 %arg_0 + %28 = OpLoad %v2int %arg_1 + %29 = OpLoad %int %arg_2 + %25 = OpImageFetch %v4int %27 %28 Sample %29 + OpStore %res %25 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %33 + %35 = OpLabel + %36 = OpFunctionCall %void %textureLoad_e3d2cc + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %38 = OpLabel + %39 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %39 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %42 = OpLabel + %43 = OpFunctionCall %void %textureLoad_e3d2cc + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %45 = OpLabel + %46 = OpFunctionCall %void %textureLoad_e3d2cc + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureLoad/e3d2cc.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/e3d2cc.wgsl.expected.wgsl new file mode 100644 index 0000000000..97cb8d8967 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/e3d2cc.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_multisampled_2d; + +fn textureLoad_e3d2cc() { + var arg_1 = vec2(); + var arg_2 = 1; + var res : vec4 = textureLoad(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_e3d2cc(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureLoad_e3d2cc(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureLoad_e3d2cc(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/024820.wgsl b/test/tint/builtins/gen/var/textureNumLayers/024820.wgsl new file mode 100644 index 0000000000..ee39dbbd35 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/024820.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; + +// fn textureNumLayers(texture: texture_2d_array) -> i32 +fn textureNumLayers_024820() { + var res: i32 = textureNumLayers(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_024820(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLayers_024820(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLayers_024820(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/024820.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/024820.wgsl.expected.glsl new file mode 100644 index 0000000000..9e3639f215 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/024820.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp sampler2DArray arg_0_1; +void textureNumLayers_024820() { + int res = textureSize(arg_0_1, 0).z; +} + +vec4 vertex_main() { + textureNumLayers_024820(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DArray arg_0_1; +void textureNumLayers_024820() { + int res = textureSize(arg_0_1, 0).z; +} + +void fragment_main() { + textureNumLayers_024820(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DArray arg_0_1; +void textureNumLayers_024820() { + int res = textureSize(arg_0_1, 0).z; +} + +void compute_main() { + textureNumLayers_024820(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/024820.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLayers/024820.wgsl.expected.hlsl new file mode 100644 index 0000000000..c54de32f98 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/024820.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureNumLayers_024820() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_024820(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_024820(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_024820(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/024820.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/024820.wgsl.expected.msl new file mode 100644 index 0000000000..62c3cdabae --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/024820.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_024820(texture2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureNumLayers_024820(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_024820(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_024820(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLayers/024820.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/024820.wgsl.expected.spvasm new file mode 100644 index 0000000000..5c65a190bc --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/024820.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLayers_024820 "textureNumLayers_024820" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %int_0 = OpConstant %int 0 +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLayers_024820 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_int Function %24 + %20 = OpLoad %11 %arg_0 + %18 = OpImageQuerySizeLod %v3int %20 %int_0 + %16 = OpCompositeExtract %int %18 2 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %textureNumLayers_024820 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %34 = OpLabel + %35 = OpFunctionCall %void %textureNumLayers_024820 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %37 = OpLabel + %38 = OpFunctionCall %void %textureNumLayers_024820 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLayers/024820.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/024820.wgsl.expected.wgsl new file mode 100644 index 0000000000..f58c93cef4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/024820.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +fn textureNumLayers_024820() { + var res : i32 = textureNumLayers(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_024820(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLayers_024820(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLayers_024820(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/053df7.wgsl b/test/tint/builtins/gen/var/textureNumLayers/053df7.wgsl new file mode 100644 index 0000000000..f906fef223 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/053df7.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube_array; + +// fn textureNumLayers(texture: texture_cube_array) -> i32 +fn textureNumLayers_053df7() { + var res: i32 = textureNumLayers(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_053df7(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLayers_053df7(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLayers_053df7(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/053df7.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/053df7.wgsl.expected.glsl new file mode 100644 index 0000000000..e995abb9b6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/053df7.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +uniform highp usamplerCubeArray arg_0_1; +void textureNumLayers_053df7() { + int res = textureSize(arg_0_1, 0).z; +} + +vec4 vertex_main() { + textureNumLayers_053df7(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'usamplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp usamplerCubeArray arg_0_1; +void textureNumLayers_053df7() { + int res = textureSize(arg_0_1, 0).z; +} + +void fragment_main() { + textureNumLayers_053df7(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'usamplerCubeArray' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp usamplerCubeArray arg_0_1; +void textureNumLayers_053df7() { + int res = textureSize(arg_0_1, 0).z; +} + +void compute_main() { + textureNumLayers_053df7(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'usamplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureNumLayers/053df7.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLayers/053df7.wgsl.expected.hlsl new file mode 100644 index 0000000000..ec0865280f --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/053df7.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureNumLayers_053df7() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_053df7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_053df7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_053df7(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/053df7.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/053df7.wgsl.expected.msl new file mode 100644 index 0000000000..68ceeb46a3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/053df7.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_053df7(texturecube_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube_array tint_symbol_2) { + textureNumLayers_053df7(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_053df7(tint_symbol_4); + return; +} + +kernel void compute_main(texturecube_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_053df7(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLayers/053df7.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/053df7.wgsl.expected.spvasm new file mode 100644 index 0000000000..a8336ca7d5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/053df7.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLayers_053df7 "textureNumLayers_053df7" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %int_0 = OpConstant %int 0 +%_ptr_Function_int = OpTypePointer Function %int + %25 = OpConstantNull %int + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLayers_053df7 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %25 + %21 = OpLoad %11 %arg_0 + %19 = OpImageQuerySizeLod %v3int %21 %int_0 + %17 = OpCompositeExtract %int %19 2 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %textureNumLayers_053df7 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureNumLayers_053df7 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %38 = OpLabel + %39 = OpFunctionCall %void %textureNumLayers_053df7 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLayers/053df7.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/053df7.wgsl.expected.wgsl new file mode 100644 index 0000000000..fae44b9a2b --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/053df7.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_cube_array; + +fn textureNumLayers_053df7() { + var res : i32 = textureNumLayers(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_053df7(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLayers_053df7(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLayers_053df7(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/058cc3.wgsl b/test/tint/builtins/gen/var/textureNumLayers/058cc3.wgsl new file mode 100644 index 0000000000..55e7ee0848 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/058cc3.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureNumLayers(texture: texture_storage_2d_array) -> i32 +fn textureNumLayers_058cc3() { + var res: i32 = textureNumLayers(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_058cc3(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLayers_058cc3(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLayers_058cc3(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/058cc3.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/058cc3.wgsl.expected.glsl new file mode 100644 index 0000000000..0730d3a356 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/058cc3.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32i) uniform highp writeonly iimage2DArray arg_0; +void textureNumLayers_058cc3() { + int res = imageSize(arg_0).z; +} + +vec4 vertex_main() { + textureNumLayers_058cc3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32i) uniform highp writeonly iimage2DArray arg_0; +void textureNumLayers_058cc3() { + int res = imageSize(arg_0).z; +} + +void fragment_main() { + textureNumLayers_058cc3(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32i) uniform highp writeonly iimage2DArray arg_0; +void textureNumLayers_058cc3() { + int res = imageSize(arg_0).z; +} + +void compute_main() { + textureNumLayers_058cc3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureNumLayers/058cc3.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLayers/058cc3.wgsl.expected.hlsl new file mode 100644 index 0000000000..0f9f61ae48 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/058cc3.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_058cc3() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_058cc3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_058cc3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_058cc3(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/058cc3.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/058cc3.wgsl.expected.msl new file mode 100644 index 0000000000..f89aa0051f --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/058cc3.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_058cc3(texture2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureNumLayers_058cc3(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_058cc3(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_058cc3(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLayers/058cc3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/058cc3.wgsl.expected.spvasm new file mode 100644 index 0000000000..4737d7e08a --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/058cc3.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability StorageImageExtendedFormats + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLayers_058cc3 "textureNumLayers_058cc3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 1 0 2 Rg32i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v3int = OpTypeVector %int 3 +%_ptr_Function_int = OpTypePointer Function %int + %23 = OpConstantNull %int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLayers_058cc3 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %23 + %20 = OpLoad %11 %arg_0 + %18 = OpImageQuerySize %v3int %20 + %17 = OpCompositeExtract %int %18 2 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureNumLayers_058cc3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %33 = OpLabel + %34 = OpFunctionCall %void %textureNumLayers_058cc3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %36 = OpLabel + %37 = OpFunctionCall %void %textureNumLayers_058cc3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLayers/058cc3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/058cc3.wgsl.expected.wgsl new file mode 100644 index 0000000000..ee5d2e0686 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/058cc3.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureNumLayers_058cc3() { + var res : i32 = textureNumLayers(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_058cc3(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLayers_058cc3(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLayers_058cc3(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/09d05d.wgsl b/test/tint/builtins/gen/var/textureNumLayers/09d05d.wgsl new file mode 100644 index 0000000000..baf9538784 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/09d05d.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureNumLayers(texture: texture_storage_2d_array) -> i32 +fn textureNumLayers_09d05d() { + var res: i32 = textureNumLayers(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_09d05d(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLayers_09d05d(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLayers_09d05d(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/09d05d.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/09d05d.wgsl.expected.glsl new file mode 100644 index 0000000000..25b7ded5ea --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/09d05d.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba8) uniform highp writeonly image2DArray arg_0; +void textureNumLayers_09d05d() { + int res = imageSize(arg_0).z; +} + +vec4 vertex_main() { + textureNumLayers_09d05d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8) uniform highp writeonly image2DArray arg_0; +void textureNumLayers_09d05d() { + int res = imageSize(arg_0).z; +} + +void fragment_main() { + textureNumLayers_09d05d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8) uniform highp writeonly image2DArray arg_0; +void textureNumLayers_09d05d() { + int res = imageSize(arg_0).z; +} + +void compute_main() { + textureNumLayers_09d05d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/09d05d.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLayers/09d05d.wgsl.expected.hlsl new file mode 100644 index 0000000000..c52cd47ecc --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/09d05d.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_09d05d() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_09d05d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_09d05d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_09d05d(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/09d05d.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/09d05d.wgsl.expected.msl new file mode 100644 index 0000000000..6666c52d32 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/09d05d.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_09d05d(texture2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureNumLayers_09d05d(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_09d05d(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_09d05d(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLayers/09d05d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/09d05d.wgsl.expected.spvasm new file mode 100644 index 0000000000..e70fdfceba --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/09d05d.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLayers_09d05d "textureNumLayers_09d05d" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 2 Rgba8 +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 +%_ptr_Function_int = OpTypePointer Function %int + %23 = OpConstantNull %int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLayers_09d05d = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_int Function %23 + %20 = OpLoad %11 %arg_0 + %18 = OpImageQuerySize %v3int %20 + %16 = OpCompositeExtract %int %18 2 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureNumLayers_09d05d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %33 = OpLabel + %34 = OpFunctionCall %void %textureNumLayers_09d05d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureNumLayers_09d05d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLayers/09d05d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/09d05d.wgsl.expected.wgsl new file mode 100644 index 0000000000..2034fa4019 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/09d05d.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureNumLayers_09d05d() { + var res : i32 = textureNumLayers(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_09d05d(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLayers_09d05d(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLayers_09d05d(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/13b4ce.wgsl b/test/tint/builtins/gen/var/textureNumLayers/13b4ce.wgsl new file mode 100644 index 0000000000..e21134db8b --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/13b4ce.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureNumLayers(texture: texture_storage_2d_array) -> i32 +fn textureNumLayers_13b4ce() { + var res: i32 = textureNumLayers(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_13b4ce(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLayers_13b4ce(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLayers_13b4ce(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/13b4ce.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/13b4ce.wgsl.expected.glsl new file mode 100644 index 0000000000..f09006795c --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/13b4ce.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba32i) uniform highp writeonly iimage2DArray arg_0; +void textureNumLayers_13b4ce() { + int res = imageSize(arg_0).z; +} + +vec4 vertex_main() { + textureNumLayers_13b4ce(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba32i) uniform highp writeonly iimage2DArray arg_0; +void textureNumLayers_13b4ce() { + int res = imageSize(arg_0).z; +} + +void fragment_main() { + textureNumLayers_13b4ce(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba32i) uniform highp writeonly iimage2DArray arg_0; +void textureNumLayers_13b4ce() { + int res = imageSize(arg_0).z; +} + +void compute_main() { + textureNumLayers_13b4ce(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/13b4ce.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLayers/13b4ce.wgsl.expected.hlsl new file mode 100644 index 0000000000..4d9ac8afb4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/13b4ce.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_13b4ce() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_13b4ce(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_13b4ce(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_13b4ce(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/13b4ce.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/13b4ce.wgsl.expected.msl new file mode 100644 index 0000000000..bb33ae6c61 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/13b4ce.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_13b4ce(texture2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureNumLayers_13b4ce(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_13b4ce(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_13b4ce(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLayers/13b4ce.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/13b4ce.wgsl.expected.spvasm new file mode 100644 index 0000000000..651790d490 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/13b4ce.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLayers_13b4ce "textureNumLayers_13b4ce" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 1 0 2 Rgba32i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v3int = OpTypeVector %int 3 +%_ptr_Function_int = OpTypePointer Function %int + %23 = OpConstantNull %int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLayers_13b4ce = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %23 + %20 = OpLoad %11 %arg_0 + %18 = OpImageQuerySize %v3int %20 + %17 = OpCompositeExtract %int %18 2 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureNumLayers_13b4ce + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %33 = OpLabel + %34 = OpFunctionCall %void %textureNumLayers_13b4ce + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %36 = OpLabel + %37 = OpFunctionCall %void %textureNumLayers_13b4ce + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLayers/13b4ce.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/13b4ce.wgsl.expected.wgsl new file mode 100644 index 0000000000..5061e7e950 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/13b4ce.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureNumLayers_13b4ce() { + var res : i32 = textureNumLayers(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_13b4ce(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLayers_13b4ce(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLayers_13b4ce(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/22e53b.wgsl b/test/tint/builtins/gen/var/textureNumLayers/22e53b.wgsl new file mode 100644 index 0000000000..a74f529565 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/22e53b.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureNumLayers(texture: texture_storage_2d_array) -> i32 +fn textureNumLayers_22e53b() { + var res: i32 = textureNumLayers(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_22e53b(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLayers_22e53b(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLayers_22e53b(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/22e53b.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/22e53b.wgsl.expected.glsl new file mode 100644 index 0000000000..3902bb39d0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/22e53b.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(r32i) uniform highp writeonly iimage2DArray arg_0; +void textureNumLayers_22e53b() { + int res = imageSize(arg_0).z; +} + +vec4 vertex_main() { + textureNumLayers_22e53b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(r32i) uniform highp writeonly iimage2DArray arg_0; +void textureNumLayers_22e53b() { + int res = imageSize(arg_0).z; +} + +void fragment_main() { + textureNumLayers_22e53b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(r32i) uniform highp writeonly iimage2DArray arg_0; +void textureNumLayers_22e53b() { + int res = imageSize(arg_0).z; +} + +void compute_main() { + textureNumLayers_22e53b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/22e53b.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLayers/22e53b.wgsl.expected.hlsl new file mode 100644 index 0000000000..8611a5211c --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/22e53b.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_22e53b() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_22e53b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_22e53b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_22e53b(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/22e53b.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/22e53b.wgsl.expected.msl new file mode 100644 index 0000000000..5c5fa33da1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/22e53b.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_22e53b(texture2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureNumLayers_22e53b(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_22e53b(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_22e53b(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLayers/22e53b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/22e53b.wgsl.expected.spvasm new file mode 100644 index 0000000000..953a4a4d4f --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/22e53b.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLayers_22e53b "textureNumLayers_22e53b" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 1 0 2 R32i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v3int = OpTypeVector %int 3 +%_ptr_Function_int = OpTypePointer Function %int + %23 = OpConstantNull %int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLayers_22e53b = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %23 + %20 = OpLoad %11 %arg_0 + %18 = OpImageQuerySize %v3int %20 + %17 = OpCompositeExtract %int %18 2 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureNumLayers_22e53b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %33 = OpLabel + %34 = OpFunctionCall %void %textureNumLayers_22e53b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %36 = OpLabel + %37 = OpFunctionCall %void %textureNumLayers_22e53b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLayers/22e53b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/22e53b.wgsl.expected.wgsl new file mode 100644 index 0000000000..6d9957b55d --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/22e53b.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureNumLayers_22e53b() { + var res : i32 = textureNumLayers(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_22e53b(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLayers_22e53b(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLayers_22e53b(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/562013.wgsl b/test/tint/builtins/gen/var/textureNumLayers/562013.wgsl new file mode 100644 index 0000000000..b6f1c4891b --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/562013.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureNumLayers(texture: texture_storage_2d_array) -> i32 +fn textureNumLayers_562013() { + var res: i32 = textureNumLayers(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_562013(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLayers_562013(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLayers_562013(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/562013.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/562013.wgsl.expected.glsl new file mode 100644 index 0000000000..713a325a69 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/562013.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba16f) uniform highp writeonly image2DArray arg_0; +void textureNumLayers_562013() { + int res = imageSize(arg_0).z; +} + +vec4 vertex_main() { + textureNumLayers_562013(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba16f) uniform highp writeonly image2DArray arg_0; +void textureNumLayers_562013() { + int res = imageSize(arg_0).z; +} + +void fragment_main() { + textureNumLayers_562013(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba16f) uniform highp writeonly image2DArray arg_0; +void textureNumLayers_562013() { + int res = imageSize(arg_0).z; +} + +void compute_main() { + textureNumLayers_562013(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/562013.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLayers/562013.wgsl.expected.hlsl new file mode 100644 index 0000000000..59664cc21b --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/562013.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_562013() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_562013(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_562013(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_562013(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/562013.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/562013.wgsl.expected.msl new file mode 100644 index 0000000000..97a5498d1b --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/562013.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_562013(texture2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureNumLayers_562013(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_562013(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_562013(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLayers/562013.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/562013.wgsl.expected.spvasm new file mode 100644 index 0000000000..96b0fc25af --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/562013.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLayers_562013 "textureNumLayers_562013" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 2 Rgba16f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 +%_ptr_Function_int = OpTypePointer Function %int + %23 = OpConstantNull %int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLayers_562013 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_int Function %23 + %20 = OpLoad %11 %arg_0 + %18 = OpImageQuerySize %v3int %20 + %16 = OpCompositeExtract %int %18 2 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureNumLayers_562013 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %33 = OpLabel + %34 = OpFunctionCall %void %textureNumLayers_562013 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureNumLayers_562013 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLayers/562013.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/562013.wgsl.expected.wgsl new file mode 100644 index 0000000000..72231707de --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/562013.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureNumLayers_562013() { + var res : i32 = textureNumLayers(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_562013(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLayers_562013(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLayers_562013(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/5d59cd.wgsl b/test/tint/builtins/gen/var/textureNumLayers/5d59cd.wgsl new file mode 100644 index 0000000000..d808df9b03 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/5d59cd.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube_array; + +// fn textureNumLayers(texture: texture_cube_array) -> i32 +fn textureNumLayers_5d59cd() { + var res: i32 = textureNumLayers(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_5d59cd(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLayers_5d59cd(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLayers_5d59cd(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/5d59cd.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/5d59cd.wgsl.expected.glsl new file mode 100644 index 0000000000..c469183479 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/5d59cd.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +uniform highp samplerCubeArray arg_0_1; +void textureNumLayers_5d59cd() { + int res = textureSize(arg_0_1, 0).z; +} + +vec4 vertex_main() { + textureNumLayers_5d59cd(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp samplerCubeArray arg_0_1; +void textureNumLayers_5d59cd() { + int res = textureSize(arg_0_1, 0).z; +} + +void fragment_main() { + textureNumLayers_5d59cd(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'samplerCubeArray' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp samplerCubeArray arg_0_1; +void textureNumLayers_5d59cd() { + int res = textureSize(arg_0_1, 0).z; +} + +void compute_main() { + textureNumLayers_5d59cd(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureNumLayers/5d59cd.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLayers/5d59cd.wgsl.expected.hlsl new file mode 100644 index 0000000000..063ac3bee8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/5d59cd.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureNumLayers_5d59cd() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_5d59cd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_5d59cd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_5d59cd(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/5d59cd.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/5d59cd.wgsl.expected.msl new file mode 100644 index 0000000000..aa7890e4f0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/5d59cd.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_5d59cd(texturecube_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube_array tint_symbol_2) { + textureNumLayers_5d59cd(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_5d59cd(tint_symbol_4); + return; +} + +kernel void compute_main(texturecube_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_5d59cd(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLayers/5d59cd.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/5d59cd.wgsl.expected.spvasm new file mode 100644 index 0000000000..e7f1f9e666 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/5d59cd.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLayers_5d59cd "textureNumLayers_5d59cd" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %int_0 = OpConstant %int 0 +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLayers_5d59cd = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_int Function %24 + %20 = OpLoad %11 %arg_0 + %18 = OpImageQuerySizeLod %v3int %20 %int_0 + %16 = OpCompositeExtract %int %18 2 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %textureNumLayers_5d59cd + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %34 = OpLabel + %35 = OpFunctionCall %void %textureNumLayers_5d59cd + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %37 = OpLabel + %38 = OpFunctionCall %void %textureNumLayers_5d59cd + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLayers/5d59cd.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/5d59cd.wgsl.expected.wgsl new file mode 100644 index 0000000000..170c76310d --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/5d59cd.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_cube_array; + +fn textureNumLayers_5d59cd() { + var res : i32 = textureNumLayers(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_5d59cd(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLayers_5d59cd(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLayers_5d59cd(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/68a65b.wgsl b/test/tint/builtins/gen/var/textureNumLayers/68a65b.wgsl new file mode 100644 index 0000000000..680221f648 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/68a65b.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureNumLayers(texture: texture_storage_2d_array) -> i32 +fn textureNumLayers_68a65b() { + var res: i32 = textureNumLayers(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_68a65b(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLayers_68a65b(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLayers_68a65b(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/68a65b.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/68a65b.wgsl.expected.glsl new file mode 100644 index 0000000000..38cd9e7208 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/68a65b.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba32f) uniform highp writeonly image2DArray arg_0; +void textureNumLayers_68a65b() { + int res = imageSize(arg_0).z; +} + +vec4 vertex_main() { + textureNumLayers_68a65b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba32f) uniform highp writeonly image2DArray arg_0; +void textureNumLayers_68a65b() { + int res = imageSize(arg_0).z; +} + +void fragment_main() { + textureNumLayers_68a65b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba32f) uniform highp writeonly image2DArray arg_0; +void textureNumLayers_68a65b() { + int res = imageSize(arg_0).z; +} + +void compute_main() { + textureNumLayers_68a65b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/68a65b.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLayers/68a65b.wgsl.expected.hlsl new file mode 100644 index 0000000000..cefd82036d --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/68a65b.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_68a65b() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_68a65b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_68a65b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_68a65b(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/68a65b.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/68a65b.wgsl.expected.msl new file mode 100644 index 0000000000..906ffc528e --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/68a65b.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_68a65b(texture2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureNumLayers_68a65b(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_68a65b(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_68a65b(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLayers/68a65b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/68a65b.wgsl.expected.spvasm new file mode 100644 index 0000000000..53d6ff2d51 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/68a65b.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLayers_68a65b "textureNumLayers_68a65b" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 2 Rgba32f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 +%_ptr_Function_int = OpTypePointer Function %int + %23 = OpConstantNull %int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLayers_68a65b = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_int Function %23 + %20 = OpLoad %11 %arg_0 + %18 = OpImageQuerySize %v3int %20 + %16 = OpCompositeExtract %int %18 2 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureNumLayers_68a65b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %33 = OpLabel + %34 = OpFunctionCall %void %textureNumLayers_68a65b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureNumLayers_68a65b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLayers/68a65b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/68a65b.wgsl.expected.wgsl new file mode 100644 index 0000000000..f358993084 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/68a65b.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureNumLayers_68a65b() { + var res : i32 = textureNumLayers(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_68a65b(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLayers_68a65b(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLayers_68a65b(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/778bd1.wgsl b/test/tint/builtins/gen/var/textureNumLayers/778bd1.wgsl new file mode 100644 index 0000000000..814bad17d6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/778bd1.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_cube_array; + +// fn textureNumLayers(texture: texture_depth_cube_array) -> i32 +fn textureNumLayers_778bd1() { + var res: i32 = textureNumLayers(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_778bd1(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLayers_778bd1(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLayers_778bd1(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/778bd1.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/778bd1.wgsl.expected.glsl new file mode 100644 index 0000000000..40debcc79c --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/778bd1.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +uniform highp samplerCubeArray arg_0_1; +void textureNumLayers_778bd1() { + int res = textureSize(arg_0_1, 0).z; +} + +vec4 vertex_main() { + textureNumLayers_778bd1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp samplerCubeArray arg_0_1; +void textureNumLayers_778bd1() { + int res = textureSize(arg_0_1, 0).z; +} + +void fragment_main() { + textureNumLayers_778bd1(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'samplerCubeArray' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp samplerCubeArray arg_0_1; +void textureNumLayers_778bd1() { + int res = textureSize(arg_0_1, 0).z; +} + +void compute_main() { + textureNumLayers_778bd1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureNumLayers/778bd1.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLayers/778bd1.wgsl.expected.hlsl new file mode 100644 index 0000000000..198c36ba40 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/778bd1.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureNumLayers_778bd1() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_778bd1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_778bd1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_778bd1(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/778bd1.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/778bd1.wgsl.expected.msl new file mode 100644 index 0000000000..fc13fba684 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/778bd1.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_778bd1(depthcube_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depthcube_array tint_symbol_2) { + textureNumLayers_778bd1(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depthcube_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depthcube_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_778bd1(tint_symbol_4); + return; +} + +kernel void compute_main(depthcube_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_778bd1(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLayers/778bd1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/778bd1.wgsl.expected.spvasm new file mode 100644 index 0000000000..b1fd36b654 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/778bd1.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLayers_778bd1 "textureNumLayers_778bd1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %int_0 = OpConstant %int 0 +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLayers_778bd1 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_int Function %24 + %20 = OpLoad %11 %arg_0 + %18 = OpImageQuerySizeLod %v3int %20 %int_0 + %16 = OpCompositeExtract %int %18 2 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %textureNumLayers_778bd1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %34 = OpLabel + %35 = OpFunctionCall %void %textureNumLayers_778bd1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %37 = OpLabel + %38 = OpFunctionCall %void %textureNumLayers_778bd1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLayers/778bd1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/778bd1.wgsl.expected.wgsl new file mode 100644 index 0000000000..c13e994169 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/778bd1.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_depth_cube_array; + +fn textureNumLayers_778bd1() { + var res : i32 = textureNumLayers(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_778bd1(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLayers_778bd1(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLayers_778bd1(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/7f1937.wgsl b/test/tint/builtins/gen/var/textureNumLayers/7f1937.wgsl new file mode 100644 index 0000000000..7e843bd811 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/7f1937.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureNumLayers(texture: texture_storage_2d_array) -> i32 +fn textureNumLayers_7f1937() { + var res: i32 = textureNumLayers(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_7f1937(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLayers_7f1937(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLayers_7f1937(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/7f1937.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/7f1937.wgsl.expected.glsl new file mode 100644 index 0000000000..f6fdbf0fce --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/7f1937.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32f) uniform highp writeonly image2DArray arg_0; +void textureNumLayers_7f1937() { + int res = imageSize(arg_0).z; +} + +vec4 vertex_main() { + textureNumLayers_7f1937(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32f) uniform highp writeonly image2DArray arg_0; +void textureNumLayers_7f1937() { + int res = imageSize(arg_0).z; +} + +void fragment_main() { + textureNumLayers_7f1937(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32f) uniform highp writeonly image2DArray arg_0; +void textureNumLayers_7f1937() { + int res = imageSize(arg_0).z; +} + +void compute_main() { + textureNumLayers_7f1937(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureNumLayers/7f1937.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLayers/7f1937.wgsl.expected.hlsl new file mode 100644 index 0000000000..edd423aea6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/7f1937.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_7f1937() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_7f1937(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_7f1937(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_7f1937(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/7f1937.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/7f1937.wgsl.expected.msl new file mode 100644 index 0000000000..05239dae46 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/7f1937.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_7f1937(texture2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureNumLayers_7f1937(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_7f1937(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_7f1937(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLayers/7f1937.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/7f1937.wgsl.expected.spvasm new file mode 100644 index 0000000000..59d909df01 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/7f1937.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability StorageImageExtendedFormats + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLayers_7f1937 "textureNumLayers_7f1937" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 2 Rg32f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 +%_ptr_Function_int = OpTypePointer Function %int + %23 = OpConstantNull %int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLayers_7f1937 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_int Function %23 + %20 = OpLoad %11 %arg_0 + %18 = OpImageQuerySize %v3int %20 + %16 = OpCompositeExtract %int %18 2 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureNumLayers_7f1937 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %33 = OpLabel + %34 = OpFunctionCall %void %textureNumLayers_7f1937 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureNumLayers_7f1937 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLayers/7f1937.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/7f1937.wgsl.expected.wgsl new file mode 100644 index 0000000000..4450cebde7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/7f1937.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureNumLayers_7f1937() { + var res : i32 = textureNumLayers(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_7f1937(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLayers_7f1937(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLayers_7f1937(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/85f980.wgsl b/test/tint/builtins/gen/var/textureNumLayers/85f980.wgsl new file mode 100644 index 0000000000..dc95da7630 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/85f980.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube_array; + +// fn textureNumLayers(texture: texture_cube_array) -> i32 +fn textureNumLayers_85f980() { + var res: i32 = textureNumLayers(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_85f980(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLayers_85f980(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLayers_85f980(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/85f980.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/85f980.wgsl.expected.glsl new file mode 100644 index 0000000000..529bfb372b --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/85f980.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +uniform highp isamplerCubeArray arg_0_1; +void textureNumLayers_85f980() { + int res = textureSize(arg_0_1, 0).z; +} + +vec4 vertex_main() { + textureNumLayers_85f980(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'isamplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp isamplerCubeArray arg_0_1; +void textureNumLayers_85f980() { + int res = textureSize(arg_0_1, 0).z; +} + +void fragment_main() { + textureNumLayers_85f980(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'isamplerCubeArray' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp isamplerCubeArray arg_0_1; +void textureNumLayers_85f980() { + int res = textureSize(arg_0_1, 0).z; +} + +void compute_main() { + textureNumLayers_85f980(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'isamplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureNumLayers/85f980.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLayers/85f980.wgsl.expected.hlsl new file mode 100644 index 0000000000..bd6cdc4517 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/85f980.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureNumLayers_85f980() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_85f980(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_85f980(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_85f980(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/85f980.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/85f980.wgsl.expected.msl new file mode 100644 index 0000000000..e1b10ebfdc --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/85f980.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_85f980(texturecube_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube_array tint_symbol_2) { + textureNumLayers_85f980(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_85f980(tint_symbol_4); + return; +} + +kernel void compute_main(texturecube_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_85f980(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLayers/85f980.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/85f980.wgsl.expected.spvasm new file mode 100644 index 0000000000..4484cadba1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/85f980.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLayers_85f980 "textureNumLayers_85f980" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v3int = OpTypeVector %int 3 + %int_0 = OpConstant %int 0 +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLayers_85f980 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %24 + %20 = OpLoad %11 %arg_0 + %18 = OpImageQuerySizeLod %v3int %20 %int_0 + %17 = OpCompositeExtract %int %18 2 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %textureNumLayers_85f980 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %void %textureNumLayers_85f980 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %37 = OpLabel + %38 = OpFunctionCall %void %textureNumLayers_85f980 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLayers/85f980.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/85f980.wgsl.expected.wgsl new file mode 100644 index 0000000000..4dc70c7371 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/85f980.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_cube_array; + +fn textureNumLayers_85f980() { + var res : i32 = textureNumLayers(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_85f980(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLayers_85f980(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLayers_85f980(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/87953e.wgsl b/test/tint/builtins/gen/var/textureNumLayers/87953e.wgsl new file mode 100644 index 0000000000..09bb3e89bd --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/87953e.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; + +// fn textureNumLayers(texture: texture_2d_array) -> i32 +fn textureNumLayers_87953e() { + var res: i32 = textureNumLayers(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_87953e(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLayers_87953e(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLayers_87953e(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/87953e.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/87953e.wgsl.expected.glsl new file mode 100644 index 0000000000..83bae633ce --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/87953e.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp usampler2DArray arg_0_1; +void textureNumLayers_87953e() { + int res = textureSize(arg_0_1, 0).z; +} + +vec4 vertex_main() { + textureNumLayers_87953e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp usampler2DArray arg_0_1; +void textureNumLayers_87953e() { + int res = textureSize(arg_0_1, 0).z; +} + +void fragment_main() { + textureNumLayers_87953e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp usampler2DArray arg_0_1; +void textureNumLayers_87953e() { + int res = textureSize(arg_0_1, 0).z; +} + +void compute_main() { + textureNumLayers_87953e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/87953e.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLayers/87953e.wgsl.expected.hlsl new file mode 100644 index 0000000000..5c563c486d --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/87953e.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureNumLayers_87953e() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_87953e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_87953e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_87953e(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/87953e.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/87953e.wgsl.expected.msl new file mode 100644 index 0000000000..971482f10b --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/87953e.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_87953e(texture2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureNumLayers_87953e(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_87953e(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_87953e(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLayers/87953e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/87953e.wgsl.expected.spvasm new file mode 100644 index 0000000000..109f2d05bb --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/87953e.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLayers_87953e "textureNumLayers_87953e" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %int_0 = OpConstant %int 0 +%_ptr_Function_int = OpTypePointer Function %int + %25 = OpConstantNull %int + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLayers_87953e = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %25 + %21 = OpLoad %11 %arg_0 + %19 = OpImageQuerySizeLod %v3int %21 %int_0 + %17 = OpCompositeExtract %int %19 2 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %textureNumLayers_87953e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureNumLayers_87953e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %38 = OpLabel + %39 = OpFunctionCall %void %textureNumLayers_87953e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLayers/87953e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/87953e.wgsl.expected.wgsl new file mode 100644 index 0000000000..26f73eaa53 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/87953e.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +fn textureNumLayers_87953e() { + var res : i32 = textureNumLayers(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_87953e(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLayers_87953e(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLayers_87953e(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/893e7c.wgsl b/test/tint/builtins/gen/var/textureNumLayers/893e7c.wgsl new file mode 100644 index 0000000000..343198531f --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/893e7c.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; + +// fn textureNumLayers(texture: texture_2d_array) -> i32 +fn textureNumLayers_893e7c() { + var res: i32 = textureNumLayers(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_893e7c(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLayers_893e7c(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLayers_893e7c(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/893e7c.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/893e7c.wgsl.expected.glsl new file mode 100644 index 0000000000..e2d0eb6a5d --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/893e7c.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp isampler2DArray arg_0_1; +void textureNumLayers_893e7c() { + int res = textureSize(arg_0_1, 0).z; +} + +vec4 vertex_main() { + textureNumLayers_893e7c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp isampler2DArray arg_0_1; +void textureNumLayers_893e7c() { + int res = textureSize(arg_0_1, 0).z; +} + +void fragment_main() { + textureNumLayers_893e7c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp isampler2DArray arg_0_1; +void textureNumLayers_893e7c() { + int res = textureSize(arg_0_1, 0).z; +} + +void compute_main() { + textureNumLayers_893e7c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/893e7c.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLayers/893e7c.wgsl.expected.hlsl new file mode 100644 index 0000000000..0991385af2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/893e7c.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureNumLayers_893e7c() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_893e7c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_893e7c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_893e7c(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/893e7c.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/893e7c.wgsl.expected.msl new file mode 100644 index 0000000000..66d329d6ed --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/893e7c.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_893e7c(texture2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureNumLayers_893e7c(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_893e7c(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_893e7c(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLayers/893e7c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/893e7c.wgsl.expected.spvasm new file mode 100644 index 0000000000..22bfd83dad --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/893e7c.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLayers_893e7c "textureNumLayers_893e7c" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v3int = OpTypeVector %int 3 + %int_0 = OpConstant %int 0 +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLayers_893e7c = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %24 + %20 = OpLoad %11 %arg_0 + %18 = OpImageQuerySizeLod %v3int %20 %int_0 + %17 = OpCompositeExtract %int %18 2 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %textureNumLayers_893e7c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %void %textureNumLayers_893e7c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %37 = OpLabel + %38 = OpFunctionCall %void %textureNumLayers_893e7c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLayers/893e7c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/893e7c.wgsl.expected.wgsl new file mode 100644 index 0000000000..3cda54612f --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/893e7c.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +fn textureNumLayers_893e7c() { + var res : i32 = textureNumLayers(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_893e7c(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLayers_893e7c(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLayers_893e7c(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/9700fb.wgsl b/test/tint/builtins/gen/var/textureNumLayers/9700fb.wgsl new file mode 100644 index 0000000000..096b3e85ca --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/9700fb.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureNumLayers(texture: texture_storage_2d_array) -> i32 +fn textureNumLayers_9700fb() { + var res: i32 = textureNumLayers(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_9700fb(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLayers_9700fb(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLayers_9700fb(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/9700fb.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/9700fb.wgsl.expected.glsl new file mode 100644 index 0000000000..24b2d5dcdf --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/9700fb.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba16ui) uniform highp writeonly uimage2DArray arg_0; +void textureNumLayers_9700fb() { + int res = imageSize(arg_0).z; +} + +vec4 vertex_main() { + textureNumLayers_9700fb(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba16ui) uniform highp writeonly uimage2DArray arg_0; +void textureNumLayers_9700fb() { + int res = imageSize(arg_0).z; +} + +void fragment_main() { + textureNumLayers_9700fb(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba16ui) uniform highp writeonly uimage2DArray arg_0; +void textureNumLayers_9700fb() { + int res = imageSize(arg_0).z; +} + +void compute_main() { + textureNumLayers_9700fb(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/9700fb.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLayers/9700fb.wgsl.expected.hlsl new file mode 100644 index 0000000000..63205b7d81 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/9700fb.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_9700fb() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_9700fb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_9700fb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_9700fb(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/9700fb.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/9700fb.wgsl.expected.msl new file mode 100644 index 0000000000..1b296c7c8d --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/9700fb.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_9700fb(texture2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureNumLayers_9700fb(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_9700fb(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_9700fb(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLayers/9700fb.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/9700fb.wgsl.expected.spvasm new file mode 100644 index 0000000000..49864947b4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/9700fb.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLayers_9700fb "textureNumLayers_9700fb" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 1 0 2 Rgba16ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLayers_9700fb = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %24 + %21 = OpLoad %11 %arg_0 + %19 = OpImageQuerySize %v3int %21 + %17 = OpCompositeExtract %int %19 2 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %textureNumLayers_9700fb + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %void %textureNumLayers_9700fb + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %37 = OpLabel + %38 = OpFunctionCall %void %textureNumLayers_9700fb + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLayers/9700fb.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/9700fb.wgsl.expected.wgsl new file mode 100644 index 0000000000..ce6acab433 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/9700fb.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureNumLayers_9700fb() { + var res : i32 = textureNumLayers(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_9700fb(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLayers_9700fb(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLayers_9700fb(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/a216d2.wgsl b/test/tint/builtins/gen/var/textureNumLayers/a216d2.wgsl new file mode 100644 index 0000000000..176205aac9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/a216d2.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureNumLayers(texture: texture_storage_2d_array) -> i32 +fn textureNumLayers_a216d2() { + var res: i32 = textureNumLayers(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_a216d2(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLayers_a216d2(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLayers_a216d2(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/a216d2.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/a216d2.wgsl.expected.glsl new file mode 100644 index 0000000000..a6deec3075 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/a216d2.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba8i) uniform highp writeonly iimage2DArray arg_0; +void textureNumLayers_a216d2() { + int res = imageSize(arg_0).z; +} + +vec4 vertex_main() { + textureNumLayers_a216d2(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8i) uniform highp writeonly iimage2DArray arg_0; +void textureNumLayers_a216d2() { + int res = imageSize(arg_0).z; +} + +void fragment_main() { + textureNumLayers_a216d2(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8i) uniform highp writeonly iimage2DArray arg_0; +void textureNumLayers_a216d2() { + int res = imageSize(arg_0).z; +} + +void compute_main() { + textureNumLayers_a216d2(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/a216d2.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLayers/a216d2.wgsl.expected.hlsl new file mode 100644 index 0000000000..d9cf5006ba --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/a216d2.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_a216d2() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_a216d2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_a216d2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_a216d2(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/a216d2.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/a216d2.wgsl.expected.msl new file mode 100644 index 0000000000..427fe4f144 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/a216d2.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_a216d2(texture2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureNumLayers_a216d2(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_a216d2(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_a216d2(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLayers/a216d2.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/a216d2.wgsl.expected.spvasm new file mode 100644 index 0000000000..2d82417876 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/a216d2.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLayers_a216d2 "textureNumLayers_a216d2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 1 0 2 Rgba8i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v3int = OpTypeVector %int 3 +%_ptr_Function_int = OpTypePointer Function %int + %23 = OpConstantNull %int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLayers_a216d2 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %23 + %20 = OpLoad %11 %arg_0 + %18 = OpImageQuerySize %v3int %20 + %17 = OpCompositeExtract %int %18 2 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureNumLayers_a216d2 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %33 = OpLabel + %34 = OpFunctionCall %void %textureNumLayers_a216d2 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %36 = OpLabel + %37 = OpFunctionCall %void %textureNumLayers_a216d2 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLayers/a216d2.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/a216d2.wgsl.expected.wgsl new file mode 100644 index 0000000000..38fbc8960b --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/a216d2.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureNumLayers_a216d2() { + var res : i32 = textureNumLayers(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_a216d2(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLayers_a216d2(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLayers_a216d2(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/cd5dc8.wgsl b/test/tint/builtins/gen/var/textureNumLayers/cd5dc8.wgsl new file mode 100644 index 0000000000..f99e1181c3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/cd5dc8.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureNumLayers(texture: texture_storage_2d_array) -> i32 +fn textureNumLayers_cd5dc8() { + var res: i32 = textureNumLayers(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_cd5dc8(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLayers_cd5dc8(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLayers_cd5dc8(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/cd5dc8.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/cd5dc8.wgsl.expected.glsl new file mode 100644 index 0000000000..95fdcf49d6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/cd5dc8.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba32ui) uniform highp writeonly uimage2DArray arg_0; +void textureNumLayers_cd5dc8() { + int res = imageSize(arg_0).z; +} + +vec4 vertex_main() { + textureNumLayers_cd5dc8(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba32ui) uniform highp writeonly uimage2DArray arg_0; +void textureNumLayers_cd5dc8() { + int res = imageSize(arg_0).z; +} + +void fragment_main() { + textureNumLayers_cd5dc8(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba32ui) uniform highp writeonly uimage2DArray arg_0; +void textureNumLayers_cd5dc8() { + int res = imageSize(arg_0).z; +} + +void compute_main() { + textureNumLayers_cd5dc8(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/cd5dc8.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLayers/cd5dc8.wgsl.expected.hlsl new file mode 100644 index 0000000000..ca5a80c50a --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/cd5dc8.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_cd5dc8() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_cd5dc8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_cd5dc8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_cd5dc8(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/cd5dc8.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/cd5dc8.wgsl.expected.msl new file mode 100644 index 0000000000..bff98ca56c --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/cd5dc8.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_cd5dc8(texture2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureNumLayers_cd5dc8(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_cd5dc8(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_cd5dc8(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLayers/cd5dc8.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/cd5dc8.wgsl.expected.spvasm new file mode 100644 index 0000000000..996f85ebd0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/cd5dc8.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLayers_cd5dc8 "textureNumLayers_cd5dc8" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 1 0 2 Rgba32ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLayers_cd5dc8 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %24 + %21 = OpLoad %11 %arg_0 + %19 = OpImageQuerySize %v3int %21 + %17 = OpCompositeExtract %int %19 2 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %textureNumLayers_cd5dc8 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %void %textureNumLayers_cd5dc8 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %37 = OpLabel + %38 = OpFunctionCall %void %textureNumLayers_cd5dc8 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLayers/cd5dc8.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/cd5dc8.wgsl.expected.wgsl new file mode 100644 index 0000000000..870778b6dd --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/cd5dc8.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureNumLayers_cd5dc8() { + var res : i32 = textureNumLayers(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_cd5dc8(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLayers_cd5dc8(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLayers_cd5dc8(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/d5b228.wgsl b/test/tint/builtins/gen/var/textureNumLayers/d5b228.wgsl new file mode 100644 index 0000000000..ba8d85eb53 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/d5b228.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureNumLayers(texture: texture_storage_2d_array) -> i32 +fn textureNumLayers_d5b228() { + var res: i32 = textureNumLayers(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_d5b228(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLayers_d5b228(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLayers_d5b228(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/d5b228.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/d5b228.wgsl.expected.glsl new file mode 100644 index 0000000000..0daa0a3ab4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/d5b228.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(r32f) uniform highp writeonly image2DArray arg_0; +void textureNumLayers_d5b228() { + int res = imageSize(arg_0).z; +} + +vec4 vertex_main() { + textureNumLayers_d5b228(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(r32f) uniform highp writeonly image2DArray arg_0; +void textureNumLayers_d5b228() { + int res = imageSize(arg_0).z; +} + +void fragment_main() { + textureNumLayers_d5b228(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(r32f) uniform highp writeonly image2DArray arg_0; +void textureNumLayers_d5b228() { + int res = imageSize(arg_0).z; +} + +void compute_main() { + textureNumLayers_d5b228(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/d5b228.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLayers/d5b228.wgsl.expected.hlsl new file mode 100644 index 0000000000..a8c82b0521 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/d5b228.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_d5b228() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_d5b228(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_d5b228(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_d5b228(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/d5b228.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/d5b228.wgsl.expected.msl new file mode 100644 index 0000000000..d2a101171b --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/d5b228.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_d5b228(texture2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureNumLayers_d5b228(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_d5b228(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_d5b228(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLayers/d5b228.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/d5b228.wgsl.expected.spvasm new file mode 100644 index 0000000000..08a45eeaa9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/d5b228.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLayers_d5b228 "textureNumLayers_d5b228" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 2 R32f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 +%_ptr_Function_int = OpTypePointer Function %int + %23 = OpConstantNull %int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLayers_d5b228 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_int Function %23 + %20 = OpLoad %11 %arg_0 + %18 = OpImageQuerySize %v3int %20 + %16 = OpCompositeExtract %int %18 2 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureNumLayers_d5b228 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %33 = OpLabel + %34 = OpFunctionCall %void %textureNumLayers_d5b228 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureNumLayers_d5b228 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLayers/d5b228.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/d5b228.wgsl.expected.wgsl new file mode 100644 index 0000000000..798b0a815f --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/d5b228.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureNumLayers_d5b228() { + var res : i32 = textureNumLayers(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_d5b228(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLayers_d5b228(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLayers_d5b228(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/e31be1.wgsl b/test/tint/builtins/gen/var/textureNumLayers/e31be1.wgsl new file mode 100644 index 0000000000..fa0eed7b7f --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/e31be1.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureNumLayers(texture: texture_storage_2d_array) -> i32 +fn textureNumLayers_e31be1() { + var res: i32 = textureNumLayers(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_e31be1(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLayers_e31be1(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLayers_e31be1(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/e31be1.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/e31be1.wgsl.expected.glsl new file mode 100644 index 0000000000..e5e4797207 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/e31be1.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba8_snorm) uniform highp writeonly image2DArray arg_0; +void textureNumLayers_e31be1() { + int res = imageSize(arg_0).z; +} + +vec4 vertex_main() { + textureNumLayers_e31be1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8_snorm) uniform highp writeonly image2DArray arg_0; +void textureNumLayers_e31be1() { + int res = imageSize(arg_0).z; +} + +void fragment_main() { + textureNumLayers_e31be1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8_snorm) uniform highp writeonly image2DArray arg_0; +void textureNumLayers_e31be1() { + int res = imageSize(arg_0).z; +} + +void compute_main() { + textureNumLayers_e31be1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/e31be1.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLayers/e31be1.wgsl.expected.hlsl new file mode 100644 index 0000000000..6aca3c5454 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/e31be1.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_e31be1() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_e31be1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_e31be1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_e31be1(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/e31be1.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/e31be1.wgsl.expected.msl new file mode 100644 index 0000000000..3b5b47f31f --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/e31be1.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_e31be1(texture2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureNumLayers_e31be1(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_e31be1(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_e31be1(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLayers/e31be1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/e31be1.wgsl.expected.spvasm new file mode 100644 index 0000000000..192aa63e13 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/e31be1.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLayers_e31be1 "textureNumLayers_e31be1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 2 Rgba8Snorm +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 +%_ptr_Function_int = OpTypePointer Function %int + %23 = OpConstantNull %int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLayers_e31be1 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_int Function %23 + %20 = OpLoad %11 %arg_0 + %18 = OpImageQuerySize %v3int %20 + %16 = OpCompositeExtract %int %18 2 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureNumLayers_e31be1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %33 = OpLabel + %34 = OpFunctionCall %void %textureNumLayers_e31be1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureNumLayers_e31be1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLayers/e31be1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/e31be1.wgsl.expected.wgsl new file mode 100644 index 0000000000..e47d202e0d --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/e31be1.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureNumLayers_e31be1() { + var res : i32 = textureNumLayers(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_e31be1(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLayers_e31be1(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLayers_e31be1(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/e653c0.wgsl b/test/tint/builtins/gen/var/textureNumLayers/e653c0.wgsl new file mode 100644 index 0000000000..4ee178ccf8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/e653c0.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d_array; + +// fn textureNumLayers(texture: texture_depth_2d_array) -> i32 +fn textureNumLayers_e653c0() { + var res: i32 = textureNumLayers(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_e653c0(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLayers_e653c0(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLayers_e653c0(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/e653c0.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/e653c0.wgsl.expected.glsl new file mode 100644 index 0000000000..c622a34e56 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/e653c0.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp sampler2DArray arg_0_1; +void textureNumLayers_e653c0() { + int res = textureSize(arg_0_1, 0).z; +} + +vec4 vertex_main() { + textureNumLayers_e653c0(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DArray arg_0_1; +void textureNumLayers_e653c0() { + int res = textureSize(arg_0_1, 0).z; +} + +void fragment_main() { + textureNumLayers_e653c0(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DArray arg_0_1; +void textureNumLayers_e653c0() { + int res = textureSize(arg_0_1, 0).z; +} + +void compute_main() { + textureNumLayers_e653c0(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/e653c0.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLayers/e653c0.wgsl.expected.hlsl new file mode 100644 index 0000000000..07d21c43e3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/e653c0.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureNumLayers_e653c0() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_e653c0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_e653c0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_e653c0(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/e653c0.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/e653c0.wgsl.expected.msl new file mode 100644 index 0000000000..ade75dde6a --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/e653c0.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_e653c0(depth2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d_array tint_symbol_2) { + textureNumLayers_e653c0(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_e653c0(tint_symbol_4); + return; +} + +kernel void compute_main(depth2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_e653c0(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLayers/e653c0.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/e653c0.wgsl.expected.spvasm new file mode 100644 index 0000000000..52ed92393e --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/e653c0.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLayers_e653c0 "textureNumLayers_e653c0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %int_0 = OpConstant %int 0 +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLayers_e653c0 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_int Function %24 + %20 = OpLoad %11 %arg_0 + %18 = OpImageQuerySizeLod %v3int %20 %int_0 + %16 = OpCompositeExtract %int %18 2 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %textureNumLayers_e653c0 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %34 = OpLabel + %35 = OpFunctionCall %void %textureNumLayers_e653c0 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %37 = OpLabel + %38 = OpFunctionCall %void %textureNumLayers_e653c0 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLayers/e653c0.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/e653c0.wgsl.expected.wgsl new file mode 100644 index 0000000000..4adddfbea7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/e653c0.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d_array; + +fn textureNumLayers_e653c0() { + var res : i32 = textureNumLayers(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_e653c0(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLayers_e653c0(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLayers_e653c0(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/ee942f.wgsl b/test/tint/builtins/gen/var/textureNumLayers/ee942f.wgsl new file mode 100644 index 0000000000..ea1d4a8ac6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/ee942f.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureNumLayers(texture: texture_storage_2d_array) -> i32 +fn textureNumLayers_ee942f() { + var res: i32 = textureNumLayers(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_ee942f(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLayers_ee942f(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLayers_ee942f(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/ee942f.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/ee942f.wgsl.expected.glsl new file mode 100644 index 0000000000..f5996d30a3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/ee942f.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(r32ui) uniform highp writeonly uimage2DArray arg_0; +void textureNumLayers_ee942f() { + int res = imageSize(arg_0).z; +} + +vec4 vertex_main() { + textureNumLayers_ee942f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(r32ui) uniform highp writeonly uimage2DArray arg_0; +void textureNumLayers_ee942f() { + int res = imageSize(arg_0).z; +} + +void fragment_main() { + textureNumLayers_ee942f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(r32ui) uniform highp writeonly uimage2DArray arg_0; +void textureNumLayers_ee942f() { + int res = imageSize(arg_0).z; +} + +void compute_main() { + textureNumLayers_ee942f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/ee942f.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLayers/ee942f.wgsl.expected.hlsl new file mode 100644 index 0000000000..6b49235b30 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/ee942f.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_ee942f() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_ee942f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_ee942f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_ee942f(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/ee942f.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/ee942f.wgsl.expected.msl new file mode 100644 index 0000000000..d8f0821835 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/ee942f.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_ee942f(texture2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureNumLayers_ee942f(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_ee942f(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_ee942f(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLayers/ee942f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/ee942f.wgsl.expected.spvasm new file mode 100644 index 0000000000..e0a11d962e --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/ee942f.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLayers_ee942f "textureNumLayers_ee942f" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 1 0 2 R32ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLayers_ee942f = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %24 + %21 = OpLoad %11 %arg_0 + %19 = OpImageQuerySize %v3int %21 + %17 = OpCompositeExtract %int %19 2 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %textureNumLayers_ee942f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %void %textureNumLayers_ee942f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %37 = OpLabel + %38 = OpFunctionCall %void %textureNumLayers_ee942f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLayers/ee942f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/ee942f.wgsl.expected.wgsl new file mode 100644 index 0000000000..4d48facccd --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/ee942f.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureNumLayers_ee942f() { + var res : i32 = textureNumLayers(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_ee942f(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLayers_ee942f(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLayers_ee942f(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/f33005.wgsl b/test/tint/builtins/gen/var/textureNumLayers/f33005.wgsl new file mode 100644 index 0000000000..6445227a30 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/f33005.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureNumLayers(texture: texture_storage_2d_array) -> i32 +fn textureNumLayers_f33005() { + var res: i32 = textureNumLayers(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_f33005(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLayers_f33005(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLayers_f33005(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/f33005.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/f33005.wgsl.expected.glsl new file mode 100644 index 0000000000..541d0295a9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/f33005.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba16i) uniform highp writeonly iimage2DArray arg_0; +void textureNumLayers_f33005() { + int res = imageSize(arg_0).z; +} + +vec4 vertex_main() { + textureNumLayers_f33005(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba16i) uniform highp writeonly iimage2DArray arg_0; +void textureNumLayers_f33005() { + int res = imageSize(arg_0).z; +} + +void fragment_main() { + textureNumLayers_f33005(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba16i) uniform highp writeonly iimage2DArray arg_0; +void textureNumLayers_f33005() { + int res = imageSize(arg_0).z; +} + +void compute_main() { + textureNumLayers_f33005(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/f33005.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLayers/f33005.wgsl.expected.hlsl new file mode 100644 index 0000000000..4f341b1db5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/f33005.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_f33005() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_f33005(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_f33005(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_f33005(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/f33005.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/f33005.wgsl.expected.msl new file mode 100644 index 0000000000..d4153049f6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/f33005.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_f33005(texture2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureNumLayers_f33005(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_f33005(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_f33005(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLayers/f33005.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/f33005.wgsl.expected.spvasm new file mode 100644 index 0000000000..a6a62248f3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/f33005.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLayers_f33005 "textureNumLayers_f33005" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 1 0 2 Rgba16i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v3int = OpTypeVector %int 3 +%_ptr_Function_int = OpTypePointer Function %int + %23 = OpConstantNull %int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLayers_f33005 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %23 + %20 = OpLoad %11 %arg_0 + %18 = OpImageQuerySize %v3int %20 + %17 = OpCompositeExtract %int %18 2 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureNumLayers_f33005 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %33 = OpLabel + %34 = OpFunctionCall %void %textureNumLayers_f33005 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %36 = OpLabel + %37 = OpFunctionCall %void %textureNumLayers_f33005 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLayers/f33005.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/f33005.wgsl.expected.wgsl new file mode 100644 index 0000000000..35bd8cab44 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/f33005.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureNumLayers_f33005() { + var res : i32 = textureNumLayers(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_f33005(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLayers_f33005(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLayers_f33005(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/fcec98.wgsl b/test/tint/builtins/gen/var/textureNumLayers/fcec98.wgsl new file mode 100644 index 0000000000..0fef907a40 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/fcec98.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureNumLayers(texture: texture_storage_2d_array) -> i32 +fn textureNumLayers_fcec98() { + var res: i32 = textureNumLayers(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_fcec98(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLayers_fcec98(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLayers_fcec98(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/fcec98.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/fcec98.wgsl.expected.glsl new file mode 100644 index 0000000000..bfaa76f926 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/fcec98.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32ui) uniform highp writeonly uimage2DArray arg_0; +void textureNumLayers_fcec98() { + int res = imageSize(arg_0).z; +} + +vec4 vertex_main() { + textureNumLayers_fcec98(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32ui) uniform highp writeonly uimage2DArray arg_0; +void textureNumLayers_fcec98() { + int res = imageSize(arg_0).z; +} + +void fragment_main() { + textureNumLayers_fcec98(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32ui) uniform highp writeonly uimage2DArray arg_0; +void textureNumLayers_fcec98() { + int res = imageSize(arg_0).z; +} + +void compute_main() { + textureNumLayers_fcec98(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureNumLayers/fcec98.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLayers/fcec98.wgsl.expected.hlsl new file mode 100644 index 0000000000..5ded29d872 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/fcec98.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_fcec98() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_fcec98(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_fcec98(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_fcec98(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/fcec98.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/fcec98.wgsl.expected.msl new file mode 100644 index 0000000000..62335743da --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/fcec98.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_fcec98(texture2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureNumLayers_fcec98(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_fcec98(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_fcec98(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLayers/fcec98.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/fcec98.wgsl.expected.spvasm new file mode 100644 index 0000000000..b33d57b8ad --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/fcec98.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability StorageImageExtendedFormats + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLayers_fcec98 "textureNumLayers_fcec98" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 1 0 2 Rg32ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLayers_fcec98 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %24 + %21 = OpLoad %11 %arg_0 + %19 = OpImageQuerySize %v3int %21 + %17 = OpCompositeExtract %int %19 2 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %textureNumLayers_fcec98 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %void %textureNumLayers_fcec98 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %37 = OpLabel + %38 = OpFunctionCall %void %textureNumLayers_fcec98 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLayers/fcec98.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/fcec98.wgsl.expected.wgsl new file mode 100644 index 0000000000..6a1723e7cf --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/fcec98.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureNumLayers_fcec98() { + var res : i32 = textureNumLayers(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_fcec98(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLayers_fcec98(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLayers_fcec98(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/ff5e89.wgsl b/test/tint/builtins/gen/var/textureNumLayers/ff5e89.wgsl new file mode 100644 index 0000000000..f12ea65d97 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/ff5e89.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureNumLayers(texture: texture_storage_2d_array) -> i32 +fn textureNumLayers_ff5e89() { + var res: i32 = textureNumLayers(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_ff5e89(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLayers_ff5e89(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLayers_ff5e89(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/ff5e89.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/ff5e89.wgsl.expected.glsl new file mode 100644 index 0000000000..76ca5cc24c --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/ff5e89.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba8ui) uniform highp writeonly uimage2DArray arg_0; +void textureNumLayers_ff5e89() { + int res = imageSize(arg_0).z; +} + +vec4 vertex_main() { + textureNumLayers_ff5e89(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8ui) uniform highp writeonly uimage2DArray arg_0; +void textureNumLayers_ff5e89() { + int res = imageSize(arg_0).z; +} + +void fragment_main() { + textureNumLayers_ff5e89(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8ui) uniform highp writeonly uimage2DArray arg_0; +void textureNumLayers_ff5e89() { + int res = imageSize(arg_0).z; +} + +void compute_main() { + textureNumLayers_ff5e89(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/ff5e89.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLayers/ff5e89.wgsl.expected.hlsl new file mode 100644 index 0000000000..4ff6d2cbd5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/ff5e89.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_ff5e89() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_ff5e89(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_ff5e89(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_ff5e89(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/ff5e89.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/ff5e89.wgsl.expected.msl new file mode 100644 index 0000000000..2fb050961d --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/ff5e89.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_ff5e89(texture2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureNumLayers_ff5e89(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_ff5e89(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_ff5e89(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLayers/ff5e89.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/ff5e89.wgsl.expected.spvasm new file mode 100644 index 0000000000..ae6e277375 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/ff5e89.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLayers_ff5e89 "textureNumLayers_ff5e89" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 1 0 2 Rgba8ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLayers_ff5e89 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %24 + %21 = OpLoad %11 %arg_0 + %19 = OpImageQuerySize %v3int %21 + %17 = OpCompositeExtract %int %19 2 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %textureNumLayers_ff5e89 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %void %textureNumLayers_ff5e89 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %37 = OpLabel + %38 = OpFunctionCall %void %textureNumLayers_ff5e89 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLayers/ff5e89.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/ff5e89.wgsl.expected.wgsl new file mode 100644 index 0000000000..cd8cb2d9c7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/ff5e89.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureNumLayers_ff5e89() { + var res : i32 = textureNumLayers(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_ff5e89(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLayers_ff5e89(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLayers_ff5e89(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/076cb5.wgsl b/test/tint/builtins/gen/var/textureNumLevels/076cb5.wgsl new file mode 100644 index 0000000000..96b8e96bc3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/076cb5.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_cube; + +// fn textureNumLevels(texture: texture_depth_cube) -> i32 +fn textureNumLevels_076cb5() { + var res: i32 = textureNumLevels(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_076cb5(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLevels_076cb5(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLevels_076cb5(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/076cb5.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLevels/076cb5.wgsl.expected.glsl new file mode 100644 index 0000000000..6b93674f9d --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/076cb5.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp samplerCube arg_0_1; +void textureNumLevels_076cb5() { + int res = textureQueryLevels(arg_0_1); +} + +vec4 vertex_main() { + textureNumLevels_076cb5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp samplerCube arg_0_1; +void textureNumLevels_076cb5() { + int res = textureQueryLevels(arg_0_1); +} + +void fragment_main() { + textureNumLevels_076cb5(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' +ERROR: 0:6: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es + +uniform highp samplerCube arg_0_1; +void textureNumLevels_076cb5() { + int res = textureQueryLevels(arg_0_1); +} + +void compute_main() { + textureNumLevels_076cb5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureNumLevels/076cb5.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLevels/076cb5.wgsl.expected.hlsl new file mode 100644 index 0000000000..7688db98ff --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/076cb5.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +TextureCube arg_0 : register(t0, space1); + +void textureNumLevels_076cb5() { + int3 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_076cb5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_076cb5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_076cb5(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/076cb5.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLevels/076cb5.wgsl.expected.msl new file mode 100644 index 0000000000..db09bf4245 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/076cb5.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLevels_076cb5(depthcube tint_symbol_1) { + int res = int(tint_symbol_1.get_num_mip_levels()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depthcube tint_symbol_2) { + textureNumLevels_076cb5(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depthcube tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depthcube tint_symbol_4 [[texture(0)]]) { + textureNumLevels_076cb5(tint_symbol_4); + return; +} + +kernel void compute_main(depthcube tint_symbol_5 [[texture(0)]]) { + textureNumLevels_076cb5(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLevels/076cb5.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLevels/076cb5.wgsl.expected.spvasm new file mode 100644 index 0000000000..7b36c1990d --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/076cb5.wgsl.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLevels_076cb5 "textureNumLevels_076cb5" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float Cube 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLevels_076cb5 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_int Function %21 + %18 = OpLoad %11 %arg_0 + %16 = OpImageQueryLevels %int %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %textureNumLevels_076cb5 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %31 = OpLabel + %32 = OpFunctionCall %void %textureNumLevels_076cb5 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %34 = OpLabel + %35 = OpFunctionCall %void %textureNumLevels_076cb5 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLevels/076cb5.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLevels/076cb5.wgsl.expected.wgsl new file mode 100644 index 0000000000..c04d6e6144 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/076cb5.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_depth_cube; + +fn textureNumLevels_076cb5() { + var res : i32 = textureNumLevels(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_076cb5(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLevels_076cb5(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLevels_076cb5(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/080d95.wgsl b/test/tint/builtins/gen/var/textureNumLevels/080d95.wgsl new file mode 100644 index 0000000000..172e090d78 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/080d95.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube; + +// fn textureNumLevels(texture: texture_cube) -> i32 +fn textureNumLevels_080d95() { + var res: i32 = textureNumLevels(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_080d95(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLevels_080d95(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLevels_080d95(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/080d95.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLevels/080d95.wgsl.expected.glsl new file mode 100644 index 0000000000..367bb7a01b --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/080d95.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp isamplerCube arg_0_1; +void textureNumLevels_080d95() { + int res = textureQueryLevels(arg_0_1); +} + +vec4 vertex_main() { + textureNumLevels_080d95(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp isamplerCube arg_0_1; +void textureNumLevels_080d95() { + int res = textureQueryLevels(arg_0_1); +} + +void fragment_main() { + textureNumLevels_080d95(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' +ERROR: 0:6: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es + +uniform highp isamplerCube arg_0_1; +void textureNumLevels_080d95() { + int res = textureQueryLevels(arg_0_1); +} + +void compute_main() { + textureNumLevels_080d95(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureNumLevels/080d95.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLevels/080d95.wgsl.expected.hlsl new file mode 100644 index 0000000000..633e7beb77 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/080d95.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +TextureCube arg_0 : register(t0, space1); + +void textureNumLevels_080d95() { + int3 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_080d95(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_080d95(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_080d95(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/080d95.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLevels/080d95.wgsl.expected.msl new file mode 100644 index 0000000000..c592ea2124 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/080d95.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLevels_080d95(texturecube tint_symbol_1) { + int res = int(tint_symbol_1.get_num_mip_levels()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube tint_symbol_2) { + textureNumLevels_080d95(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube tint_symbol_4 [[texture(0)]]) { + textureNumLevels_080d95(tint_symbol_4); + return; +} + +kernel void compute_main(texturecube tint_symbol_5 [[texture(0)]]) { + textureNumLevels_080d95(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLevels/080d95.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLevels/080d95.wgsl.expected.spvasm new file mode 100644 index 0000000000..bcbd3c7cc8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/080d95.wgsl.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLevels_080d95 "textureNumLevels_080d95" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int Cube 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLevels_080d95 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %21 + %18 = OpLoad %11 %arg_0 + %17 = OpImageQueryLevels %int %18 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %textureNumLevels_080d95 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %31 = OpLabel + %32 = OpFunctionCall %void %textureNumLevels_080d95 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %void %textureNumLevels_080d95 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLevels/080d95.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLevels/080d95.wgsl.expected.wgsl new file mode 100644 index 0000000000..686c90849d --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/080d95.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_cube; + +fn textureNumLevels_080d95() { + var res : i32 = textureNumLevels(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_080d95(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLevels_080d95(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLevels_080d95(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/09ddd0.wgsl b/test/tint/builtins/gen/var/textureNumLevels/09ddd0.wgsl new file mode 100644 index 0000000000..dea8f54612 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/09ddd0.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d; + +// fn textureNumLevels(texture: texture_2d) -> i32 +fn textureNumLevels_09ddd0() { + var res: i32 = textureNumLevels(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_09ddd0(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLevels_09ddd0(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLevels_09ddd0(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/09ddd0.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLevels/09ddd0.wgsl.expected.glsl new file mode 100644 index 0000000000..0691d9b2ee --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/09ddd0.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp usampler2D arg_0_1; +void textureNumLevels_09ddd0() { + int res = textureQueryLevels(arg_0_1); +} + +vec4 vertex_main() { + textureNumLevels_09ddd0(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp usampler2D arg_0_1; +void textureNumLevels_09ddd0() { + int res = textureQueryLevels(arg_0_1); +} + +void fragment_main() { + textureNumLevels_09ddd0(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' +ERROR: 0:6: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es + +uniform highp usampler2D arg_0_1; +void textureNumLevels_09ddd0() { + int res = textureQueryLevels(arg_0_1); +} + +void compute_main() { + textureNumLevels_09ddd0(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureNumLevels/09ddd0.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLevels/09ddd0.wgsl.expected.hlsl new file mode 100644 index 0000000000..fa2c6733dd --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/09ddd0.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_0 : register(t0, space1); + +void textureNumLevels_09ddd0() { + int3 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_09ddd0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_09ddd0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_09ddd0(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/09ddd0.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLevels/09ddd0.wgsl.expected.msl new file mode 100644 index 0000000000..43e490484c --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/09ddd0.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLevels_09ddd0(texture2d tint_symbol_1) { + int res = int(tint_symbol_1.get_num_mip_levels()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureNumLevels_09ddd0(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureNumLevels_09ddd0(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureNumLevels_09ddd0(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLevels/09ddd0.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLevels/09ddd0.wgsl.expected.spvasm new file mode 100644 index 0000000000..13e73f59b1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/09ddd0.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLevels_09ddd0 "textureNumLevels_09ddd0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %22 = OpConstantNull %int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLevels_09ddd0 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %22 + %19 = OpLoad %11 %arg_0 + %17 = OpImageQueryLevels %int %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureNumLevels_09ddd0 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %32 = OpLabel + %33 = OpFunctionCall %void %textureNumLevels_09ddd0 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureNumLevels_09ddd0 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLevels/09ddd0.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLevels/09ddd0.wgsl.expected.wgsl new file mode 100644 index 0000000000..7a4d344a1a --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/09ddd0.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_2d; + +fn textureNumLevels_09ddd0() { + var res : i32 = textureNumLevels(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_09ddd0(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLevels_09ddd0(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLevels_09ddd0(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/105988.wgsl b/test/tint/builtins/gen/var/textureNumLevels/105988.wgsl new file mode 100644 index 0000000000..67775fb0b3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/105988.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; + +// fn textureNumLevels(texture: texture_2d_array) -> i32 +fn textureNumLevels_105988() { + var res: i32 = textureNumLevels(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_105988(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLevels_105988(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLevels_105988(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/105988.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLevels/105988.wgsl.expected.glsl new file mode 100644 index 0000000000..90e28da994 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/105988.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp sampler2DArray arg_0_1; +void textureNumLevels_105988() { + int res = textureQueryLevels(arg_0_1); +} + +vec4 vertex_main() { + textureNumLevels_105988(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp sampler2DArray arg_0_1; +void textureNumLevels_105988() { + int res = textureQueryLevels(arg_0_1); +} + +void fragment_main() { + textureNumLevels_105988(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' +ERROR: 0:6: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es + +uniform highp sampler2DArray arg_0_1; +void textureNumLevels_105988() { + int res = textureQueryLevels(arg_0_1); +} + +void compute_main() { + textureNumLevels_105988(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureNumLevels/105988.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLevels/105988.wgsl.expected.hlsl new file mode 100644 index 0000000000..608355f226 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/105988.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureNumLevels_105988() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int res = tint_tmp.w; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_105988(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_105988(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_105988(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/105988.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLevels/105988.wgsl.expected.msl new file mode 100644 index 0000000000..c27305e4e6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/105988.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLevels_105988(texture2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_num_mip_levels()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureNumLevels_105988(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLevels_105988(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLevels_105988(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLevels/105988.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLevels/105988.wgsl.expected.spvasm new file mode 100644 index 0000000000..fd629e8a9b --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/105988.wgsl.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLevels_105988 "textureNumLevels_105988" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLevels_105988 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_int Function %21 + %18 = OpLoad %11 %arg_0 + %16 = OpImageQueryLevels %int %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %textureNumLevels_105988 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %31 = OpLabel + %32 = OpFunctionCall %void %textureNumLevels_105988 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %34 = OpLabel + %35 = OpFunctionCall %void %textureNumLevels_105988 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLevels/105988.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLevels/105988.wgsl.expected.wgsl new file mode 100644 index 0000000000..1466976b06 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/105988.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +fn textureNumLevels_105988() { + var res : i32 = textureNumLevels(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_105988(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLevels_105988(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLevels_105988(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/1e6f3b.wgsl b/test/tint/builtins/gen/var/textureNumLevels/1e6f3b.wgsl new file mode 100644 index 0000000000..a921b0cd80 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/1e6f3b.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_1d; + +// fn textureNumLevels(texture: texture_1d) -> i32 +fn textureNumLevels_1e6f3b() { + var res: i32 = textureNumLevels(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_1e6f3b(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLevels_1e6f3b(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLevels_1e6f3b(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/1e6f3b.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLevels/1e6f3b.wgsl.expected.glsl new file mode 100644 index 0000000000..50f6f13cbd --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/1e6f3b.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +uniform highp usampler1D arg_0_1; +void textureNumLevels_1e6f3b() { + int res = textureQueryLevels(arg_0_1); +} + +vec4 vertex_main() { + textureNumLevels_1e6f3b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'usampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp usampler1D arg_0_1; +void textureNumLevels_1e6f3b() { + int res = textureQueryLevels(arg_0_1); +} + +void fragment_main() { + textureNumLevels_1e6f3b(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'usampler1D' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp usampler1D arg_0_1; +void textureNumLevels_1e6f3b() { + int res = textureQueryLevels(arg_0_1); +} + +void compute_main() { + textureNumLevels_1e6f3b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'usampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureNumLevels/1e6f3b.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLevels/1e6f3b.wgsl.expected.hlsl new file mode 100644 index 0000000000..938309a8d8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/1e6f3b.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +Texture1D arg_0 : register(t0, space1); + +void textureNumLevels_1e6f3b() { + int2 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y); + int res = tint_tmp.y; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_1e6f3b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_1e6f3b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_1e6f3b(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/1e6f3b.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLevels/1e6f3b.wgsl.expected.msl new file mode 100644 index 0000000000..00356f0669 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/1e6f3b.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLevels_1e6f3b(texture1d tint_symbol_1) { + int res = int(tint_symbol_1.get_num_mip_levels()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureNumLevels_1e6f3b(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureNumLevels_1e6f3b(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureNumLevels_1e6f3b(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLevels/1e6f3b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLevels/1e6f3b.wgsl.expected.spvasm new file mode 100644 index 0000000000..80c21ead09 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/1e6f3b.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability Sampled1D + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLevels_1e6f3b "textureNumLevels_1e6f3b" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 1D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %22 = OpConstantNull %int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLevels_1e6f3b = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %22 + %19 = OpLoad %11 %arg_0 + %17 = OpImageQueryLevels %int %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureNumLevels_1e6f3b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %32 = OpLabel + %33 = OpFunctionCall %void %textureNumLevels_1e6f3b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureNumLevels_1e6f3b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLevels/1e6f3b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLevels/1e6f3b.wgsl.expected.wgsl new file mode 100644 index 0000000000..3643d3efef --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/1e6f3b.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_1d; + +fn textureNumLevels_1e6f3b() { + var res : i32 = textureNumLevels(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_1e6f3b(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLevels_1e6f3b(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLevels_1e6f3b(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/23f750.wgsl b/test/tint/builtins/gen/var/textureNumLevels/23f750.wgsl new file mode 100644 index 0000000000..c44baad85a --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/23f750.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d; + +// fn textureNumLevels(texture: texture_2d) -> i32 +fn textureNumLevels_23f750() { + var res: i32 = textureNumLevels(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_23f750(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLevels_23f750(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLevels_23f750(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/23f750.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLevels/23f750.wgsl.expected.glsl new file mode 100644 index 0000000000..8b964989fe --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/23f750.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp isampler2D arg_0_1; +void textureNumLevels_23f750() { + int res = textureQueryLevels(arg_0_1); +} + +vec4 vertex_main() { + textureNumLevels_23f750(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp isampler2D arg_0_1; +void textureNumLevels_23f750() { + int res = textureQueryLevels(arg_0_1); +} + +void fragment_main() { + textureNumLevels_23f750(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' +ERROR: 0:6: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es + +uniform highp isampler2D arg_0_1; +void textureNumLevels_23f750() { + int res = textureQueryLevels(arg_0_1); +} + +void compute_main() { + textureNumLevels_23f750(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureNumLevels/23f750.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLevels/23f750.wgsl.expected.hlsl new file mode 100644 index 0000000000..230c77c842 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/23f750.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_0 : register(t0, space1); + +void textureNumLevels_23f750() { + int3 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_23f750(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_23f750(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_23f750(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/23f750.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLevels/23f750.wgsl.expected.msl new file mode 100644 index 0000000000..571d0a45f1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/23f750.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLevels_23f750(texture2d tint_symbol_1) { + int res = int(tint_symbol_1.get_num_mip_levels()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureNumLevels_23f750(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureNumLevels_23f750(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureNumLevels_23f750(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLevels/23f750.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLevels/23f750.wgsl.expected.spvasm new file mode 100644 index 0000000000..8dd3517e52 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/23f750.wgsl.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLevels_23f750 "textureNumLevels_23f750" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLevels_23f750 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %21 + %18 = OpLoad %11 %arg_0 + %17 = OpImageQueryLevels %int %18 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %textureNumLevels_23f750 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %31 = OpLabel + %32 = OpFunctionCall %void %textureNumLevels_23f750 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %void %textureNumLevels_23f750 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLevels/23f750.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLevels/23f750.wgsl.expected.wgsl new file mode 100644 index 0000000000..86bf58889a --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/23f750.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_2d; + +fn textureNumLevels_23f750() { + var res : i32 = textureNumLevels(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_23f750(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLevels_23f750(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLevels_23f750(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/2c3575.wgsl b/test/tint/builtins/gen/var/textureNumLevels/2c3575.wgsl new file mode 100644 index 0000000000..e94cb62362 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/2c3575.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_cube_array; + +// fn textureNumLevels(texture: texture_depth_cube_array) -> i32 +fn textureNumLevels_2c3575() { + var res: i32 = textureNumLevels(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_2c3575(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLevels_2c3575(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLevels_2c3575(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/2c3575.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLevels/2c3575.wgsl.expected.glsl new file mode 100644 index 0000000000..2de59fc0b0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/2c3575.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +uniform highp samplerCubeArray arg_0_1; +void textureNumLevels_2c3575() { + int res = textureQueryLevels(arg_0_1); +} + +vec4 vertex_main() { + textureNumLevels_2c3575(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp samplerCubeArray arg_0_1; +void textureNumLevels_2c3575() { + int res = textureQueryLevels(arg_0_1); +} + +void fragment_main() { + textureNumLevels_2c3575(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'samplerCubeArray' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp samplerCubeArray arg_0_1; +void textureNumLevels_2c3575() { + int res = textureQueryLevels(arg_0_1); +} + +void compute_main() { + textureNumLevels_2c3575(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureNumLevels/2c3575.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLevels/2c3575.wgsl.expected.hlsl new file mode 100644 index 0000000000..969b67aee9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/2c3575.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureNumLevels_2c3575() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int res = tint_tmp.w; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_2c3575(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_2c3575(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_2c3575(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/2c3575.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLevels/2c3575.wgsl.expected.msl new file mode 100644 index 0000000000..8f7ed02625 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/2c3575.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLevels_2c3575(depthcube_array tint_symbol_1) { + int res = int(tint_symbol_1.get_num_mip_levels()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depthcube_array tint_symbol_2) { + textureNumLevels_2c3575(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depthcube_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depthcube_array tint_symbol_4 [[texture(0)]]) { + textureNumLevels_2c3575(tint_symbol_4); + return; +} + +kernel void compute_main(depthcube_array tint_symbol_5 [[texture(0)]]) { + textureNumLevels_2c3575(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLevels/2c3575.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLevels/2c3575.wgsl.expected.spvasm new file mode 100644 index 0000000000..ef03d8acf1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/2c3575.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLevels_2c3575 "textureNumLevels_2c3575" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLevels_2c3575 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_int Function %21 + %18 = OpLoad %11 %arg_0 + %16 = OpImageQueryLevels %int %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %textureNumLevels_2c3575 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %31 = OpLabel + %32 = OpFunctionCall %void %textureNumLevels_2c3575 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %34 = OpLabel + %35 = OpFunctionCall %void %textureNumLevels_2c3575 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLevels/2c3575.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLevels/2c3575.wgsl.expected.wgsl new file mode 100644 index 0000000000..6f2f54dcfc --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/2c3575.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_depth_cube_array; + +fn textureNumLevels_2c3575() { + var res : i32 = textureNumLevels(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_2c3575(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLevels_2c3575(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLevels_2c3575(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/32a0ae.wgsl b/test/tint/builtins/gen/var/textureNumLevels/32a0ae.wgsl new file mode 100644 index 0000000000..d7c7297fed --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/32a0ae.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_1d; + +// fn textureNumLevels(texture: texture_1d) -> i32 +fn textureNumLevels_32a0ae() { + var res: i32 = textureNumLevels(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_32a0ae(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLevels_32a0ae(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLevels_32a0ae(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/32a0ae.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLevels/32a0ae.wgsl.expected.glsl new file mode 100644 index 0000000000..b0cdc31466 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/32a0ae.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +uniform highp isampler1D arg_0_1; +void textureNumLevels_32a0ae() { + int res = textureQueryLevels(arg_0_1); +} + +vec4 vertex_main() { + textureNumLevels_32a0ae(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'isampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp isampler1D arg_0_1; +void textureNumLevels_32a0ae() { + int res = textureQueryLevels(arg_0_1); +} + +void fragment_main() { + textureNumLevels_32a0ae(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'isampler1D' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp isampler1D arg_0_1; +void textureNumLevels_32a0ae() { + int res = textureQueryLevels(arg_0_1); +} + +void compute_main() { + textureNumLevels_32a0ae(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'isampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureNumLevels/32a0ae.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLevels/32a0ae.wgsl.expected.hlsl new file mode 100644 index 0000000000..8caa7566e4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/32a0ae.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +Texture1D arg_0 : register(t0, space1); + +void textureNumLevels_32a0ae() { + int2 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y); + int res = tint_tmp.y; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_32a0ae(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_32a0ae(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_32a0ae(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/32a0ae.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLevels/32a0ae.wgsl.expected.msl new file mode 100644 index 0000000000..11c0362e19 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/32a0ae.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLevels_32a0ae(texture1d tint_symbol_1) { + int res = int(tint_symbol_1.get_num_mip_levels()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureNumLevels_32a0ae(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureNumLevels_32a0ae(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureNumLevels_32a0ae(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLevels/32a0ae.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLevels/32a0ae.wgsl.expected.spvasm new file mode 100644 index 0000000000..283d160c19 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/32a0ae.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Sampled1D + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLevels_32a0ae "textureNumLevels_32a0ae" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 1D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLevels_32a0ae = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %21 + %18 = OpLoad %11 %arg_0 + %17 = OpImageQueryLevels %int %18 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %textureNumLevels_32a0ae + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %31 = OpLabel + %32 = OpFunctionCall %void %textureNumLevels_32a0ae + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %void %textureNumLevels_32a0ae + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLevels/32a0ae.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLevels/32a0ae.wgsl.expected.wgsl new file mode 100644 index 0000000000..e5016ebb3f --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/32a0ae.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_1d; + +fn textureNumLevels_32a0ae() { + var res : i32 = textureNumLevels(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_32a0ae(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLevels_32a0ae(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLevels_32a0ae(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/5101cf.wgsl b/test/tint/builtins/gen/var/textureNumLevels/5101cf.wgsl new file mode 100644 index 0000000000..371315a8e1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/5101cf.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; + +// fn textureNumLevels(texture: texture_2d_array) -> i32 +fn textureNumLevels_5101cf() { + var res: i32 = textureNumLevels(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_5101cf(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLevels_5101cf(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLevels_5101cf(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/5101cf.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLevels/5101cf.wgsl.expected.glsl new file mode 100644 index 0000000000..e372765680 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/5101cf.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp usampler2DArray arg_0_1; +void textureNumLevels_5101cf() { + int res = textureQueryLevels(arg_0_1); +} + +vec4 vertex_main() { + textureNumLevels_5101cf(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp usampler2DArray arg_0_1; +void textureNumLevels_5101cf() { + int res = textureQueryLevels(arg_0_1); +} + +void fragment_main() { + textureNumLevels_5101cf(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' +ERROR: 0:6: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es + +uniform highp usampler2DArray arg_0_1; +void textureNumLevels_5101cf() { + int res = textureQueryLevels(arg_0_1); +} + +void compute_main() { + textureNumLevels_5101cf(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureNumLevels/5101cf.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLevels/5101cf.wgsl.expected.hlsl new file mode 100644 index 0000000000..f6385792ca --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/5101cf.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureNumLevels_5101cf() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int res = tint_tmp.w; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_5101cf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_5101cf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_5101cf(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/5101cf.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLevels/5101cf.wgsl.expected.msl new file mode 100644 index 0000000000..4a17faabec --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/5101cf.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLevels_5101cf(texture2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_num_mip_levels()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureNumLevels_5101cf(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLevels_5101cf(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLevels_5101cf(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLevels/5101cf.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLevels/5101cf.wgsl.expected.spvasm new file mode 100644 index 0000000000..321f409e45 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/5101cf.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLevels_5101cf "textureNumLevels_5101cf" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %22 = OpConstantNull %int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLevels_5101cf = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %22 + %19 = OpLoad %11 %arg_0 + %17 = OpImageQueryLevels %int %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureNumLevels_5101cf + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %32 = OpLabel + %33 = OpFunctionCall %void %textureNumLevels_5101cf + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureNumLevels_5101cf + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLevels/5101cf.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLevels/5101cf.wgsl.expected.wgsl new file mode 100644 index 0000000000..694397b7ed --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/5101cf.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +fn textureNumLevels_5101cf() { + var res : i32 = textureNumLevels(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_5101cf(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLevels_5101cf(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLevels_5101cf(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/51b5bb.wgsl b/test/tint/builtins/gen/var/textureNumLevels/51b5bb.wgsl new file mode 100644 index 0000000000..de1c30b3c8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/51b5bb.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_1d; + +// fn textureNumLevels(texture: texture_1d) -> i32 +fn textureNumLevels_51b5bb() { + var res: i32 = textureNumLevels(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_51b5bb(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLevels_51b5bb(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLevels_51b5bb(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/51b5bb.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLevels/51b5bb.wgsl.expected.glsl new file mode 100644 index 0000000000..8969352a69 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/51b5bb.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +uniform highp sampler1D arg_0_1; +void textureNumLevels_51b5bb() { + int res = textureQueryLevels(arg_0_1); +} + +vec4 vertex_main() { + textureNumLevels_51b5bb(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'sampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp sampler1D arg_0_1; +void textureNumLevels_51b5bb() { + int res = textureQueryLevels(arg_0_1); +} + +void fragment_main() { + textureNumLevels_51b5bb(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'sampler1D' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp sampler1D arg_0_1; +void textureNumLevels_51b5bb() { + int res = textureQueryLevels(arg_0_1); +} + +void compute_main() { + textureNumLevels_51b5bb(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'sampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureNumLevels/51b5bb.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLevels/51b5bb.wgsl.expected.hlsl new file mode 100644 index 0000000000..e41c4df7b1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/51b5bb.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +Texture1D arg_0 : register(t0, space1); + +void textureNumLevels_51b5bb() { + int2 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y); + int res = tint_tmp.y; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_51b5bb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_51b5bb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_51b5bb(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/51b5bb.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLevels/51b5bb.wgsl.expected.msl new file mode 100644 index 0000000000..7acc809df7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/51b5bb.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLevels_51b5bb(texture1d tint_symbol_1) { + int res = int(tint_symbol_1.get_num_mip_levels()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureNumLevels_51b5bb(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureNumLevels_51b5bb(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureNumLevels_51b5bb(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLevels/51b5bb.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLevels/51b5bb.wgsl.expected.spvasm new file mode 100644 index 0000000000..2fa2c76d10 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/51b5bb.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Sampled1D + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLevels_51b5bb "textureNumLevels_51b5bb" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 1D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLevels_51b5bb = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_int Function %21 + %18 = OpLoad %11 %arg_0 + %16 = OpImageQueryLevels %int %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %textureNumLevels_51b5bb + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %31 = OpLabel + %32 = OpFunctionCall %void %textureNumLevels_51b5bb + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %34 = OpLabel + %35 = OpFunctionCall %void %textureNumLevels_51b5bb + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLevels/51b5bb.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLevels/51b5bb.wgsl.expected.wgsl new file mode 100644 index 0000000000..2ee7aa9d7d --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/51b5bb.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_1d; + +fn textureNumLevels_51b5bb() { + var res : i32 = textureNumLevels(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_51b5bb(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLevels_51b5bb(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLevels_51b5bb(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/897aaf.wgsl b/test/tint/builtins/gen/var/textureNumLevels/897aaf.wgsl new file mode 100644 index 0000000000..b4559d89d2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/897aaf.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube; + +// fn textureNumLevels(texture: texture_cube) -> i32 +fn textureNumLevels_897aaf() { + var res: i32 = textureNumLevels(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_897aaf(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLevels_897aaf(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLevels_897aaf(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/897aaf.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLevels/897aaf.wgsl.expected.glsl new file mode 100644 index 0000000000..f7d707ee4d --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/897aaf.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp samplerCube arg_0_1; +void textureNumLevels_897aaf() { + int res = textureQueryLevels(arg_0_1); +} + +vec4 vertex_main() { + textureNumLevels_897aaf(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp samplerCube arg_0_1; +void textureNumLevels_897aaf() { + int res = textureQueryLevels(arg_0_1); +} + +void fragment_main() { + textureNumLevels_897aaf(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' +ERROR: 0:6: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es + +uniform highp samplerCube arg_0_1; +void textureNumLevels_897aaf() { + int res = textureQueryLevels(arg_0_1); +} + +void compute_main() { + textureNumLevels_897aaf(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureNumLevels/897aaf.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLevels/897aaf.wgsl.expected.hlsl new file mode 100644 index 0000000000..1dc79b11bb --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/897aaf.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +TextureCube arg_0 : register(t0, space1); + +void textureNumLevels_897aaf() { + int3 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_897aaf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_897aaf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_897aaf(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/897aaf.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLevels/897aaf.wgsl.expected.msl new file mode 100644 index 0000000000..5f6ffc4d3b --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/897aaf.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLevels_897aaf(texturecube tint_symbol_1) { + int res = int(tint_symbol_1.get_num_mip_levels()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube tint_symbol_2) { + textureNumLevels_897aaf(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube tint_symbol_4 [[texture(0)]]) { + textureNumLevels_897aaf(tint_symbol_4); + return; +} + +kernel void compute_main(texturecube tint_symbol_5 [[texture(0)]]) { + textureNumLevels_897aaf(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLevels/897aaf.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLevels/897aaf.wgsl.expected.spvasm new file mode 100644 index 0000000000..2daa6e87cc --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/897aaf.wgsl.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLevels_897aaf "textureNumLevels_897aaf" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float Cube 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLevels_897aaf = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_int Function %21 + %18 = OpLoad %11 %arg_0 + %16 = OpImageQueryLevels %int %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %textureNumLevels_897aaf + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %31 = OpLabel + %32 = OpFunctionCall %void %textureNumLevels_897aaf + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %34 = OpLabel + %35 = OpFunctionCall %void %textureNumLevels_897aaf + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLevels/897aaf.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLevels/897aaf.wgsl.expected.wgsl new file mode 100644 index 0000000000..97e927523f --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/897aaf.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_cube; + +fn textureNumLevels_897aaf() { + var res : i32 = textureNumLevels(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_897aaf(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLevels_897aaf(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLevels_897aaf(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/9da7a5.wgsl b/test/tint/builtins/gen/var/textureNumLevels/9da7a5.wgsl new file mode 100644 index 0000000000..75623c2e98 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/9da7a5.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_3d; + +// fn textureNumLevels(texture: texture_3d) -> i32 +fn textureNumLevels_9da7a5() { + var res: i32 = textureNumLevels(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_9da7a5(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLevels_9da7a5(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLevels_9da7a5(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/9da7a5.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLevels/9da7a5.wgsl.expected.glsl new file mode 100644 index 0000000000..83706c6e71 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/9da7a5.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp isampler3D arg_0_1; +void textureNumLevels_9da7a5() { + int res = textureQueryLevels(arg_0_1); +} + +vec4 vertex_main() { + textureNumLevels_9da7a5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp isampler3D arg_0_1; +void textureNumLevels_9da7a5() { + int res = textureQueryLevels(arg_0_1); +} + +void fragment_main() { + textureNumLevels_9da7a5(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' +ERROR: 0:6: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es + +uniform highp isampler3D arg_0_1; +void textureNumLevels_9da7a5() { + int res = textureQueryLevels(arg_0_1); +} + +void compute_main() { + textureNumLevels_9da7a5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureNumLevels/9da7a5.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLevels/9da7a5.wgsl.expected.hlsl new file mode 100644 index 0000000000..621c54766b --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/9da7a5.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +Texture3D arg_0 : register(t0, space1); + +void textureNumLevels_9da7a5() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int res = tint_tmp.w; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_9da7a5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_9da7a5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_9da7a5(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/9da7a5.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLevels/9da7a5.wgsl.expected.msl new file mode 100644 index 0000000000..f813901183 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/9da7a5.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLevels_9da7a5(texture3d tint_symbol_1) { + int res = int(tint_symbol_1.get_num_mip_levels()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureNumLevels_9da7a5(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureNumLevels_9da7a5(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureNumLevels_9da7a5(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLevels/9da7a5.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLevels/9da7a5.wgsl.expected.spvasm new file mode 100644 index 0000000000..522fe6852c --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/9da7a5.wgsl.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLevels_9da7a5 "textureNumLevels_9da7a5" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 3D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLevels_9da7a5 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %21 + %18 = OpLoad %11 %arg_0 + %17 = OpImageQueryLevels %int %18 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %textureNumLevels_9da7a5 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %31 = OpLabel + %32 = OpFunctionCall %void %textureNumLevels_9da7a5 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %void %textureNumLevels_9da7a5 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLevels/9da7a5.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLevels/9da7a5.wgsl.expected.wgsl new file mode 100644 index 0000000000..5980b48cae --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/9da7a5.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_3d; + +fn textureNumLevels_9da7a5() { + var res : i32 = textureNumLevels(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_9da7a5(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLevels_9da7a5(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLevels_9da7a5(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/a91c03.wgsl b/test/tint/builtins/gen/var/textureNumLevels/a91c03.wgsl new file mode 100644 index 0000000000..1f9d9aeb88 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/a91c03.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube_array; + +// fn textureNumLevels(texture: texture_cube_array) -> i32 +fn textureNumLevels_a91c03() { + var res: i32 = textureNumLevels(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_a91c03(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLevels_a91c03(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLevels_a91c03(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/a91c03.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLevels/a91c03.wgsl.expected.glsl new file mode 100644 index 0000000000..684bc1b610 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/a91c03.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +uniform highp isamplerCubeArray arg_0_1; +void textureNumLevels_a91c03() { + int res = textureQueryLevels(arg_0_1); +} + +vec4 vertex_main() { + textureNumLevels_a91c03(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'isamplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp isamplerCubeArray arg_0_1; +void textureNumLevels_a91c03() { + int res = textureQueryLevels(arg_0_1); +} + +void fragment_main() { + textureNumLevels_a91c03(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'isamplerCubeArray' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp isamplerCubeArray arg_0_1; +void textureNumLevels_a91c03() { + int res = textureQueryLevels(arg_0_1); +} + +void compute_main() { + textureNumLevels_a91c03(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'isamplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureNumLevels/a91c03.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLevels/a91c03.wgsl.expected.hlsl new file mode 100644 index 0000000000..97c379dd7f --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/a91c03.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureNumLevels_a91c03() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int res = tint_tmp.w; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_a91c03(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_a91c03(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_a91c03(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/a91c03.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLevels/a91c03.wgsl.expected.msl new file mode 100644 index 0000000000..4a151f0637 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/a91c03.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLevels_a91c03(texturecube_array tint_symbol_1) { + int res = int(tint_symbol_1.get_num_mip_levels()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube_array tint_symbol_2) { + textureNumLevels_a91c03(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube_array tint_symbol_4 [[texture(0)]]) { + textureNumLevels_a91c03(tint_symbol_4); + return; +} + +kernel void compute_main(texturecube_array tint_symbol_5 [[texture(0)]]) { + textureNumLevels_a91c03(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLevels/a91c03.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLevels/a91c03.wgsl.expected.spvasm new file mode 100644 index 0000000000..ba04989996 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/a91c03.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLevels_a91c03 "textureNumLevels_a91c03" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLevels_a91c03 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %21 + %18 = OpLoad %11 %arg_0 + %17 = OpImageQueryLevels %int %18 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %textureNumLevels_a91c03 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %31 = OpLabel + %32 = OpFunctionCall %void %textureNumLevels_a91c03 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %void %textureNumLevels_a91c03 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLevels/a91c03.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLevels/a91c03.wgsl.expected.wgsl new file mode 100644 index 0000000000..72128538a7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/a91c03.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_cube_array; + +fn textureNumLevels_a91c03() { + var res : i32 = textureNumLevels(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_a91c03(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLevels_a91c03(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLevels_a91c03(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/aee7c8.wgsl b/test/tint/builtins/gen/var/textureNumLevels/aee7c8.wgsl new file mode 100644 index 0000000000..f28913a539 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/aee7c8.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube_array; + +// fn textureNumLevels(texture: texture_cube_array) -> i32 +fn textureNumLevels_aee7c8() { + var res: i32 = textureNumLevels(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_aee7c8(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLevels_aee7c8(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLevels_aee7c8(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/aee7c8.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLevels/aee7c8.wgsl.expected.glsl new file mode 100644 index 0000000000..6fbe7623ba --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/aee7c8.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +uniform highp samplerCubeArray arg_0_1; +void textureNumLevels_aee7c8() { + int res = textureQueryLevels(arg_0_1); +} + +vec4 vertex_main() { + textureNumLevels_aee7c8(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp samplerCubeArray arg_0_1; +void textureNumLevels_aee7c8() { + int res = textureQueryLevels(arg_0_1); +} + +void fragment_main() { + textureNumLevels_aee7c8(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'samplerCubeArray' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp samplerCubeArray arg_0_1; +void textureNumLevels_aee7c8() { + int res = textureQueryLevels(arg_0_1); +} + +void compute_main() { + textureNumLevels_aee7c8(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureNumLevels/aee7c8.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLevels/aee7c8.wgsl.expected.hlsl new file mode 100644 index 0000000000..6511a2d27a --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/aee7c8.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureNumLevels_aee7c8() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int res = tint_tmp.w; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_aee7c8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_aee7c8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_aee7c8(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/aee7c8.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLevels/aee7c8.wgsl.expected.msl new file mode 100644 index 0000000000..a4627cd1b1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/aee7c8.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLevels_aee7c8(texturecube_array tint_symbol_1) { + int res = int(tint_symbol_1.get_num_mip_levels()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube_array tint_symbol_2) { + textureNumLevels_aee7c8(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube_array tint_symbol_4 [[texture(0)]]) { + textureNumLevels_aee7c8(tint_symbol_4); + return; +} + +kernel void compute_main(texturecube_array tint_symbol_5 [[texture(0)]]) { + textureNumLevels_aee7c8(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLevels/aee7c8.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLevels/aee7c8.wgsl.expected.spvasm new file mode 100644 index 0000000000..d5f9d13cbe --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/aee7c8.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLevels_aee7c8 "textureNumLevels_aee7c8" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLevels_aee7c8 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_int Function %21 + %18 = OpLoad %11 %arg_0 + %16 = OpImageQueryLevels %int %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %textureNumLevels_aee7c8 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %31 = OpLabel + %32 = OpFunctionCall %void %textureNumLevels_aee7c8 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %34 = OpLabel + %35 = OpFunctionCall %void %textureNumLevels_aee7c8 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLevels/aee7c8.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLevels/aee7c8.wgsl.expected.wgsl new file mode 100644 index 0000000000..32c8b5a215 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/aee7c8.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_cube_array; + +fn textureNumLevels_aee7c8() { + var res : i32 = textureNumLevels(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_aee7c8(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLevels_aee7c8(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLevels_aee7c8(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/b1b12b.wgsl b/test/tint/builtins/gen/var/textureNumLevels/b1b12b.wgsl new file mode 100644 index 0000000000..a03922ce88 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/b1b12b.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d; + +// fn textureNumLevels(texture: texture_depth_2d) -> i32 +fn textureNumLevels_b1b12b() { + var res: i32 = textureNumLevels(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_b1b12b(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLevels_b1b12b(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLevels_b1b12b(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/b1b12b.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLevels/b1b12b.wgsl.expected.glsl new file mode 100644 index 0000000000..2a2119a2ae --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/b1b12b.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp sampler2D arg_0_1; +void textureNumLevels_b1b12b() { + int res = textureQueryLevels(arg_0_1); +} + +vec4 vertex_main() { + textureNumLevels_b1b12b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp sampler2D arg_0_1; +void textureNumLevels_b1b12b() { + int res = textureQueryLevels(arg_0_1); +} + +void fragment_main() { + textureNumLevels_b1b12b(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' +ERROR: 0:6: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es + +uniform highp sampler2D arg_0_1; +void textureNumLevels_b1b12b() { + int res = textureQueryLevels(arg_0_1); +} + +void compute_main() { + textureNumLevels_b1b12b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureNumLevels/b1b12b.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLevels/b1b12b.wgsl.expected.hlsl new file mode 100644 index 0000000000..cd908dca1e --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/b1b12b.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_0 : register(t0, space1); + +void textureNumLevels_b1b12b() { + int3 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_b1b12b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_b1b12b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_b1b12b(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/b1b12b.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLevels/b1b12b.wgsl.expected.msl new file mode 100644 index 0000000000..cdda66a9a0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/b1b12b.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLevels_b1b12b(depth2d tint_symbol_1) { + int res = int(tint_symbol_1.get_num_mip_levels()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d tint_symbol_2) { + textureNumLevels_b1b12b(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d tint_symbol_4 [[texture(0)]]) { + textureNumLevels_b1b12b(tint_symbol_4); + return; +} + +kernel void compute_main(depth2d tint_symbol_5 [[texture(0)]]) { + textureNumLevels_b1b12b(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLevels/b1b12b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLevels/b1b12b.wgsl.expected.spvasm new file mode 100644 index 0000000000..dcd4a668db --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/b1b12b.wgsl.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLevels_b1b12b "textureNumLevels_b1b12b" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLevels_b1b12b = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_int Function %21 + %18 = OpLoad %11 %arg_0 + %16 = OpImageQueryLevels %int %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %textureNumLevels_b1b12b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %31 = OpLabel + %32 = OpFunctionCall %void %textureNumLevels_b1b12b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %34 = OpLabel + %35 = OpFunctionCall %void %textureNumLevels_b1b12b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLevels/b1b12b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLevels/b1b12b.wgsl.expected.wgsl new file mode 100644 index 0000000000..97fd9a280c --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/b1b12b.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d; + +fn textureNumLevels_b1b12b() { + var res : i32 = textureNumLevels(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_b1b12b(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLevels_b1b12b(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLevels_b1b12b(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/b4f5ea.wgsl b/test/tint/builtins/gen/var/textureNumLevels/b4f5ea.wgsl new file mode 100644 index 0000000000..4d81449ae1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/b4f5ea.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_3d; + +// fn textureNumLevels(texture: texture_3d) -> i32 +fn textureNumLevels_b4f5ea() { + var res: i32 = textureNumLevels(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_b4f5ea(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLevels_b4f5ea(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLevels_b4f5ea(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/b4f5ea.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLevels/b4f5ea.wgsl.expected.glsl new file mode 100644 index 0000000000..a857a8aa29 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/b4f5ea.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp usampler3D arg_0_1; +void textureNumLevels_b4f5ea() { + int res = textureQueryLevels(arg_0_1); +} + +vec4 vertex_main() { + textureNumLevels_b4f5ea(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp usampler3D arg_0_1; +void textureNumLevels_b4f5ea() { + int res = textureQueryLevels(arg_0_1); +} + +void fragment_main() { + textureNumLevels_b4f5ea(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' +ERROR: 0:6: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es + +uniform highp usampler3D arg_0_1; +void textureNumLevels_b4f5ea() { + int res = textureQueryLevels(arg_0_1); +} + +void compute_main() { + textureNumLevels_b4f5ea(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureNumLevels/b4f5ea.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLevels/b4f5ea.wgsl.expected.hlsl new file mode 100644 index 0000000000..92162ad12d --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/b4f5ea.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +Texture3D arg_0 : register(t0, space1); + +void textureNumLevels_b4f5ea() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int res = tint_tmp.w; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_b4f5ea(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_b4f5ea(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_b4f5ea(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/b4f5ea.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLevels/b4f5ea.wgsl.expected.msl new file mode 100644 index 0000000000..8c251ea96b --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/b4f5ea.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLevels_b4f5ea(texture3d tint_symbol_1) { + int res = int(tint_symbol_1.get_num_mip_levels()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureNumLevels_b4f5ea(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureNumLevels_b4f5ea(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureNumLevels_b4f5ea(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLevels/b4f5ea.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLevels/b4f5ea.wgsl.expected.spvasm new file mode 100644 index 0000000000..6508bca3b9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/b4f5ea.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLevels_b4f5ea "textureNumLevels_b4f5ea" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 3D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %22 = OpConstantNull %int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLevels_b4f5ea = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %22 + %19 = OpLoad %11 %arg_0 + %17 = OpImageQueryLevels %int %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureNumLevels_b4f5ea + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %32 = OpLabel + %33 = OpFunctionCall %void %textureNumLevels_b4f5ea + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureNumLevels_b4f5ea + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLevels/b4f5ea.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLevels/b4f5ea.wgsl.expected.wgsl new file mode 100644 index 0000000000..ff1823d064 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/b4f5ea.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_3d; + +fn textureNumLevels_b4f5ea() { + var res : i32 = textureNumLevels(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_b4f5ea(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLevels_b4f5ea(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLevels_b4f5ea(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/d004a9.wgsl b/test/tint/builtins/gen/var/textureNumLevels/d004a9.wgsl new file mode 100644 index 0000000000..e191da8c9b --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/d004a9.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; + +// fn textureNumLevels(texture: texture_2d_array) -> i32 +fn textureNumLevels_d004a9() { + var res: i32 = textureNumLevels(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_d004a9(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLevels_d004a9(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLevels_d004a9(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/d004a9.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLevels/d004a9.wgsl.expected.glsl new file mode 100644 index 0000000000..926ded3ccb --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/d004a9.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp isampler2DArray arg_0_1; +void textureNumLevels_d004a9() { + int res = textureQueryLevels(arg_0_1); +} + +vec4 vertex_main() { + textureNumLevels_d004a9(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp isampler2DArray arg_0_1; +void textureNumLevels_d004a9() { + int res = textureQueryLevels(arg_0_1); +} + +void fragment_main() { + textureNumLevels_d004a9(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' +ERROR: 0:6: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es + +uniform highp isampler2DArray arg_0_1; +void textureNumLevels_d004a9() { + int res = textureQueryLevels(arg_0_1); +} + +void compute_main() { + textureNumLevels_d004a9(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureNumLevels/d004a9.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLevels/d004a9.wgsl.expected.hlsl new file mode 100644 index 0000000000..34731d5b4e --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/d004a9.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureNumLevels_d004a9() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int res = tint_tmp.w; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_d004a9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_d004a9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_d004a9(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/d004a9.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLevels/d004a9.wgsl.expected.msl new file mode 100644 index 0000000000..d0d19fe935 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/d004a9.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLevels_d004a9(texture2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_num_mip_levels()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureNumLevels_d004a9(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLevels_d004a9(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLevels_d004a9(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLevels/d004a9.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLevels/d004a9.wgsl.expected.spvasm new file mode 100644 index 0000000000..48fe3de1f7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/d004a9.wgsl.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLevels_d004a9 "textureNumLevels_d004a9" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLevels_d004a9 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %21 + %18 = OpLoad %11 %arg_0 + %17 = OpImageQueryLevels %int %18 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %textureNumLevels_d004a9 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %31 = OpLabel + %32 = OpFunctionCall %void %textureNumLevels_d004a9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %void %textureNumLevels_d004a9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLevels/d004a9.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLevels/d004a9.wgsl.expected.wgsl new file mode 100644 index 0000000000..e6efa4a6b1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/d004a9.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +fn textureNumLevels_d004a9() { + var res : i32 = textureNumLevels(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_d004a9(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLevels_d004a9(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLevels_d004a9(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/dca09e.wgsl b/test/tint/builtins/gen/var/textureNumLevels/dca09e.wgsl new file mode 100644 index 0000000000..a058700e18 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/dca09e.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_3d; + +// fn textureNumLevels(texture: texture_3d) -> i32 +fn textureNumLevels_dca09e() { + var res: i32 = textureNumLevels(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_dca09e(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLevels_dca09e(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLevels_dca09e(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/dca09e.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLevels/dca09e.wgsl.expected.glsl new file mode 100644 index 0000000000..ba0c815048 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/dca09e.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp sampler3D arg_0_1; +void textureNumLevels_dca09e() { + int res = textureQueryLevels(arg_0_1); +} + +vec4 vertex_main() { + textureNumLevels_dca09e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp sampler3D arg_0_1; +void textureNumLevels_dca09e() { + int res = textureQueryLevels(arg_0_1); +} + +void fragment_main() { + textureNumLevels_dca09e(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' +ERROR: 0:6: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es + +uniform highp sampler3D arg_0_1; +void textureNumLevels_dca09e() { + int res = textureQueryLevels(arg_0_1); +} + +void compute_main() { + textureNumLevels_dca09e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureNumLevels/dca09e.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLevels/dca09e.wgsl.expected.hlsl new file mode 100644 index 0000000000..01307a423f --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/dca09e.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +Texture3D arg_0 : register(t0, space1); + +void textureNumLevels_dca09e() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int res = tint_tmp.w; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_dca09e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_dca09e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_dca09e(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/dca09e.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLevels/dca09e.wgsl.expected.msl new file mode 100644 index 0000000000..e7813c56e5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/dca09e.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLevels_dca09e(texture3d tint_symbol_1) { + int res = int(tint_symbol_1.get_num_mip_levels()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureNumLevels_dca09e(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureNumLevels_dca09e(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureNumLevels_dca09e(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLevels/dca09e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLevels/dca09e.wgsl.expected.spvasm new file mode 100644 index 0000000000..3ee917e064 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/dca09e.wgsl.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLevels_dca09e "textureNumLevels_dca09e" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 3D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLevels_dca09e = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_int Function %21 + %18 = OpLoad %11 %arg_0 + %16 = OpImageQueryLevels %int %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %textureNumLevels_dca09e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %31 = OpLabel + %32 = OpFunctionCall %void %textureNumLevels_dca09e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %34 = OpLabel + %35 = OpFunctionCall %void %textureNumLevels_dca09e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLevels/dca09e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLevels/dca09e.wgsl.expected.wgsl new file mode 100644 index 0000000000..81c2ed177f --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/dca09e.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_3d; + +fn textureNumLevels_dca09e() { + var res : i32 = textureNumLevels(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_dca09e(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLevels_dca09e(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLevels_dca09e(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/e67231.wgsl b/test/tint/builtins/gen/var/textureNumLevels/e67231.wgsl new file mode 100644 index 0000000000..782d93a6e0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/e67231.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d; + +// fn textureNumLevels(texture: texture_2d) -> i32 +fn textureNumLevels_e67231() { + var res: i32 = textureNumLevels(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_e67231(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLevels_e67231(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLevels_e67231(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/e67231.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLevels/e67231.wgsl.expected.glsl new file mode 100644 index 0000000000..5345038ff9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/e67231.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp sampler2D arg_0_1; +void textureNumLevels_e67231() { + int res = textureQueryLevels(arg_0_1); +} + +vec4 vertex_main() { + textureNumLevels_e67231(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp sampler2D arg_0_1; +void textureNumLevels_e67231() { + int res = textureQueryLevels(arg_0_1); +} + +void fragment_main() { + textureNumLevels_e67231(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' +ERROR: 0:6: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es + +uniform highp sampler2D arg_0_1; +void textureNumLevels_e67231() { + int res = textureQueryLevels(arg_0_1); +} + +void compute_main() { + textureNumLevels_e67231(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureNumLevels/e67231.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLevels/e67231.wgsl.expected.hlsl new file mode 100644 index 0000000000..a6f8a6f769 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/e67231.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_0 : register(t0, space1); + +void textureNumLevels_e67231() { + int3 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_e67231(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_e67231(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_e67231(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/e67231.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLevels/e67231.wgsl.expected.msl new file mode 100644 index 0000000000..0a9f1ef9b3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/e67231.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLevels_e67231(texture2d tint_symbol_1) { + int res = int(tint_symbol_1.get_num_mip_levels()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureNumLevels_e67231(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureNumLevels_e67231(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureNumLevels_e67231(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLevels/e67231.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLevels/e67231.wgsl.expected.spvasm new file mode 100644 index 0000000000..f2974bb0da --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/e67231.wgsl.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLevels_e67231 "textureNumLevels_e67231" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLevels_e67231 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_int Function %21 + %18 = OpLoad %11 %arg_0 + %16 = OpImageQueryLevels %int %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %textureNumLevels_e67231 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %31 = OpLabel + %32 = OpFunctionCall %void %textureNumLevels_e67231 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %34 = OpLabel + %35 = OpFunctionCall %void %textureNumLevels_e67231 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLevels/e67231.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLevels/e67231.wgsl.expected.wgsl new file mode 100644 index 0000000000..b9b5a95d56 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/e67231.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_2d; + +fn textureNumLevels_e67231() { + var res : i32 = textureNumLevels(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_e67231(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLevels_e67231(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLevels_e67231(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/ed078b.wgsl b/test/tint/builtins/gen/var/textureNumLevels/ed078b.wgsl new file mode 100644 index 0000000000..d3620a2b10 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/ed078b.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube; + +// fn textureNumLevels(texture: texture_cube) -> i32 +fn textureNumLevels_ed078b() { + var res: i32 = textureNumLevels(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_ed078b(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLevels_ed078b(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLevels_ed078b(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/ed078b.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLevels/ed078b.wgsl.expected.glsl new file mode 100644 index 0000000000..3293d1e204 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/ed078b.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp usamplerCube arg_0_1; +void textureNumLevels_ed078b() { + int res = textureQueryLevels(arg_0_1); +} + +vec4 vertex_main() { + textureNumLevels_ed078b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp usamplerCube arg_0_1; +void textureNumLevels_ed078b() { + int res = textureQueryLevels(arg_0_1); +} + +void fragment_main() { + textureNumLevels_ed078b(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' +ERROR: 0:6: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es + +uniform highp usamplerCube arg_0_1; +void textureNumLevels_ed078b() { + int res = textureQueryLevels(arg_0_1); +} + +void compute_main() { + textureNumLevels_ed078b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureNumLevels/ed078b.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLevels/ed078b.wgsl.expected.hlsl new file mode 100644 index 0000000000..75d40ead62 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/ed078b.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +TextureCube arg_0 : register(t0, space1); + +void textureNumLevels_ed078b() { + int3 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_ed078b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_ed078b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_ed078b(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/ed078b.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLevels/ed078b.wgsl.expected.msl new file mode 100644 index 0000000000..74d65639d5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/ed078b.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLevels_ed078b(texturecube tint_symbol_1) { + int res = int(tint_symbol_1.get_num_mip_levels()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube tint_symbol_2) { + textureNumLevels_ed078b(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube tint_symbol_4 [[texture(0)]]) { + textureNumLevels_ed078b(tint_symbol_4); + return; +} + +kernel void compute_main(texturecube tint_symbol_5 [[texture(0)]]) { + textureNumLevels_ed078b(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLevels/ed078b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLevels/ed078b.wgsl.expected.spvasm new file mode 100644 index 0000000000..78cf1434c8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/ed078b.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLevels_ed078b "textureNumLevels_ed078b" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint Cube 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %22 = OpConstantNull %int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLevels_ed078b = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %22 + %19 = OpLoad %11 %arg_0 + %17 = OpImageQueryLevels %int %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureNumLevels_ed078b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %32 = OpLabel + %33 = OpFunctionCall %void %textureNumLevels_ed078b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureNumLevels_ed078b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLevels/ed078b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLevels/ed078b.wgsl.expected.wgsl new file mode 100644 index 0000000000..1eb3d87ad7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/ed078b.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_cube; + +fn textureNumLevels_ed078b() { + var res : i32 = textureNumLevels(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_ed078b(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLevels_ed078b(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLevels_ed078b(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/f46ec6.wgsl b/test/tint/builtins/gen/var/textureNumLevels/f46ec6.wgsl new file mode 100644 index 0000000000..665436bef1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/f46ec6.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube_array; + +// fn textureNumLevels(texture: texture_cube_array) -> i32 +fn textureNumLevels_f46ec6() { + var res: i32 = textureNumLevels(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_f46ec6(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLevels_f46ec6(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLevels_f46ec6(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/f46ec6.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLevels/f46ec6.wgsl.expected.glsl new file mode 100644 index 0000000000..1da3a81ad4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/f46ec6.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +uniform highp usamplerCubeArray arg_0_1; +void textureNumLevels_f46ec6() { + int res = textureQueryLevels(arg_0_1); +} + +vec4 vertex_main() { + textureNumLevels_f46ec6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'usamplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp usamplerCubeArray arg_0_1; +void textureNumLevels_f46ec6() { + int res = textureQueryLevels(arg_0_1); +} + +void fragment_main() { + textureNumLevels_f46ec6(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'usamplerCubeArray' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp usamplerCubeArray arg_0_1; +void textureNumLevels_f46ec6() { + int res = textureQueryLevels(arg_0_1); +} + +void compute_main() { + textureNumLevels_f46ec6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'usamplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureNumLevels/f46ec6.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLevels/f46ec6.wgsl.expected.hlsl new file mode 100644 index 0000000000..3a16309ca7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/f46ec6.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureNumLevels_f46ec6() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int res = tint_tmp.w; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_f46ec6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_f46ec6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_f46ec6(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/f46ec6.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLevels/f46ec6.wgsl.expected.msl new file mode 100644 index 0000000000..83873b6123 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/f46ec6.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLevels_f46ec6(texturecube_array tint_symbol_1) { + int res = int(tint_symbol_1.get_num_mip_levels()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube_array tint_symbol_2) { + textureNumLevels_f46ec6(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube_array tint_symbol_4 [[texture(0)]]) { + textureNumLevels_f46ec6(tint_symbol_4); + return; +} + +kernel void compute_main(texturecube_array tint_symbol_5 [[texture(0)]]) { + textureNumLevels_f46ec6(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLevels/f46ec6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLevels/f46ec6.wgsl.expected.spvasm new file mode 100644 index 0000000000..7650c289bc --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/f46ec6.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLevels_f46ec6 "textureNumLevels_f46ec6" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %22 = OpConstantNull %int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLevels_f46ec6 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %22 + %19 = OpLoad %11 %arg_0 + %17 = OpImageQueryLevels %int %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureNumLevels_f46ec6 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %32 = OpLabel + %33 = OpFunctionCall %void %textureNumLevels_f46ec6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureNumLevels_f46ec6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLevels/f46ec6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLevels/f46ec6.wgsl.expected.wgsl new file mode 100644 index 0000000000..d380d9b72a --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/f46ec6.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_cube_array; + +fn textureNumLevels_f46ec6() { + var res : i32 = textureNumLevels(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_f46ec6(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLevels_f46ec6(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLevels_f46ec6(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/f5828d.wgsl b/test/tint/builtins/gen/var/textureNumLevels/f5828d.wgsl new file mode 100644 index 0000000000..0c000af8e8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/f5828d.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d_array; + +// fn textureNumLevels(texture: texture_depth_2d_array) -> i32 +fn textureNumLevels_f5828d() { + var res: i32 = textureNumLevels(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_f5828d(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLevels_f5828d(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLevels_f5828d(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/f5828d.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLevels/f5828d.wgsl.expected.glsl new file mode 100644 index 0000000000..e810a1a552 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/f5828d.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp sampler2DArray arg_0_1; +void textureNumLevels_f5828d() { + int res = textureQueryLevels(arg_0_1); +} + +vec4 vertex_main() { + textureNumLevels_f5828d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp sampler2DArray arg_0_1; +void textureNumLevels_f5828d() { + int res = textureQueryLevels(arg_0_1); +} + +void fragment_main() { + textureNumLevels_f5828d(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' +ERROR: 0:6: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es + +uniform highp sampler2DArray arg_0_1; +void textureNumLevels_f5828d() { + int res = textureQueryLevels(arg_0_1); +} + +void compute_main() { + textureNumLevels_f5828d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureNumLevels/f5828d.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLevels/f5828d.wgsl.expected.hlsl new file mode 100644 index 0000000000..05d604d60a --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/f5828d.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureNumLevels_f5828d() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int res = tint_tmp.w; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_f5828d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_f5828d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_f5828d(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/f5828d.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLevels/f5828d.wgsl.expected.msl new file mode 100644 index 0000000000..0a150257cc --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/f5828d.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLevels_f5828d(depth2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_num_mip_levels()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d_array tint_symbol_2) { + textureNumLevels_f5828d(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLevels_f5828d(tint_symbol_4); + return; +} + +kernel void compute_main(depth2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLevels_f5828d(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLevels/f5828d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLevels/f5828d.wgsl.expected.spvasm new file mode 100644 index 0000000000..6af2f4a3f2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/f5828d.wgsl.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLevels_f5828d "textureNumLevels_f5828d" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLevels_f5828d = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_int Function %21 + %18 = OpLoad %11 %arg_0 + %16 = OpImageQueryLevels %int %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %textureNumLevels_f5828d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %31 = OpLabel + %32 = OpFunctionCall %void %textureNumLevels_f5828d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %34 = OpLabel + %35 = OpFunctionCall %void %textureNumLevels_f5828d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLevels/f5828d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLevels/f5828d.wgsl.expected.wgsl new file mode 100644 index 0000000000..501fe61734 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/f5828d.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d_array; + +fn textureNumLevels_f5828d() { + var res : i32 = textureNumLevels(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_f5828d(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumLevels_f5828d(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumLevels_f5828d(); +} diff --git a/test/tint/builtins/gen/var/textureNumSamples/2c6f14.wgsl b/test/tint/builtins/gen/var/textureNumSamples/2c6f14.wgsl new file mode 100644 index 0000000000..749d887c52 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumSamples/2c6f14.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_multisampled_2d; + +// fn textureNumSamples(texture: texture_multisampled_2d) -> i32 +fn textureNumSamples_2c6f14() { + var res: i32 = textureNumSamples(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumSamples_2c6f14(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumSamples_2c6f14(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumSamples_2c6f14(); +} diff --git a/test/tint/builtins/gen/var/textureNumSamples/2c6f14.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumSamples/2c6f14.wgsl.expected.glsl new file mode 100644 index 0000000000..5abe128e4b --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumSamples/2c6f14.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp sampler2DMS arg_0_1; +void textureNumSamples_2c6f14() { + int res = textureSamples(arg_0_1); +} + +vec4 vertex_main() { + textureNumSamples_2c6f14(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureSamples' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp sampler2DMS arg_0_1; +void textureNumSamples_2c6f14() { + int res = textureSamples(arg_0_1); +} + +void fragment_main() { + textureNumSamples_2c6f14(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:6: 'textureSamples' : no matching overloaded function found +ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' +ERROR: 0:6: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es + +uniform highp sampler2DMS arg_0_1; +void textureNumSamples_2c6f14() { + int res = textureSamples(arg_0_1); +} + +void compute_main() { + textureNumSamples_2c6f14(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureSamples' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureNumSamples/2c6f14.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumSamples/2c6f14.wgsl.expected.hlsl new file mode 100644 index 0000000000..6c3feafdaa --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumSamples/2c6f14.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +Texture2DMS arg_0 : register(t0, space1); + +void textureNumSamples_2c6f14() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumSamples_2c6f14(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumSamples_2c6f14(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumSamples_2c6f14(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumSamples/2c6f14.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumSamples/2c6f14.wgsl.expected.msl new file mode 100644 index 0000000000..b062129875 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumSamples/2c6f14.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumSamples_2c6f14(texture2d_ms tint_symbol_1) { + int res = int(tint_symbol_1.get_num_samples()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_ms tint_symbol_2) { + textureNumSamples_2c6f14(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_ms tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_ms tint_symbol_4 [[texture(0)]]) { + textureNumSamples_2c6f14(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_ms tint_symbol_5 [[texture(0)]]) { + textureNumSamples_2c6f14(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumSamples/2c6f14.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumSamples/2c6f14.wgsl.expected.spvasm new file mode 100644 index 0000000000..f1b55e4d73 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumSamples/2c6f14.wgsl.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumSamples_2c6f14 "textureNumSamples_2c6f14" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 1 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumSamples_2c6f14 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_int Function %21 + %18 = OpLoad %11 %arg_0 + %16 = OpImageQuerySamples %int %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %textureNumSamples_2c6f14 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %31 = OpLabel + %32 = OpFunctionCall %void %textureNumSamples_2c6f14 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %34 = OpLabel + %35 = OpFunctionCall %void %textureNumSamples_2c6f14 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumSamples/2c6f14.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumSamples/2c6f14.wgsl.expected.wgsl new file mode 100644 index 0000000000..be4993462f --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumSamples/2c6f14.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_multisampled_2d; + +fn textureNumSamples_2c6f14() { + var res : i32 = textureNumSamples(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumSamples_2c6f14(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumSamples_2c6f14(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumSamples_2c6f14(); +} diff --git a/test/tint/builtins/gen/var/textureNumSamples/42f8bb.wgsl b/test/tint/builtins/gen/var/textureNumSamples/42f8bb.wgsl new file mode 100644 index 0000000000..429e2eb7c2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumSamples/42f8bb.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_multisampled_2d; + +// fn textureNumSamples(texture: texture_multisampled_2d) -> i32 +fn textureNumSamples_42f8bb() { + var res: i32 = textureNumSamples(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumSamples_42f8bb(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumSamples_42f8bb(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumSamples_42f8bb(); +} diff --git a/test/tint/builtins/gen/var/textureNumSamples/42f8bb.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumSamples/42f8bb.wgsl.expected.glsl new file mode 100644 index 0000000000..8a06334bf4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumSamples/42f8bb.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp usampler2DMS arg_0_1; +void textureNumSamples_42f8bb() { + int res = textureSamples(arg_0_1); +} + +vec4 vertex_main() { + textureNumSamples_42f8bb(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureSamples' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp usampler2DMS arg_0_1; +void textureNumSamples_42f8bb() { + int res = textureSamples(arg_0_1); +} + +void fragment_main() { + textureNumSamples_42f8bb(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:6: 'textureSamples' : no matching overloaded function found +ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' +ERROR: 0:6: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es + +uniform highp usampler2DMS arg_0_1; +void textureNumSamples_42f8bb() { + int res = textureSamples(arg_0_1); +} + +void compute_main() { + textureNumSamples_42f8bb(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureSamples' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureNumSamples/42f8bb.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumSamples/42f8bb.wgsl.expected.hlsl new file mode 100644 index 0000000000..415abda1e8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumSamples/42f8bb.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +Texture2DMS arg_0 : register(t0, space1); + +void textureNumSamples_42f8bb() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumSamples_42f8bb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumSamples_42f8bb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumSamples_42f8bb(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumSamples/42f8bb.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumSamples/42f8bb.wgsl.expected.msl new file mode 100644 index 0000000000..d951a7eee8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumSamples/42f8bb.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumSamples_42f8bb(texture2d_ms tint_symbol_1) { + int res = int(tint_symbol_1.get_num_samples()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_ms tint_symbol_2) { + textureNumSamples_42f8bb(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_ms tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_ms tint_symbol_4 [[texture(0)]]) { + textureNumSamples_42f8bb(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_ms tint_symbol_5 [[texture(0)]]) { + textureNumSamples_42f8bb(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumSamples/42f8bb.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumSamples/42f8bb.wgsl.expected.spvasm new file mode 100644 index 0000000000..a8b65046e8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumSamples/42f8bb.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumSamples_42f8bb "textureNumSamples_42f8bb" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 0 1 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %22 = OpConstantNull %int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumSamples_42f8bb = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %22 + %19 = OpLoad %11 %arg_0 + %17 = OpImageQuerySamples %int %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureNumSamples_42f8bb + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %32 = OpLabel + %33 = OpFunctionCall %void %textureNumSamples_42f8bb + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureNumSamples_42f8bb + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumSamples/42f8bb.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumSamples/42f8bb.wgsl.expected.wgsl new file mode 100644 index 0000000000..ef11b63656 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumSamples/42f8bb.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_multisampled_2d; + +fn textureNumSamples_42f8bb() { + var res : i32 = textureNumSamples(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumSamples_42f8bb(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumSamples_42f8bb(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumSamples_42f8bb(); +} diff --git a/test/tint/builtins/gen/var/textureNumSamples/449d23.wgsl b/test/tint/builtins/gen/var/textureNumSamples/449d23.wgsl new file mode 100644 index 0000000000..e5e5bafc0a --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumSamples/449d23.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_multisampled_2d; + +// fn textureNumSamples(texture: texture_multisampled_2d) -> i32 +fn textureNumSamples_449d23() { + var res: i32 = textureNumSamples(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumSamples_449d23(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumSamples_449d23(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumSamples_449d23(); +} diff --git a/test/tint/builtins/gen/var/textureNumSamples/449d23.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumSamples/449d23.wgsl.expected.glsl new file mode 100644 index 0000000000..2b60dd51be --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumSamples/449d23.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp isampler2DMS arg_0_1; +void textureNumSamples_449d23() { + int res = textureSamples(arg_0_1); +} + +vec4 vertex_main() { + textureNumSamples_449d23(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureSamples' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp isampler2DMS arg_0_1; +void textureNumSamples_449d23() { + int res = textureSamples(arg_0_1); +} + +void fragment_main() { + textureNumSamples_449d23(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:6: 'textureSamples' : no matching overloaded function found +ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' +ERROR: 0:6: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es + +uniform highp isampler2DMS arg_0_1; +void textureNumSamples_449d23() { + int res = textureSamples(arg_0_1); +} + +void compute_main() { + textureNumSamples_449d23(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureSamples' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureNumSamples/449d23.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumSamples/449d23.wgsl.expected.hlsl new file mode 100644 index 0000000000..4dbf2f0a56 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumSamples/449d23.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +Texture2DMS arg_0 : register(t0, space1); + +void textureNumSamples_449d23() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumSamples_449d23(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumSamples_449d23(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumSamples_449d23(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumSamples/449d23.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumSamples/449d23.wgsl.expected.msl new file mode 100644 index 0000000000..18e0ad7500 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumSamples/449d23.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumSamples_449d23(texture2d_ms tint_symbol_1) { + int res = int(tint_symbol_1.get_num_samples()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_ms tint_symbol_2) { + textureNumSamples_449d23(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_ms tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_ms tint_symbol_4 [[texture(0)]]) { + textureNumSamples_449d23(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_ms tint_symbol_5 [[texture(0)]]) { + textureNumSamples_449d23(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumSamples/449d23.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumSamples/449d23.wgsl.expected.spvasm new file mode 100644 index 0000000000..f89f9018a4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumSamples/449d23.wgsl.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumSamples_449d23 "textureNumSamples_449d23" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 0 1 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumSamples_449d23 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %21 + %18 = OpLoad %11 %arg_0 + %17 = OpImageQuerySamples %int %18 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %textureNumSamples_449d23 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %31 = OpLabel + %32 = OpFunctionCall %void %textureNumSamples_449d23 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %void %textureNumSamples_449d23 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumSamples/449d23.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumSamples/449d23.wgsl.expected.wgsl new file mode 100644 index 0000000000..9cab69e2c1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumSamples/449d23.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_multisampled_2d; + +fn textureNumSamples_449d23() { + var res : i32 = textureNumSamples(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumSamples_449d23(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumSamples_449d23(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumSamples_449d23(); +} diff --git a/test/tint/builtins/gen/var/textureNumSamples/a3c8a0.wgsl b/test/tint/builtins/gen/var/textureNumSamples/a3c8a0.wgsl new file mode 100644 index 0000000000..11df4fb6a4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumSamples/a3c8a0.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_multisampled_2d; + +// fn textureNumSamples(texture: texture_depth_multisampled_2d) -> i32 +fn textureNumSamples_a3c8a0() { + var res: i32 = textureNumSamples(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumSamples_a3c8a0(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumSamples_a3c8a0(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumSamples_a3c8a0(); +} diff --git a/test/tint/builtins/gen/var/textureNumSamples/a3c8a0.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumSamples/a3c8a0.wgsl.expected.glsl new file mode 100644 index 0000000000..826c680985 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumSamples/a3c8a0.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp sampler2DMS arg_0_1; +void textureNumSamples_a3c8a0() { + int res = textureSamples(arg_0_1); +} + +vec4 vertex_main() { + textureNumSamples_a3c8a0(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureSamples' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp sampler2DMS arg_0_1; +void textureNumSamples_a3c8a0() { + int res = textureSamples(arg_0_1); +} + +void fragment_main() { + textureNumSamples_a3c8a0(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:6: 'textureSamples' : no matching overloaded function found +ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' +ERROR: 0:6: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es + +uniform highp sampler2DMS arg_0_1; +void textureNumSamples_a3c8a0() { + int res = textureSamples(arg_0_1); +} + +void compute_main() { + textureNumSamples_a3c8a0(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureSamples' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureNumSamples/a3c8a0.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumSamples/a3c8a0.wgsl.expected.hlsl new file mode 100644 index 0000000000..0eb375a965 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumSamples/a3c8a0.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +Texture2DMS arg_0 : register(t0, space1); + +void textureNumSamples_a3c8a0() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumSamples_a3c8a0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumSamples_a3c8a0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumSamples_a3c8a0(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumSamples/a3c8a0.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumSamples/a3c8a0.wgsl.expected.msl new file mode 100644 index 0000000000..c3db04e5e6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumSamples/a3c8a0.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumSamples_a3c8a0(depth2d_ms tint_symbol_1) { + int res = int(tint_symbol_1.get_num_samples()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d_ms tint_symbol_2) { + textureNumSamples_a3c8a0(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d_ms tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d_ms tint_symbol_4 [[texture(0)]]) { + textureNumSamples_a3c8a0(tint_symbol_4); + return; +} + +kernel void compute_main(depth2d_ms tint_symbol_5 [[texture(0)]]) { + textureNumSamples_a3c8a0(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumSamples/a3c8a0.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumSamples/a3c8a0.wgsl.expected.spvasm new file mode 100644 index 0000000000..a6f64b190f --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumSamples/a3c8a0.wgsl.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumSamples_a3c8a0 "textureNumSamples_a3c8a0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 1 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumSamples_a3c8a0 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_int Function %21 + %18 = OpLoad %11 %arg_0 + %16 = OpImageQuerySamples %int %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %textureNumSamples_a3c8a0 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %31 = OpLabel + %32 = OpFunctionCall %void %textureNumSamples_a3c8a0 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %34 = OpLabel + %35 = OpFunctionCall %void %textureNumSamples_a3c8a0 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumSamples/a3c8a0.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumSamples/a3c8a0.wgsl.expected.wgsl new file mode 100644 index 0000000000..29a914ad8b --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumSamples/a3c8a0.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_depth_multisampled_2d; + +fn textureNumSamples_a3c8a0() { + var res : i32 = textureNumSamples(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureNumSamples_a3c8a0(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureNumSamples_a3c8a0(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureNumSamples_a3c8a0(); +} diff --git a/test/tint/builtins/gen/var/textureSample/0dff6c.wgsl b/test/tint/builtins/gen/var/textureSample/0dff6c.wgsl new file mode 100644 index 0000000000..0add540f49 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/0dff6c.wgsl @@ -0,0 +1,37 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSample(texture: texture_depth_2d, sampler: sampler, coords: vec2, @const offset: vec2) -> f32 +fn textureSample_0dff6c() { + var arg_2 = vec2(); + var res: f32 = textureSample(arg_0, arg_1, arg_2, vec2()); +} + +@stage(fragment) +fn fragment_main() { + textureSample_0dff6c(); +} diff --git a/test/tint/builtins/gen/var/textureSample/0dff6c.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSample/0dff6c.wgsl.expected.glsl new file mode 100644 index 0000000000..29464a04c7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/0dff6c.wgsl.expected.glsl @@ -0,0 +1,18 @@ +#version 310 es +precision mediump float; + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureSample_0dff6c() { + vec2 arg_2 = vec2(0.0f); + float res = textureOffset(arg_0_arg_1, vec3(arg_2, 0.0f), ivec2(0)); +} + +void fragment_main() { + textureSample_0dff6c(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSample/0dff6c.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSample/0dff6c.wgsl.expected.hlsl new file mode 100644 index 0000000000..4bd60c002c --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/0dff6c.wgsl.expected.hlsl @@ -0,0 +1,12 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_0dff6c() { + float2 arg_2 = (0.0f).xx; + float res = arg_0.Sample(arg_1, arg_2, (0).xx).x; +} + +void fragment_main() { + textureSample_0dff6c(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSample/0dff6c.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSample/0dff6c.wgsl.expected.msl new file mode 100644 index 0000000000..b6fd4869d6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/0dff6c.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void textureSample_0dff6c(depth2d tint_symbol, sampler tint_symbol_1) { + float2 arg_2 = float2(0.0f); + float res = tint_symbol.sample(tint_symbol_1, arg_2, int2(0)); +} + +fragment void fragment_main(depth2d tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSample_0dff6c(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSample/0dff6c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSample/0dff6c.wgsl.expected.spvasm new file mode 100644 index 0000000000..d548219a96 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/0dff6c.wgsl.expected.spvasm @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSample_0dff6c "textureSample_0dff6c" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %13 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %v4float = OpTypeVector %float 4 + %21 = OpTypeSampledImage %3 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %26 = OpConstantNull %v2int +%_ptr_Function_float = OpTypePointer Function %float + %29 = OpConstantNull %float +%textureSample_0dff6c = OpFunction %void None %8 + %11 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %13 + %res = OpVariable %_ptr_Function_float Function %29 + OpStore %arg_2 %13 + %19 = OpLoad %7 %arg_1 + %20 = OpLoad %3 %arg_0 + %22 = OpSampledImage %21 %20 %19 + %23 = OpLoad %v2float %arg_2 + %17 = OpImageSampleImplicitLod %v4float %22 %23 ConstOffset %26 + %16 = OpCompositeExtract %float %17 0 + OpStore %res %16 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %31 = OpLabel + %32 = OpFunctionCall %void %textureSample_0dff6c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSample/0dff6c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSample/0dff6c.wgsl.expected.wgsl new file mode 100644 index 0000000000..20cb56fa3a --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/0dff6c.wgsl.expected.wgsl @@ -0,0 +1,13 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSample_0dff6c() { + var arg_2 = vec2(); + var res : f32 = textureSample(arg_0, arg_1, arg_2, vec2()); +} + +@stage(fragment) +fn fragment_main() { + textureSample_0dff6c(); +} diff --git a/test/tint/builtins/gen/var/textureSample/17e988.wgsl b/test/tint/builtins/gen/var/textureSample/17e988.wgsl new file mode 100644 index 0000000000..96fe6ec685 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/17e988.wgsl @@ -0,0 +1,38 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSample(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, @const offset: vec2) -> vec4 +fn textureSample_17e988() { + var arg_2 = vec2(); + var arg_3 = 1; + var res: vec4 = textureSample(arg_0, arg_1, arg_2, arg_3, vec2()); +} + +@stage(fragment) +fn fragment_main() { + textureSample_17e988(); +} diff --git a/test/tint/builtins/gen/var/textureSample/17e988.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSample/17e988.wgsl.expected.glsl new file mode 100644 index 0000000000..95e45f8579 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/17e988.wgsl.expected.glsl @@ -0,0 +1,19 @@ +#version 310 es +precision mediump float; + +uniform highp sampler2DArray arg_0_arg_1; + +void textureSample_17e988() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + vec4 res = textureOffset(arg_0_arg_1, vec3(arg_2, float(arg_3)), ivec2(0)); +} + +void fragment_main() { + textureSample_17e988(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSample/17e988.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSample/17e988.wgsl.expected.hlsl new file mode 100644 index 0000000000..87521f1266 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/17e988.wgsl.expected.hlsl @@ -0,0 +1,13 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_17e988() { + float2 arg_2 = (0.0f).xx; + int arg_3 = 1; + float4 res = arg_0.Sample(arg_1, float3(arg_2, float(arg_3)), (0).xx); +} + +void fragment_main() { + textureSample_17e988(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSample/17e988.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSample/17e988.wgsl.expected.msl new file mode 100644 index 0000000000..19433ebed8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/17e988.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +void textureSample_17e988(texture2d_array tint_symbol, sampler tint_symbol_1) { + float2 arg_2 = float2(0.0f); + int arg_3 = 1; + float4 res = tint_symbol.sample(tint_symbol_1, arg_2, arg_3, int2(0)); +} + +fragment void fragment_main(texture2d_array tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSample_17e988(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSample/17e988.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSample/17e988.wgsl.expected.spvasm new file mode 100644 index 0000000000..4bb6bba355 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/17e988.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 42 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSample_17e988 "textureSample_17e988" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %13 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %20 = OpConstantNull %int + %v4float = OpTypeVector %float 4 + %25 = OpTypeSampledImage %3 + %v3float = OpTypeVector %float 3 + %v2int = OpTypeVector %int 2 + %35 = OpConstantNull %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %38 = OpConstantNull %v4float +%textureSample_17e988 = OpFunction %void None %8 + %11 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %13 + %arg_3 = OpVariable %_ptr_Function_int Function %20 + %res = OpVariable %_ptr_Function_v4float Function %38 + OpStore %arg_2 %13 + OpStore %arg_3 %int_1 + %23 = OpLoad %7 %arg_1 + %24 = OpLoad %3 %arg_0 + %26 = OpSampledImage %25 %24 %23 + %28 = OpLoad %v2float %arg_2 + %29 = OpCompositeExtract %float %28 0 + %30 = OpCompositeExtract %float %28 1 + %32 = OpLoad %int %arg_3 + %31 = OpConvertSToF %float %32 + %33 = OpCompositeConstruct %v3float %29 %30 %31 + %21 = OpImageSampleImplicitLod %v4float %26 %33 ConstOffset %35 + OpStore %res %21 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %40 = OpLabel + %41 = OpFunctionCall %void %textureSample_17e988 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSample/17e988.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSample/17e988.wgsl.expected.wgsl new file mode 100644 index 0000000000..f2733c2cea --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/17e988.wgsl.expected.wgsl @@ -0,0 +1,14 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSample_17e988() { + var arg_2 = vec2(); + var arg_3 = 1; + var res : vec4 = textureSample(arg_0, arg_1, arg_2, arg_3, vec2()); +} + +@stage(fragment) +fn fragment_main() { + textureSample_17e988(); +} diff --git a/test/tint/builtins/gen/var/textureSample/2149ec.wgsl b/test/tint/builtins/gen/var/textureSample/2149ec.wgsl new file mode 100644 index 0000000000..04300d36e7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/2149ec.wgsl @@ -0,0 +1,37 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_3d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSample(texture: texture_3d, sampler: sampler, coords: vec3, @const offset: vec3) -> vec4 +fn textureSample_2149ec() { + var arg_2 = vec3(); + var res: vec4 = textureSample(arg_0, arg_1, arg_2, vec3()); +} + +@stage(fragment) +fn fragment_main() { + textureSample_2149ec(); +} diff --git a/test/tint/builtins/gen/var/textureSample/2149ec.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSample/2149ec.wgsl.expected.glsl new file mode 100644 index 0000000000..67fde956fb --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/2149ec.wgsl.expected.glsl @@ -0,0 +1,18 @@ +#version 310 es +precision mediump float; + +uniform highp sampler3D arg_0_arg_1; + +void textureSample_2149ec() { + vec3 arg_2 = vec3(0.0f); + vec4 res = textureOffset(arg_0_arg_1, arg_2, ivec3(0)); +} + +void fragment_main() { + textureSample_2149ec(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSample/2149ec.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSample/2149ec.wgsl.expected.hlsl new file mode 100644 index 0000000000..1528b90d0a --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/2149ec.wgsl.expected.hlsl @@ -0,0 +1,12 @@ +Texture3D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_2149ec() { + float3 arg_2 = (0.0f).xxx; + float4 res = arg_0.Sample(arg_1, arg_2, (0).xxx); +} + +void fragment_main() { + textureSample_2149ec(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSample/2149ec.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSample/2149ec.wgsl.expected.msl new file mode 100644 index 0000000000..96ab51e48c --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/2149ec.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void textureSample_2149ec(texture3d tint_symbol, sampler tint_symbol_1) { + float3 arg_2 = float3(0.0f); + float4 res = tint_symbol.sample(tint_symbol_1, arg_2, int3(0)); +} + +fragment void fragment_main(texture3d tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSample_2149ec(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSample/2149ec.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSample/2149ec.wgsl.expected.spvasm new file mode 100644 index 0000000000..8e435b94be --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/2149ec.wgsl.expected.spvasm @@ -0,0 +1,56 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSample_2149ec "textureSample_2149ec" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 3D 0 0 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %13 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %v4float = OpTypeVector %float 4 + %20 = OpTypeSampledImage %3 + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %25 = OpConstantNull %v3int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %28 = OpConstantNull %v4float +%textureSample_2149ec = OpFunction %void None %8 + %11 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v3float Function %13 + %res = OpVariable %_ptr_Function_v4float Function %28 + OpStore %arg_2 %13 + %18 = OpLoad %7 %arg_1 + %19 = OpLoad %3 %arg_0 + %21 = OpSampledImage %20 %19 %18 + %22 = OpLoad %v3float %arg_2 + %16 = OpImageSampleImplicitLod %v4float %21 %22 ConstOffset %25 + OpStore %res %16 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %30 = OpLabel + %31 = OpFunctionCall %void %textureSample_2149ec + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSample/2149ec.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSample/2149ec.wgsl.expected.wgsl new file mode 100644 index 0000000000..8b881c36fd --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/2149ec.wgsl.expected.wgsl @@ -0,0 +1,13 @@ +@group(1) @binding(0) var arg_0 : texture_3d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSample_2149ec() { + var arg_2 = vec3(); + var res : vec4 = textureSample(arg_0, arg_1, arg_2, vec3()); +} + +@stage(fragment) +fn fragment_main() { + textureSample_2149ec(); +} diff --git a/test/tint/builtins/gen/var/textureSample/38bbb9.wgsl b/test/tint/builtins/gen/var/textureSample/38bbb9.wgsl new file mode 100644 index 0000000000..fc2182722f --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/38bbb9.wgsl @@ -0,0 +1,37 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSample(texture: texture_depth_2d, sampler: sampler, coords: vec2) -> f32 +fn textureSample_38bbb9() { + var arg_2 = vec2(); + var res: f32 = textureSample(arg_0, arg_1, arg_2); +} + +@stage(fragment) +fn fragment_main() { + textureSample_38bbb9(); +} diff --git a/test/tint/builtins/gen/var/textureSample/38bbb9.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSample/38bbb9.wgsl.expected.glsl new file mode 100644 index 0000000000..31f10fa0b5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/38bbb9.wgsl.expected.glsl @@ -0,0 +1,18 @@ +#version 310 es +precision mediump float; + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureSample_38bbb9() { + vec2 arg_2 = vec2(0.0f); + float res = texture(arg_0_arg_1, vec3(arg_2, 0.0f)); +} + +void fragment_main() { + textureSample_38bbb9(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSample/38bbb9.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSample/38bbb9.wgsl.expected.hlsl new file mode 100644 index 0000000000..ffedf8fcf9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/38bbb9.wgsl.expected.hlsl @@ -0,0 +1,12 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_38bbb9() { + float2 arg_2 = (0.0f).xx; + float res = arg_0.Sample(arg_1, arg_2).x; +} + +void fragment_main() { + textureSample_38bbb9(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSample/38bbb9.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSample/38bbb9.wgsl.expected.msl new file mode 100644 index 0000000000..6482503766 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/38bbb9.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void textureSample_38bbb9(depth2d tint_symbol, sampler tint_symbol_1) { + float2 arg_2 = float2(0.0f); + float res = tint_symbol.sample(tint_symbol_1, arg_2); +} + +fragment void fragment_main(depth2d tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSample_38bbb9(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSample/38bbb9.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSample/38bbb9.wgsl.expected.spvasm new file mode 100644 index 0000000000..05511e90da --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/38bbb9.wgsl.expected.spvasm @@ -0,0 +1,54 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 30 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSample_38bbb9 "textureSample_38bbb9" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %13 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %v4float = OpTypeVector %float 4 + %21 = OpTypeSampledImage %3 +%_ptr_Function_float = OpTypePointer Function %float + %26 = OpConstantNull %float +%textureSample_38bbb9 = OpFunction %void None %8 + %11 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %13 + %res = OpVariable %_ptr_Function_float Function %26 + OpStore %arg_2 %13 + %19 = OpLoad %7 %arg_1 + %20 = OpLoad %3 %arg_0 + %22 = OpSampledImage %21 %20 %19 + %23 = OpLoad %v2float %arg_2 + %17 = OpImageSampleImplicitLod %v4float %22 %23 + %16 = OpCompositeExtract %float %17 0 + OpStore %res %16 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %28 = OpLabel + %29 = OpFunctionCall %void %textureSample_38bbb9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSample/38bbb9.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSample/38bbb9.wgsl.expected.wgsl new file mode 100644 index 0000000000..b0e17c0df0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/38bbb9.wgsl.expected.wgsl @@ -0,0 +1,13 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSample_38bbb9() { + var arg_2 = vec2(); + var res : f32 = textureSample(arg_0, arg_1, arg_2); +} + +@stage(fragment) +fn fragment_main() { + textureSample_38bbb9(); +} diff --git a/test/tint/builtins/gen/var/textureSample/3b50bd.wgsl b/test/tint/builtins/gen/var/textureSample/3b50bd.wgsl new file mode 100644 index 0000000000..903d5409ea --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/3b50bd.wgsl @@ -0,0 +1,37 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_3d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSample(texture: texture_3d, sampler: sampler, coords: vec3) -> vec4 +fn textureSample_3b50bd() { + var arg_2 = vec3(); + var res: vec4 = textureSample(arg_0, arg_1, arg_2); +} + +@stage(fragment) +fn fragment_main() { + textureSample_3b50bd(); +} diff --git a/test/tint/builtins/gen/var/textureSample/3b50bd.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSample/3b50bd.wgsl.expected.glsl new file mode 100644 index 0000000000..1f936b41ae --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/3b50bd.wgsl.expected.glsl @@ -0,0 +1,18 @@ +#version 310 es +precision mediump float; + +uniform highp sampler3D arg_0_arg_1; + +void textureSample_3b50bd() { + vec3 arg_2 = vec3(0.0f); + vec4 res = texture(arg_0_arg_1, arg_2); +} + +void fragment_main() { + textureSample_3b50bd(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSample/3b50bd.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSample/3b50bd.wgsl.expected.hlsl new file mode 100644 index 0000000000..29a54eaca8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/3b50bd.wgsl.expected.hlsl @@ -0,0 +1,12 @@ +Texture3D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_3b50bd() { + float3 arg_2 = (0.0f).xxx; + float4 res = arg_0.Sample(arg_1, arg_2); +} + +void fragment_main() { + textureSample_3b50bd(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSample/3b50bd.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSample/3b50bd.wgsl.expected.msl new file mode 100644 index 0000000000..0bf2684644 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/3b50bd.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void textureSample_3b50bd(texture3d tint_symbol, sampler tint_symbol_1) { + float3 arg_2 = float3(0.0f); + float4 res = tint_symbol.sample(tint_symbol_1, arg_2); +} + +fragment void fragment_main(texture3d tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSample_3b50bd(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSample/3b50bd.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSample/3b50bd.wgsl.expected.spvasm new file mode 100644 index 0000000000..2539dd1b7b --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/3b50bd.wgsl.expected.spvasm @@ -0,0 +1,53 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 29 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSample_3b50bd "textureSample_3b50bd" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 3D 0 0 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %13 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %v4float = OpTypeVector %float 4 + %20 = OpTypeSampledImage %3 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %25 = OpConstantNull %v4float +%textureSample_3b50bd = OpFunction %void None %8 + %11 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v3float Function %13 + %res = OpVariable %_ptr_Function_v4float Function %25 + OpStore %arg_2 %13 + %18 = OpLoad %7 %arg_1 + %19 = OpLoad %3 %arg_0 + %21 = OpSampledImage %20 %19 %18 + %22 = OpLoad %v3float %arg_2 + %16 = OpImageSampleImplicitLod %v4float %21 %22 + OpStore %res %16 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %27 = OpLabel + %28 = OpFunctionCall %void %textureSample_3b50bd + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSample/3b50bd.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSample/3b50bd.wgsl.expected.wgsl new file mode 100644 index 0000000000..3c2755f88c --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/3b50bd.wgsl.expected.wgsl @@ -0,0 +1,13 @@ +@group(1) @binding(0) var arg_0 : texture_3d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSample_3b50bd() { + var arg_2 = vec3(); + var res : vec4 = textureSample(arg_0, arg_1, arg_2); +} + +@stage(fragment) +fn fragment_main() { + textureSample_3b50bd(); +} diff --git a/test/tint/builtins/gen/var/textureSample/4dd1bf.wgsl b/test/tint/builtins/gen/var/textureSample/4dd1bf.wgsl new file mode 100644 index 0000000000..c4e81e9bb5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/4dd1bf.wgsl @@ -0,0 +1,38 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube_array; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSample(texture: texture_cube_array, sampler: sampler, coords: vec3, array_index: i32) -> vec4 +fn textureSample_4dd1bf() { + var arg_2 = vec3(); + var arg_3 = 1; + var res: vec4 = textureSample(arg_0, arg_1, arg_2, arg_3); +} + +@stage(fragment) +fn fragment_main() { + textureSample_4dd1bf(); +} diff --git a/test/tint/builtins/gen/var/textureSample/4dd1bf.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSample/4dd1bf.wgsl.expected.glsl new file mode 100644 index 0000000000..8d39802d54 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/4dd1bf.wgsl.expected.glsl @@ -0,0 +1,28 @@ +SKIP: FAILED + +#version 310 es +precision mediump float; + +uniform highp samplerCubeArray arg_0_arg_1; + +void textureSample_4dd1bf() { + vec3 arg_2 = vec3(0.0f); + int arg_3 = 1; + vec4 res = texture(arg_0_arg_1, vec4(arg_2, float(arg_3))); +} + +void fragment_main() { + textureSample_4dd1bf(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'samplerCubeArray' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureSample/4dd1bf.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSample/4dd1bf.wgsl.expected.hlsl new file mode 100644 index 0000000000..c779be1509 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/4dd1bf.wgsl.expected.hlsl @@ -0,0 +1,13 @@ +TextureCubeArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_4dd1bf() { + float3 arg_2 = (0.0f).xxx; + int arg_3 = 1; + float4 res = arg_0.Sample(arg_1, float4(arg_2, float(arg_3))); +} + +void fragment_main() { + textureSample_4dd1bf(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSample/4dd1bf.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSample/4dd1bf.wgsl.expected.msl new file mode 100644 index 0000000000..89cfd572c0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/4dd1bf.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +void textureSample_4dd1bf(texturecube_array tint_symbol, sampler tint_symbol_1) { + float3 arg_2 = float3(0.0f); + int arg_3 = 1; + float4 res = tint_symbol.sample(tint_symbol_1, arg_2, arg_3); +} + +fragment void fragment_main(texturecube_array tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSample_4dd1bf(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSample/4dd1bf.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSample/4dd1bf.wgsl.expected.spvasm new file mode 100644 index 0000000000..131c440b7a --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/4dd1bf.wgsl.expected.spvasm @@ -0,0 +1,67 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSample_4dd1bf "textureSample_4dd1bf" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %13 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %20 = OpConstantNull %int + %v4float = OpTypeVector %float 4 + %25 = OpTypeSampledImage %3 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %36 = OpConstantNull %v4float +%textureSample_4dd1bf = OpFunction %void None %8 + %11 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v3float Function %13 + %arg_3 = OpVariable %_ptr_Function_int Function %20 + %res = OpVariable %_ptr_Function_v4float Function %36 + OpStore %arg_2 %13 + OpStore %arg_3 %int_1 + %23 = OpLoad %7 %arg_1 + %24 = OpLoad %3 %arg_0 + %26 = OpSampledImage %25 %24 %23 + %27 = OpLoad %v3float %arg_2 + %28 = OpCompositeExtract %float %27 0 + %29 = OpCompositeExtract %float %27 1 + %30 = OpCompositeExtract %float %27 2 + %32 = OpLoad %int %arg_3 + %31 = OpConvertSToF %float %32 + %33 = OpCompositeConstruct %v4float %28 %29 %30 %31 + %21 = OpImageSampleImplicitLod %v4float %26 %33 + OpStore %res %21 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %38 = OpLabel + %39 = OpFunctionCall %void %textureSample_4dd1bf + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSample/4dd1bf.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSample/4dd1bf.wgsl.expected.wgsl new file mode 100644 index 0000000000..8c622de88a --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/4dd1bf.wgsl.expected.wgsl @@ -0,0 +1,14 @@ +@group(1) @binding(0) var arg_0 : texture_cube_array; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSample_4dd1bf() { + var arg_2 = vec3(); + var arg_3 = 1; + var res : vec4 = textureSample(arg_0, arg_1, arg_2, arg_3); +} + +@stage(fragment) +fn fragment_main() { + textureSample_4dd1bf(); +} diff --git a/test/tint/builtins/gen/var/textureSample/51b514.wgsl b/test/tint/builtins/gen/var/textureSample/51b514.wgsl new file mode 100644 index 0000000000..323375eea4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/51b514.wgsl @@ -0,0 +1,37 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSample(texture: texture_2d, sampler: sampler, coords: vec2) -> vec4 +fn textureSample_51b514() { + var arg_2 = vec2(); + var res: vec4 = textureSample(arg_0, arg_1, arg_2); +} + +@stage(fragment) +fn fragment_main() { + textureSample_51b514(); +} diff --git a/test/tint/builtins/gen/var/textureSample/51b514.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSample/51b514.wgsl.expected.glsl new file mode 100644 index 0000000000..ab891bc901 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/51b514.wgsl.expected.glsl @@ -0,0 +1,18 @@ +#version 310 es +precision mediump float; + +uniform highp sampler2D arg_0_arg_1; + +void textureSample_51b514() { + vec2 arg_2 = vec2(0.0f); + vec4 res = texture(arg_0_arg_1, arg_2); +} + +void fragment_main() { + textureSample_51b514(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSample/51b514.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSample/51b514.wgsl.expected.hlsl new file mode 100644 index 0000000000..32dce227fd --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/51b514.wgsl.expected.hlsl @@ -0,0 +1,12 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_51b514() { + float2 arg_2 = (0.0f).xx; + float4 res = arg_0.Sample(arg_1, arg_2); +} + +void fragment_main() { + textureSample_51b514(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSample/51b514.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSample/51b514.wgsl.expected.msl new file mode 100644 index 0000000000..bffded98a9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/51b514.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void textureSample_51b514(texture2d tint_symbol, sampler tint_symbol_1) { + float2 arg_2 = float2(0.0f); + float4 res = tint_symbol.sample(tint_symbol_1, arg_2); +} + +fragment void fragment_main(texture2d tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSample_51b514(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSample/51b514.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSample/51b514.wgsl.expected.spvasm new file mode 100644 index 0000000000..fe14ef4fd0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/51b514.wgsl.expected.spvasm @@ -0,0 +1,53 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 29 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSample_51b514 "textureSample_51b514" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %13 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %v4float = OpTypeVector %float 4 + %20 = OpTypeSampledImage %3 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %25 = OpConstantNull %v4float +%textureSample_51b514 = OpFunction %void None %8 + %11 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %13 + %res = OpVariable %_ptr_Function_v4float Function %25 + OpStore %arg_2 %13 + %18 = OpLoad %7 %arg_1 + %19 = OpLoad %3 %arg_0 + %21 = OpSampledImage %20 %19 %18 + %22 = OpLoad %v2float %arg_2 + %16 = OpImageSampleImplicitLod %v4float %21 %22 + OpStore %res %16 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %27 = OpLabel + %28 = OpFunctionCall %void %textureSample_51b514 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSample/51b514.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSample/51b514.wgsl.expected.wgsl new file mode 100644 index 0000000000..282e6eb5f7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/51b514.wgsl.expected.wgsl @@ -0,0 +1,13 @@ +@group(1) @binding(0) var arg_0 : texture_2d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSample_51b514() { + var arg_2 = vec2(); + var res : vec4 = textureSample(arg_0, arg_1, arg_2); +} + +@stage(fragment) +fn fragment_main() { + textureSample_51b514(); +} diff --git a/test/tint/builtins/gen/var/textureSample/60bf45.wgsl b/test/tint/builtins/gen/var/textureSample/60bf45.wgsl new file mode 100644 index 0000000000..93a8e2d087 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/60bf45.wgsl @@ -0,0 +1,38 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d_array; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSample(texture: texture_depth_2d_array, sampler: sampler, coords: vec2, array_index: i32, @const offset: vec2) -> f32 +fn textureSample_60bf45() { + var arg_2 = vec2(); + var arg_3 = 1; + var res: f32 = textureSample(arg_0, arg_1, arg_2, arg_3, vec2()); +} + +@stage(fragment) +fn fragment_main() { + textureSample_60bf45(); +} diff --git a/test/tint/builtins/gen/var/textureSample/60bf45.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSample/60bf45.wgsl.expected.glsl new file mode 100644 index 0000000000..bd4eaf2087 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/60bf45.wgsl.expected.glsl @@ -0,0 +1,28 @@ +SKIP: FAILED + +#version 310 es +precision mediump float; + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureSample_60bf45() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + float res = textureOffset(arg_0_arg_1, vec4(vec3(arg_2, float(arg_3)), 0.0f), ivec2(0)); +} + +void fragment_main() { + textureSample_60bf45(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:9: 'sampler' : TextureOffset does not support sampler2DArrayShadow : ES Profile +ERROR: 0:9: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureSample/60bf45.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSample/60bf45.wgsl.expected.hlsl new file mode 100644 index 0000000000..6a9339e032 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/60bf45.wgsl.expected.hlsl @@ -0,0 +1,13 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_60bf45() { + float2 arg_2 = (0.0f).xx; + int arg_3 = 1; + float res = arg_0.Sample(arg_1, float3(arg_2, float(arg_3)), (0).xx).x; +} + +void fragment_main() { + textureSample_60bf45(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSample/60bf45.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSample/60bf45.wgsl.expected.msl new file mode 100644 index 0000000000..b822a47af9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/60bf45.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +void textureSample_60bf45(depth2d_array tint_symbol, sampler tint_symbol_1) { + float2 arg_2 = float2(0.0f); + int arg_3 = 1; + float res = tint_symbol.sample(tint_symbol_1, arg_2, arg_3, int2(0)); +} + +fragment void fragment_main(depth2d_array tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSample_60bf45(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSample/60bf45.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSample/60bf45.wgsl.expected.spvasm new file mode 100644 index 0000000000..efd63d2aec --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/60bf45.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSample_60bf45 "textureSample_60bf45" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %13 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %20 = OpConstantNull %int + %v4float = OpTypeVector %float 4 + %26 = OpTypeSampledImage %3 + %v3float = OpTypeVector %float 3 + %v2int = OpTypeVector %int 2 + %36 = OpConstantNull %v2int +%_ptr_Function_float = OpTypePointer Function %float + %39 = OpConstantNull %float +%textureSample_60bf45 = OpFunction %void None %8 + %11 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %13 + %arg_3 = OpVariable %_ptr_Function_int Function %20 + %res = OpVariable %_ptr_Function_float Function %39 + OpStore %arg_2 %13 + OpStore %arg_3 %int_1 + %24 = OpLoad %7 %arg_1 + %25 = OpLoad %3 %arg_0 + %27 = OpSampledImage %26 %25 %24 + %29 = OpLoad %v2float %arg_2 + %30 = OpCompositeExtract %float %29 0 + %31 = OpCompositeExtract %float %29 1 + %33 = OpLoad %int %arg_3 + %32 = OpConvertSToF %float %33 + %34 = OpCompositeConstruct %v3float %30 %31 %32 + %22 = OpImageSampleImplicitLod %v4float %27 %34 ConstOffset %36 + %21 = OpCompositeExtract %float %22 0 + OpStore %res %21 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %41 = OpLabel + %42 = OpFunctionCall %void %textureSample_60bf45 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSample/60bf45.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSample/60bf45.wgsl.expected.wgsl new file mode 100644 index 0000000000..dd2484a22f --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/60bf45.wgsl.expected.wgsl @@ -0,0 +1,14 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d_array; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSample_60bf45() { + var arg_2 = vec2(); + var arg_3 = 1; + var res : f32 = textureSample(arg_0, arg_1, arg_2, arg_3, vec2()); +} + +@stage(fragment) +fn fragment_main() { + textureSample_60bf45(); +} diff --git a/test/tint/builtins/gen/var/textureSample/6717ca.wgsl b/test/tint/builtins/gen/var/textureSample/6717ca.wgsl new file mode 100644 index 0000000000..26bab9497b --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/6717ca.wgsl @@ -0,0 +1,38 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSample(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32) -> vec4 +fn textureSample_6717ca() { + var arg_2 = vec2(); + var arg_3 = 1; + var res: vec4 = textureSample(arg_0, arg_1, arg_2, arg_3); +} + +@stage(fragment) +fn fragment_main() { + textureSample_6717ca(); +} diff --git a/test/tint/builtins/gen/var/textureSample/6717ca.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSample/6717ca.wgsl.expected.glsl new file mode 100644 index 0000000000..d8cdc14fcb --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/6717ca.wgsl.expected.glsl @@ -0,0 +1,19 @@ +#version 310 es +precision mediump float; + +uniform highp sampler2DArray arg_0_arg_1; + +void textureSample_6717ca() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + vec4 res = texture(arg_0_arg_1, vec3(arg_2, float(arg_3))); +} + +void fragment_main() { + textureSample_6717ca(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSample/6717ca.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSample/6717ca.wgsl.expected.hlsl new file mode 100644 index 0000000000..01c97bce1e --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/6717ca.wgsl.expected.hlsl @@ -0,0 +1,13 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_6717ca() { + float2 arg_2 = (0.0f).xx; + int arg_3 = 1; + float4 res = arg_0.Sample(arg_1, float3(arg_2, float(arg_3))); +} + +void fragment_main() { + textureSample_6717ca(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSample/6717ca.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSample/6717ca.wgsl.expected.msl new file mode 100644 index 0000000000..e512ecabd3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/6717ca.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +void textureSample_6717ca(texture2d_array tint_symbol, sampler tint_symbol_1) { + float2 arg_2 = float2(0.0f); + int arg_3 = 1; + float4 res = tint_symbol.sample(tint_symbol_1, arg_2, arg_3); +} + +fragment void fragment_main(texture2d_array tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSample_6717ca(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSample/6717ca.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSample/6717ca.wgsl.expected.spvasm new file mode 100644 index 0000000000..8fd8ccf870 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/6717ca.wgsl.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSample_6717ca "textureSample_6717ca" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %13 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %20 = OpConstantNull %int + %v4float = OpTypeVector %float 4 + %25 = OpTypeSampledImage %3 + %v3float = OpTypeVector %float 3 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %36 = OpConstantNull %v4float +%textureSample_6717ca = OpFunction %void None %8 + %11 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %13 + %arg_3 = OpVariable %_ptr_Function_int Function %20 + %res = OpVariable %_ptr_Function_v4float Function %36 + OpStore %arg_2 %13 + OpStore %arg_3 %int_1 + %23 = OpLoad %7 %arg_1 + %24 = OpLoad %3 %arg_0 + %26 = OpSampledImage %25 %24 %23 + %28 = OpLoad %v2float %arg_2 + %29 = OpCompositeExtract %float %28 0 + %30 = OpCompositeExtract %float %28 1 + %32 = OpLoad %int %arg_3 + %31 = OpConvertSToF %float %32 + %33 = OpCompositeConstruct %v3float %29 %30 %31 + %21 = OpImageSampleImplicitLod %v4float %26 %33 + OpStore %res %21 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %38 = OpLabel + %39 = OpFunctionCall %void %textureSample_6717ca + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSample/6717ca.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSample/6717ca.wgsl.expected.wgsl new file mode 100644 index 0000000000..0e18da9a3a --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/6717ca.wgsl.expected.wgsl @@ -0,0 +1,14 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSample_6717ca() { + var arg_2 = vec2(); + var arg_3 = 1; + var res : vec4 = textureSample(arg_0, arg_1, arg_2, arg_3); +} + +@stage(fragment) +fn fragment_main() { + textureSample_6717ca(); +} diff --git a/test/tint/builtins/gen/var/textureSample/6e64fb.wgsl b/test/tint/builtins/gen/var/textureSample/6e64fb.wgsl new file mode 100644 index 0000000000..8218caa7d5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/6e64fb.wgsl @@ -0,0 +1,37 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_1d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSample(texture: texture_1d, sampler: sampler, coords: f32) -> vec4 +fn textureSample_6e64fb() { + var arg_2 = 1.0; + var res: vec4 = textureSample(arg_0, arg_1, arg_2); +} + +@stage(fragment) +fn fragment_main() { + textureSample_6e64fb(); +} diff --git a/test/tint/builtins/gen/var/textureSample/6e64fb.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSample/6e64fb.wgsl.expected.glsl new file mode 100644 index 0000000000..15771c5c9a --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/6e64fb.wgsl.expected.glsl @@ -0,0 +1,27 @@ +SKIP: FAILED + +#version 310 es +precision mediump float; + +uniform highp sampler1D arg_0_arg_1; + +void textureSample_6e64fb() { + float arg_2 = 1.0f; + vec4 res = texture(arg_0_arg_1, arg_2); +} + +void fragment_main() { + textureSample_6e64fb(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'sampler1D' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureSample/6e64fb.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSample/6e64fb.wgsl.expected.hlsl new file mode 100644 index 0000000000..e62e87512f --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/6e64fb.wgsl.expected.hlsl @@ -0,0 +1,12 @@ +Texture1D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_6e64fb() { + float arg_2 = 1.0f; + float4 res = arg_0.Sample(arg_1, arg_2); +} + +void fragment_main() { + textureSample_6e64fb(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSample/6e64fb.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSample/6e64fb.wgsl.expected.msl new file mode 100644 index 0000000000..3a9b0a5412 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/6e64fb.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void textureSample_6e64fb(texture1d tint_symbol, sampler tint_symbol_1) { + float arg_2 = 1.0f; + float4 res = tint_symbol.sample(tint_symbol_1, arg_2); +} + +fragment void fragment_main(texture1d tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSample_6e64fb(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSample/6e64fb.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSample/6e64fb.wgsl.expected.spvasm new file mode 100644 index 0000000000..be90026493 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/6e64fb.wgsl.expected.spvasm @@ -0,0 +1,54 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 29 +; Schema: 0 + OpCapability Shader + OpCapability Sampled1D + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSample_6e64fb "textureSample_6e64fb" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 1D 0 0 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %15 = OpConstantNull %float + %v4float = OpTypeVector %float 4 + %20 = OpTypeSampledImage %3 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %25 = OpConstantNull %v4float +%textureSample_6e64fb = OpFunction %void None %8 + %11 = OpLabel + %arg_2 = OpVariable %_ptr_Function_float Function %15 + %res = OpVariable %_ptr_Function_v4float Function %25 + OpStore %arg_2 %float_1 + %18 = OpLoad %7 %arg_1 + %19 = OpLoad %3 %arg_0 + %21 = OpSampledImage %20 %19 %18 + %22 = OpLoad %float %arg_2 + %16 = OpImageSampleImplicitLod %v4float %21 %22 + OpStore %res %16 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %27 = OpLabel + %28 = OpFunctionCall %void %textureSample_6e64fb + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSample/6e64fb.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSample/6e64fb.wgsl.expected.wgsl new file mode 100644 index 0000000000..77e51efabd --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/6e64fb.wgsl.expected.wgsl @@ -0,0 +1,13 @@ +@group(1) @binding(0) var arg_0 : texture_1d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSample_6e64fb() { + var arg_2 = 1.0; + var res : vec4 = textureSample(arg_0, arg_1, arg_2); +} + +@stage(fragment) +fn fragment_main() { + textureSample_6e64fb(); +} diff --git a/test/tint/builtins/gen/var/textureSample/7e9ffd.wgsl b/test/tint/builtins/gen/var/textureSample/7e9ffd.wgsl new file mode 100644 index 0000000000..b08991aaca --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/7e9ffd.wgsl @@ -0,0 +1,38 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d_array; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSample(texture: texture_depth_2d_array, sampler: sampler, coords: vec2, array_index: i32) -> f32 +fn textureSample_7e9ffd() { + var arg_2 = vec2(); + var arg_3 = 1; + var res: f32 = textureSample(arg_0, arg_1, arg_2, arg_3); +} + +@stage(fragment) +fn fragment_main() { + textureSample_7e9ffd(); +} diff --git a/test/tint/builtins/gen/var/textureSample/7e9ffd.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSample/7e9ffd.wgsl.expected.glsl new file mode 100644 index 0000000000..1f79b36b87 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/7e9ffd.wgsl.expected.glsl @@ -0,0 +1,19 @@ +#version 310 es +precision mediump float; + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureSample_7e9ffd() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + float res = texture(arg_0_arg_1, vec4(vec3(arg_2, float(arg_3)), 0.0f)); +} + +void fragment_main() { + textureSample_7e9ffd(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSample/7e9ffd.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSample/7e9ffd.wgsl.expected.hlsl new file mode 100644 index 0000000000..88b7a82131 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/7e9ffd.wgsl.expected.hlsl @@ -0,0 +1,13 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_7e9ffd() { + float2 arg_2 = (0.0f).xx; + int arg_3 = 1; + float res = arg_0.Sample(arg_1, float3(arg_2, float(arg_3))).x; +} + +void fragment_main() { + textureSample_7e9ffd(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSample/7e9ffd.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSample/7e9ffd.wgsl.expected.msl new file mode 100644 index 0000000000..9a296765b6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/7e9ffd.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +void textureSample_7e9ffd(depth2d_array tint_symbol, sampler tint_symbol_1) { + float2 arg_2 = float2(0.0f); + int arg_3 = 1; + float res = tint_symbol.sample(tint_symbol_1, arg_2, arg_3); +} + +fragment void fragment_main(depth2d_array tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSample_7e9ffd(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSample/7e9ffd.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSample/7e9ffd.wgsl.expected.spvasm new file mode 100644 index 0000000000..76ef866554 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/7e9ffd.wgsl.expected.spvasm @@ -0,0 +1,67 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSample_7e9ffd "textureSample_7e9ffd" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %13 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %20 = OpConstantNull %int + %v4float = OpTypeVector %float 4 + %26 = OpTypeSampledImage %3 + %v3float = OpTypeVector %float 3 +%_ptr_Function_float = OpTypePointer Function %float + %37 = OpConstantNull %float +%textureSample_7e9ffd = OpFunction %void None %8 + %11 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %13 + %arg_3 = OpVariable %_ptr_Function_int Function %20 + %res = OpVariable %_ptr_Function_float Function %37 + OpStore %arg_2 %13 + OpStore %arg_3 %int_1 + %24 = OpLoad %7 %arg_1 + %25 = OpLoad %3 %arg_0 + %27 = OpSampledImage %26 %25 %24 + %29 = OpLoad %v2float %arg_2 + %30 = OpCompositeExtract %float %29 0 + %31 = OpCompositeExtract %float %29 1 + %33 = OpLoad %int %arg_3 + %32 = OpConvertSToF %float %33 + %34 = OpCompositeConstruct %v3float %30 %31 %32 + %22 = OpImageSampleImplicitLod %v4float %27 %34 + %21 = OpCompositeExtract %float %22 0 + OpStore %res %21 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %39 = OpLabel + %40 = OpFunctionCall %void %textureSample_7e9ffd + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSample/7e9ffd.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSample/7e9ffd.wgsl.expected.wgsl new file mode 100644 index 0000000000..a2a7b82736 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/7e9ffd.wgsl.expected.wgsl @@ -0,0 +1,14 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d_array; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSample_7e9ffd() { + var arg_2 = vec2(); + var arg_3 = 1; + var res : f32 = textureSample(arg_0, arg_1, arg_2, arg_3); +} + +@stage(fragment) +fn fragment_main() { + textureSample_7e9ffd(); +} diff --git a/test/tint/builtins/gen/var/textureSample/85c4ba.wgsl b/test/tint/builtins/gen/var/textureSample/85c4ba.wgsl new file mode 100644 index 0000000000..c32bd337ed --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/85c4ba.wgsl @@ -0,0 +1,37 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSample(texture: texture_2d, sampler: sampler, coords: vec2, @const offset: vec2) -> vec4 +fn textureSample_85c4ba() { + var arg_2 = vec2(); + var res: vec4 = textureSample(arg_0, arg_1, arg_2, vec2()); +} + +@stage(fragment) +fn fragment_main() { + textureSample_85c4ba(); +} diff --git a/test/tint/builtins/gen/var/textureSample/85c4ba.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSample/85c4ba.wgsl.expected.glsl new file mode 100644 index 0000000000..7ec1594d48 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/85c4ba.wgsl.expected.glsl @@ -0,0 +1,18 @@ +#version 310 es +precision mediump float; + +uniform highp sampler2D arg_0_arg_1; + +void textureSample_85c4ba() { + vec2 arg_2 = vec2(0.0f); + vec4 res = textureOffset(arg_0_arg_1, arg_2, ivec2(0)); +} + +void fragment_main() { + textureSample_85c4ba(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSample/85c4ba.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSample/85c4ba.wgsl.expected.hlsl new file mode 100644 index 0000000000..d96272b6b2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/85c4ba.wgsl.expected.hlsl @@ -0,0 +1,12 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_85c4ba() { + float2 arg_2 = (0.0f).xx; + float4 res = arg_0.Sample(arg_1, arg_2, (0).xx); +} + +void fragment_main() { + textureSample_85c4ba(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSample/85c4ba.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSample/85c4ba.wgsl.expected.msl new file mode 100644 index 0000000000..16f9ef677f --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/85c4ba.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void textureSample_85c4ba(texture2d tint_symbol, sampler tint_symbol_1) { + float2 arg_2 = float2(0.0f); + float4 res = tint_symbol.sample(tint_symbol_1, arg_2, int2(0)); +} + +fragment void fragment_main(texture2d tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSample_85c4ba(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSample/85c4ba.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSample/85c4ba.wgsl.expected.spvasm new file mode 100644 index 0000000000..96546ebf61 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/85c4ba.wgsl.expected.spvasm @@ -0,0 +1,56 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSample_85c4ba "textureSample_85c4ba" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %13 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %v4float = OpTypeVector %float 4 + %20 = OpTypeSampledImage %3 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %25 = OpConstantNull %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %28 = OpConstantNull %v4float +%textureSample_85c4ba = OpFunction %void None %8 + %11 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %13 + %res = OpVariable %_ptr_Function_v4float Function %28 + OpStore %arg_2 %13 + %18 = OpLoad %7 %arg_1 + %19 = OpLoad %3 %arg_0 + %21 = OpSampledImage %20 %19 %18 + %22 = OpLoad %v2float %arg_2 + %16 = OpImageSampleImplicitLod %v4float %21 %22 ConstOffset %25 + OpStore %res %16 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %30 = OpLabel + %31 = OpFunctionCall %void %textureSample_85c4ba + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSample/85c4ba.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSample/85c4ba.wgsl.expected.wgsl new file mode 100644 index 0000000000..7d0cdcd20f --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/85c4ba.wgsl.expected.wgsl @@ -0,0 +1,13 @@ +@group(1) @binding(0) var arg_0 : texture_2d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSample_85c4ba() { + var arg_2 = vec2(); + var res : vec4 = textureSample(arg_0, arg_1, arg_2, vec2()); +} + +@stage(fragment) +fn fragment_main() { + textureSample_85c4ba(); +} diff --git a/test/tint/builtins/gen/var/textureSample/c2f4e8.wgsl b/test/tint/builtins/gen/var/textureSample/c2f4e8.wgsl new file mode 100644 index 0000000000..57133e0a3f --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/c2f4e8.wgsl @@ -0,0 +1,38 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_cube_array; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSample(texture: texture_depth_cube_array, sampler: sampler, coords: vec3, array_index: i32) -> f32 +fn textureSample_c2f4e8() { + var arg_2 = vec3(); + var arg_3 = 1; + var res: f32 = textureSample(arg_0, arg_1, arg_2, arg_3); +} + +@stage(fragment) +fn fragment_main() { + textureSample_c2f4e8(); +} diff --git a/test/tint/builtins/gen/var/textureSample/c2f4e8.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSample/c2f4e8.wgsl.expected.glsl new file mode 100644 index 0000000000..31ee71fd05 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/c2f4e8.wgsl.expected.glsl @@ -0,0 +1,28 @@ +SKIP: FAILED + +#version 310 es +precision mediump float; + +uniform highp samplerCubeArrayShadow arg_0_arg_1; + +void textureSample_c2f4e8() { + vec3 arg_2 = vec3(0.0f); + int arg_3 = 1; + float res = texture(arg_0_arg_1, vec4(arg_2, float(arg_3)), 0.0f); +} + +void fragment_main() { + textureSample_c2f4e8(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'samplerCubeArrayShadow' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureSample/c2f4e8.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSample/c2f4e8.wgsl.expected.hlsl new file mode 100644 index 0000000000..209b7d33cf --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/c2f4e8.wgsl.expected.hlsl @@ -0,0 +1,13 @@ +TextureCubeArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_c2f4e8() { + float3 arg_2 = (0.0f).xxx; + int arg_3 = 1; + float res = arg_0.Sample(arg_1, float4(arg_2, float(arg_3))).x; +} + +void fragment_main() { + textureSample_c2f4e8(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSample/c2f4e8.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSample/c2f4e8.wgsl.expected.msl new file mode 100644 index 0000000000..0a8ee57c20 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/c2f4e8.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +void textureSample_c2f4e8(depthcube_array tint_symbol, sampler tint_symbol_1) { + float3 arg_2 = float3(0.0f); + int arg_3 = 1; + float res = tint_symbol.sample(tint_symbol_1, arg_2, arg_3); +} + +fragment void fragment_main(depthcube_array tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSample_c2f4e8(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSample/c2f4e8.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSample/c2f4e8.wgsl.expected.spvasm new file mode 100644 index 0000000000..357c5ffeed --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/c2f4e8.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSample_c2f4e8 "textureSample_c2f4e8" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %13 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %20 = OpConstantNull %int + %v4float = OpTypeVector %float 4 + %26 = OpTypeSampledImage %3 +%_ptr_Function_float = OpTypePointer Function %float + %37 = OpConstantNull %float +%textureSample_c2f4e8 = OpFunction %void None %8 + %11 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v3float Function %13 + %arg_3 = OpVariable %_ptr_Function_int Function %20 + %res = OpVariable %_ptr_Function_float Function %37 + OpStore %arg_2 %13 + OpStore %arg_3 %int_1 + %24 = OpLoad %7 %arg_1 + %25 = OpLoad %3 %arg_0 + %27 = OpSampledImage %26 %25 %24 + %28 = OpLoad %v3float %arg_2 + %29 = OpCompositeExtract %float %28 0 + %30 = OpCompositeExtract %float %28 1 + %31 = OpCompositeExtract %float %28 2 + %33 = OpLoad %int %arg_3 + %32 = OpConvertSToF %float %33 + %34 = OpCompositeConstruct %v4float %29 %30 %31 %32 + %22 = OpImageSampleImplicitLod %v4float %27 %34 + %21 = OpCompositeExtract %float %22 0 + OpStore %res %21 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %39 = OpLabel + %40 = OpFunctionCall %void %textureSample_c2f4e8 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSample/c2f4e8.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSample/c2f4e8.wgsl.expected.wgsl new file mode 100644 index 0000000000..e80cfd071d --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/c2f4e8.wgsl.expected.wgsl @@ -0,0 +1,14 @@ +@group(1) @binding(0) var arg_0 : texture_depth_cube_array; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSample_c2f4e8() { + var arg_2 = vec3(); + var arg_3 = 1; + var res : f32 = textureSample(arg_0, arg_1, arg_2, arg_3); +} + +@stage(fragment) +fn fragment_main() { + textureSample_c2f4e8(); +} diff --git a/test/tint/builtins/gen/var/textureSample/e53267.wgsl b/test/tint/builtins/gen/var/textureSample/e53267.wgsl new file mode 100644 index 0000000000..2f1f3170b7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/e53267.wgsl @@ -0,0 +1,37 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSample(texture: texture_cube, sampler: sampler, coords: vec3) -> vec4 +fn textureSample_e53267() { + var arg_2 = vec3(); + var res: vec4 = textureSample(arg_0, arg_1, arg_2); +} + +@stage(fragment) +fn fragment_main() { + textureSample_e53267(); +} diff --git a/test/tint/builtins/gen/var/textureSample/e53267.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSample/e53267.wgsl.expected.glsl new file mode 100644 index 0000000000..7bfc11afec --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/e53267.wgsl.expected.glsl @@ -0,0 +1,18 @@ +#version 310 es +precision mediump float; + +uniform highp samplerCube arg_0_arg_1; + +void textureSample_e53267() { + vec3 arg_2 = vec3(0.0f); + vec4 res = texture(arg_0_arg_1, arg_2); +} + +void fragment_main() { + textureSample_e53267(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSample/e53267.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSample/e53267.wgsl.expected.hlsl new file mode 100644 index 0000000000..171df8aec5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/e53267.wgsl.expected.hlsl @@ -0,0 +1,12 @@ +TextureCube arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_e53267() { + float3 arg_2 = (0.0f).xxx; + float4 res = arg_0.Sample(arg_1, arg_2); +} + +void fragment_main() { + textureSample_e53267(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSample/e53267.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSample/e53267.wgsl.expected.msl new file mode 100644 index 0000000000..f6987dafa7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/e53267.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void textureSample_e53267(texturecube tint_symbol, sampler tint_symbol_1) { + float3 arg_2 = float3(0.0f); + float4 res = tint_symbol.sample(tint_symbol_1, arg_2); +} + +fragment void fragment_main(texturecube tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSample_e53267(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSample/e53267.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSample/e53267.wgsl.expected.spvasm new file mode 100644 index 0000000000..7a35d91fb1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/e53267.wgsl.expected.spvasm @@ -0,0 +1,53 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 29 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSample_e53267 "textureSample_e53267" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float Cube 0 0 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %13 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %v4float = OpTypeVector %float 4 + %20 = OpTypeSampledImage %3 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %25 = OpConstantNull %v4float +%textureSample_e53267 = OpFunction %void None %8 + %11 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v3float Function %13 + %res = OpVariable %_ptr_Function_v4float Function %25 + OpStore %arg_2 %13 + %18 = OpLoad %7 %arg_1 + %19 = OpLoad %3 %arg_0 + %21 = OpSampledImage %20 %19 %18 + %22 = OpLoad %v3float %arg_2 + %16 = OpImageSampleImplicitLod %v4float %21 %22 + OpStore %res %16 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %27 = OpLabel + %28 = OpFunctionCall %void %textureSample_e53267 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSample/e53267.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSample/e53267.wgsl.expected.wgsl new file mode 100644 index 0000000000..3b43395c1a --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/e53267.wgsl.expected.wgsl @@ -0,0 +1,13 @@ +@group(1) @binding(0) var arg_0 : texture_cube; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSample_e53267() { + var arg_2 = vec3(); + var res : vec4 = textureSample(arg_0, arg_1, arg_2); +} + +@stage(fragment) +fn fragment_main() { + textureSample_e53267(); +} diff --git a/test/tint/builtins/gen/var/textureSample/ea7030.wgsl b/test/tint/builtins/gen/var/textureSample/ea7030.wgsl new file mode 100644 index 0000000000..252c7d3dec --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/ea7030.wgsl @@ -0,0 +1,37 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_cube; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSample(texture: texture_depth_cube, sampler: sampler, coords: vec3) -> f32 +fn textureSample_ea7030() { + var arg_2 = vec3(); + var res: f32 = textureSample(arg_0, arg_1, arg_2); +} + +@stage(fragment) +fn fragment_main() { + textureSample_ea7030(); +} diff --git a/test/tint/builtins/gen/var/textureSample/ea7030.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSample/ea7030.wgsl.expected.glsl new file mode 100644 index 0000000000..5658098169 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/ea7030.wgsl.expected.glsl @@ -0,0 +1,18 @@ +#version 310 es +precision mediump float; + +uniform highp samplerCubeShadow arg_0_arg_1; + +void textureSample_ea7030() { + vec3 arg_2 = vec3(0.0f); + float res = texture(arg_0_arg_1, vec4(arg_2, 0.0f)); +} + +void fragment_main() { + textureSample_ea7030(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSample/ea7030.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSample/ea7030.wgsl.expected.hlsl new file mode 100644 index 0000000000..35bbed727f --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/ea7030.wgsl.expected.hlsl @@ -0,0 +1,12 @@ +TextureCube arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_ea7030() { + float3 arg_2 = (0.0f).xxx; + float res = arg_0.Sample(arg_1, arg_2).x; +} + +void fragment_main() { + textureSample_ea7030(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSample/ea7030.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSample/ea7030.wgsl.expected.msl new file mode 100644 index 0000000000..daefdff15f --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/ea7030.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void textureSample_ea7030(depthcube tint_symbol, sampler tint_symbol_1) { + float3 arg_2 = float3(0.0f); + float res = tint_symbol.sample(tint_symbol_1, arg_2); +} + +fragment void fragment_main(depthcube tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSample_ea7030(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSample/ea7030.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSample/ea7030.wgsl.expected.spvasm new file mode 100644 index 0000000000..b7bf9af197 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/ea7030.wgsl.expected.spvasm @@ -0,0 +1,54 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 30 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSample_ea7030 "textureSample_ea7030" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float Cube 0 0 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %13 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %v4float = OpTypeVector %float 4 + %21 = OpTypeSampledImage %3 +%_ptr_Function_float = OpTypePointer Function %float + %26 = OpConstantNull %float +%textureSample_ea7030 = OpFunction %void None %8 + %11 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v3float Function %13 + %res = OpVariable %_ptr_Function_float Function %26 + OpStore %arg_2 %13 + %19 = OpLoad %7 %arg_1 + %20 = OpLoad %3 %arg_0 + %22 = OpSampledImage %21 %20 %19 + %23 = OpLoad %v3float %arg_2 + %17 = OpImageSampleImplicitLod %v4float %22 %23 + %16 = OpCompositeExtract %float %17 0 + OpStore %res %16 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %28 = OpLabel + %29 = OpFunctionCall %void %textureSample_ea7030 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSample/ea7030.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSample/ea7030.wgsl.expected.wgsl new file mode 100644 index 0000000000..ad04cbf68f --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/ea7030.wgsl.expected.wgsl @@ -0,0 +1,13 @@ +@group(1) @binding(0) var arg_0 : texture_depth_cube; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSample_ea7030() { + var arg_2 = vec3(); + var res : f32 = textureSample(arg_0, arg_1, arg_2); +} + +@stage(fragment) +fn fragment_main() { + textureSample_ea7030(); +} diff --git a/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl b/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl new file mode 100644 index 0000000000..f8e76aa282 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl @@ -0,0 +1,38 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleBias(texture: texture_cube, sampler: sampler, coords: vec3, bias: f32) -> vec4 +fn textureSampleBias_53b9f7() { + var arg_2 = vec3(); + var arg_3 = 1.0; + var res: vec4 = textureSampleBias(arg_0, arg_1, arg_2, arg_3); +} + +@stage(fragment) +fn fragment_main() { + textureSampleBias_53b9f7(); +} diff --git a/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.glsl new file mode 100644 index 0000000000..26298693d3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.glsl @@ -0,0 +1,19 @@ +#version 310 es +precision mediump float; + +uniform highp samplerCube arg_0_arg_1; + +void textureSampleBias_53b9f7() { + vec3 arg_2 = vec3(0.0f); + float arg_3 = 1.0f; + vec4 res = texture(arg_0_arg_1, arg_2, arg_3); +} + +void fragment_main() { + textureSampleBias_53b9f7(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.hlsl new file mode 100644 index 0000000000..6fd71337d3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.hlsl @@ -0,0 +1,13 @@ +TextureCube arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleBias_53b9f7() { + float3 arg_2 = (0.0f).xxx; + float arg_3 = 1.0f; + float4 res = arg_0.SampleBias(arg_1, arg_2, arg_3); +} + +void fragment_main() { + textureSampleBias_53b9f7(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.msl new file mode 100644 index 0000000000..c9ed71a013 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +void textureSampleBias_53b9f7(texturecube tint_symbol, sampler tint_symbol_1) { + float3 arg_2 = float3(0.0f); + float arg_3 = 1.0f; + float4 res = tint_symbol.sample(tint_symbol_1, arg_2, bias(arg_3)); +} + +fragment void fragment_main(texturecube tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSampleBias_53b9f7(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.spvasm new file mode 100644 index 0000000000..58add6655c --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.spvasm @@ -0,0 +1,60 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleBias_53b9f7 "textureSampleBias_53b9f7" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float Cube 0 0 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %13 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %19 = OpConstantNull %float + %v4float = OpTypeVector %float 4 + %24 = OpTypeSampledImage %3 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %30 = OpConstantNull %v4float +%textureSampleBias_53b9f7 = OpFunction %void None %8 + %11 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v3float Function %13 + %arg_3 = OpVariable %_ptr_Function_float Function %19 + %res = OpVariable %_ptr_Function_v4float Function %30 + OpStore %arg_2 %13 + OpStore %arg_3 %float_1 + %22 = OpLoad %7 %arg_1 + %23 = OpLoad %3 %arg_0 + %25 = OpSampledImage %24 %23 %22 + %26 = OpLoad %v3float %arg_2 + %27 = OpLoad %float %arg_3 + %20 = OpImageSampleImplicitLod %v4float %25 %26 Bias %27 + OpStore %res %20 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %32 = OpLabel + %33 = OpFunctionCall %void %textureSampleBias_53b9f7 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.wgsl new file mode 100644 index 0000000000..f83ff9a54c --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.wgsl @@ -0,0 +1,14 @@ +@group(1) @binding(0) var arg_0 : texture_cube; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleBias_53b9f7() { + var arg_2 = vec3(); + var arg_3 = 1.0; + var res : vec4 = textureSampleBias(arg_0, arg_1, arg_2, arg_3); +} + +@stage(fragment) +fn fragment_main() { + textureSampleBias_53b9f7(); +} diff --git a/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl b/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl new file mode 100644 index 0000000000..01130c7afa --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl @@ -0,0 +1,38 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_3d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleBias(texture: texture_3d, sampler: sampler, coords: vec3, bias: f32, @const offset: vec3) -> vec4 +fn textureSampleBias_594824() { + var arg_2 = vec3(); + var arg_3 = 1.0; + var res: vec4 = textureSampleBias(arg_0, arg_1, arg_2, arg_3, vec3()); +} + +@stage(fragment) +fn fragment_main() { + textureSampleBias_594824(); +} diff --git a/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.glsl new file mode 100644 index 0000000000..86b3985586 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.glsl @@ -0,0 +1,19 @@ +#version 310 es +precision mediump float; + +uniform highp sampler3D arg_0_arg_1; + +void textureSampleBias_594824() { + vec3 arg_2 = vec3(0.0f); + float arg_3 = 1.0f; + vec4 res = textureOffset(arg_0_arg_1, arg_2, ivec3(0), arg_3); +} + +void fragment_main() { + textureSampleBias_594824(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.hlsl new file mode 100644 index 0000000000..fa703bc6ab --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.hlsl @@ -0,0 +1,13 @@ +Texture3D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleBias_594824() { + float3 arg_2 = (0.0f).xxx; + float arg_3 = 1.0f; + float4 res = arg_0.SampleBias(arg_1, arg_2, arg_3, (0).xxx); +} + +void fragment_main() { + textureSampleBias_594824(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.msl new file mode 100644 index 0000000000..b1579e031f --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +void textureSampleBias_594824(texture3d tint_symbol, sampler tint_symbol_1) { + float3 arg_2 = float3(0.0f); + float arg_3 = 1.0f; + float4 res = tint_symbol.sample(tint_symbol_1, arg_2, bias(arg_3), int3(0)); +} + +fragment void fragment_main(texture3d tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSampleBias_594824(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.spvasm new file mode 100644 index 0000000000..2360528652 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.spvasm @@ -0,0 +1,63 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleBias_594824 "textureSampleBias_594824" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 3D 0 0 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %13 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %19 = OpConstantNull %float + %v4float = OpTypeVector %float 4 + %24 = OpTypeSampledImage %3 + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %30 = OpConstantNull %v3int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %33 = OpConstantNull %v4float +%textureSampleBias_594824 = OpFunction %void None %8 + %11 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v3float Function %13 + %arg_3 = OpVariable %_ptr_Function_float Function %19 + %res = OpVariable %_ptr_Function_v4float Function %33 + OpStore %arg_2 %13 + OpStore %arg_3 %float_1 + %22 = OpLoad %7 %arg_1 + %23 = OpLoad %3 %arg_0 + %25 = OpSampledImage %24 %23 %22 + %26 = OpLoad %v3float %arg_2 + %27 = OpLoad %float %arg_3 + %20 = OpImageSampleImplicitLod %v4float %25 %26 Bias|ConstOffset %27 %30 + OpStore %res %20 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %35 = OpLabel + %36 = OpFunctionCall %void %textureSampleBias_594824 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.wgsl new file mode 100644 index 0000000000..3eecbf65d0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.wgsl @@ -0,0 +1,14 @@ +@group(1) @binding(0) var arg_0 : texture_3d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleBias_594824() { + var arg_2 = vec3(); + var arg_3 = 1.0; + var res : vec4 = textureSampleBias(arg_0, arg_1, arg_2, arg_3, vec3()); +} + +@stage(fragment) +fn fragment_main() { + textureSampleBias_594824(); +} diff --git a/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl b/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl new file mode 100644 index 0000000000..25548f9405 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl @@ -0,0 +1,38 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleBias(texture: texture_2d, sampler: sampler, coords: vec2, bias: f32) -> vec4 +fn textureSampleBias_6a9113() { + var arg_2 = vec2(); + var arg_3 = 1.0; + var res: vec4 = textureSampleBias(arg_0, arg_1, arg_2, arg_3); +} + +@stage(fragment) +fn fragment_main() { + textureSampleBias_6a9113(); +} diff --git a/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.glsl new file mode 100644 index 0000000000..4ff6ea8165 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.glsl @@ -0,0 +1,19 @@ +#version 310 es +precision mediump float; + +uniform highp sampler2D arg_0_arg_1; + +void textureSampleBias_6a9113() { + vec2 arg_2 = vec2(0.0f); + float arg_3 = 1.0f; + vec4 res = texture(arg_0_arg_1, arg_2, arg_3); +} + +void fragment_main() { + textureSampleBias_6a9113(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.hlsl new file mode 100644 index 0000000000..95c453b6eb --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.hlsl @@ -0,0 +1,13 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleBias_6a9113() { + float2 arg_2 = (0.0f).xx; + float arg_3 = 1.0f; + float4 res = arg_0.SampleBias(arg_1, arg_2, arg_3); +} + +void fragment_main() { + textureSampleBias_6a9113(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.msl new file mode 100644 index 0000000000..a60a0d69a6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +void textureSampleBias_6a9113(texture2d tint_symbol, sampler tint_symbol_1) { + float2 arg_2 = float2(0.0f); + float arg_3 = 1.0f; + float4 res = tint_symbol.sample(tint_symbol_1, arg_2, bias(arg_3)); +} + +fragment void fragment_main(texture2d tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSampleBias_6a9113(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.spvasm new file mode 100644 index 0000000000..75ae173e65 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.spvasm @@ -0,0 +1,60 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleBias_6a9113 "textureSampleBias_6a9113" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %13 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %19 = OpConstantNull %float + %v4float = OpTypeVector %float 4 + %24 = OpTypeSampledImage %3 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %30 = OpConstantNull %v4float +%textureSampleBias_6a9113 = OpFunction %void None %8 + %11 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %13 + %arg_3 = OpVariable %_ptr_Function_float Function %19 + %res = OpVariable %_ptr_Function_v4float Function %30 + OpStore %arg_2 %13 + OpStore %arg_3 %float_1 + %22 = OpLoad %7 %arg_1 + %23 = OpLoad %3 %arg_0 + %25 = OpSampledImage %24 %23 %22 + %26 = OpLoad %v2float %arg_2 + %27 = OpLoad %float %arg_3 + %20 = OpImageSampleImplicitLod %v4float %25 %26 Bias %27 + OpStore %res %20 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %32 = OpLabel + %33 = OpFunctionCall %void %textureSampleBias_6a9113 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.wgsl new file mode 100644 index 0000000000..690d164356 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.wgsl @@ -0,0 +1,14 @@ +@group(1) @binding(0) var arg_0 : texture_2d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleBias_6a9113() { + var arg_2 = vec2(); + var arg_3 = 1.0; + var res : vec4 = textureSampleBias(arg_0, arg_1, arg_2, arg_3); +} + +@stage(fragment) +fn fragment_main() { + textureSampleBias_6a9113(); +} diff --git a/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl b/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl new file mode 100644 index 0000000000..8e3b2d69b4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl @@ -0,0 +1,39 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleBias(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, bias: f32) -> vec4 +fn textureSampleBias_80e579() { + var arg_2 = vec2(); + var arg_3 = 1; + var arg_4 = 1.0; + var res: vec4 = textureSampleBias(arg_0, arg_1, arg_2, arg_3, arg_4); +} + +@stage(fragment) +fn fragment_main() { + textureSampleBias_80e579(); +} diff --git a/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.glsl new file mode 100644 index 0000000000..4b8b55e655 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.glsl @@ -0,0 +1,20 @@ +#version 310 es +precision mediump float; + +uniform highp sampler2DArray arg_0_arg_1; + +void textureSampleBias_80e579() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + vec4 res = texture(arg_0_arg_1, vec3(arg_2, float(arg_3)), arg_4); +} + +void fragment_main() { + textureSampleBias_80e579(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.hlsl new file mode 100644 index 0000000000..27ee32dc62 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.hlsl @@ -0,0 +1,14 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleBias_80e579() { + float2 arg_2 = (0.0f).xx; + int arg_3 = 1; + float arg_4 = 1.0f; + float4 res = arg_0.SampleBias(arg_1, float3(arg_2, float(arg_3)), arg_4); +} + +void fragment_main() { + textureSampleBias_80e579(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.msl new file mode 100644 index 0000000000..310f5493d5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.msl @@ -0,0 +1,15 @@ +#include + +using namespace metal; +void textureSampleBias_80e579(texture2d_array tint_symbol, sampler tint_symbol_1) { + float2 arg_2 = float2(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + float4 res = tint_symbol.sample(tint_symbol_1, arg_2, arg_3, bias(arg_4)); +} + +fragment void fragment_main(texture2d_array tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSampleBias_80e579(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.spvasm new file mode 100644 index 0000000000..2afe0dfba7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleBias_80e579 "textureSampleBias_80e579" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %arg_4 "arg_4" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %13 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %20 = OpConstantNull %int + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %24 = OpConstantNull %float + %v4float = OpTypeVector %float 4 + %29 = OpTypeSampledImage %3 + %v3float = OpTypeVector %float 3 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %41 = OpConstantNull %v4float +%textureSampleBias_80e579 = OpFunction %void None %8 + %11 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %13 + %arg_3 = OpVariable %_ptr_Function_int Function %20 + %arg_4 = OpVariable %_ptr_Function_float Function %24 + %res = OpVariable %_ptr_Function_v4float Function %41 + OpStore %arg_2 %13 + OpStore %arg_3 %int_1 + OpStore %arg_4 %float_1 + %27 = OpLoad %7 %arg_1 + %28 = OpLoad %3 %arg_0 + %30 = OpSampledImage %29 %28 %27 + %32 = OpLoad %v2float %arg_2 + %33 = OpCompositeExtract %float %32 0 + %34 = OpCompositeExtract %float %32 1 + %36 = OpLoad %int %arg_3 + %35 = OpConvertSToF %float %36 + %37 = OpCompositeConstruct %v3float %33 %34 %35 + %38 = OpLoad %float %arg_4 + %25 = OpImageSampleImplicitLod %v4float %30 %37 Bias %38 + OpStore %res %25 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %43 = OpLabel + %44 = OpFunctionCall %void %textureSampleBias_80e579 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.wgsl new file mode 100644 index 0000000000..237a498e19 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.wgsl @@ -0,0 +1,15 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleBias_80e579() { + var arg_2 = vec2(); + var arg_3 = 1; + var arg_4 = 1.0; + var res : vec4 = textureSampleBias(arg_0, arg_1, arg_2, arg_3, arg_4); +} + +@stage(fragment) +fn fragment_main() { + textureSampleBias_80e579(); +} diff --git a/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl b/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl new file mode 100644 index 0000000000..939e2396db --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl @@ -0,0 +1,39 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleBias(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, bias: f32, @const offset: vec2) -> vec4 +fn textureSampleBias_9dbb51() { + var arg_2 = vec2(); + var arg_3 = 1; + var arg_4 = 1.0; + var res: vec4 = textureSampleBias(arg_0, arg_1, arg_2, arg_3, arg_4, vec2()); +} + +@stage(fragment) +fn fragment_main() { + textureSampleBias_9dbb51(); +} diff --git a/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.glsl new file mode 100644 index 0000000000..fcb897f30c --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.glsl @@ -0,0 +1,20 @@ +#version 310 es +precision mediump float; + +uniform highp sampler2DArray arg_0_arg_1; + +void textureSampleBias_9dbb51() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + vec4 res = textureOffset(arg_0_arg_1, vec3(arg_2, float(arg_3)), ivec2(0), arg_4); +} + +void fragment_main() { + textureSampleBias_9dbb51(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.hlsl new file mode 100644 index 0000000000..83ce4b85a5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.hlsl @@ -0,0 +1,14 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleBias_9dbb51() { + float2 arg_2 = (0.0f).xx; + int arg_3 = 1; + float arg_4 = 1.0f; + float4 res = arg_0.SampleBias(arg_1, float3(arg_2, float(arg_3)), arg_4, (0).xx); +} + +void fragment_main() { + textureSampleBias_9dbb51(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.msl new file mode 100644 index 0000000000..811369d09f --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.msl @@ -0,0 +1,15 @@ +#include + +using namespace metal; +void textureSampleBias_9dbb51(texture2d_array tint_symbol, sampler tint_symbol_1) { + float2 arg_2 = float2(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + float4 res = tint_symbol.sample(tint_symbol_1, arg_2, arg_3, bias(arg_4), int2(0)); +} + +fragment void fragment_main(texture2d_array tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSampleBias_9dbb51(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.spvasm new file mode 100644 index 0000000000..bca222ed22 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleBias_9dbb51 "textureSampleBias_9dbb51" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %arg_4 "arg_4" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %13 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %20 = OpConstantNull %int + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %24 = OpConstantNull %float + %v4float = OpTypeVector %float 4 + %29 = OpTypeSampledImage %3 + %v3float = OpTypeVector %float 3 + %v2int = OpTypeVector %int 2 + %40 = OpConstantNull %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %43 = OpConstantNull %v4float +%textureSampleBias_9dbb51 = OpFunction %void None %8 + %11 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %13 + %arg_3 = OpVariable %_ptr_Function_int Function %20 + %arg_4 = OpVariable %_ptr_Function_float Function %24 + %res = OpVariable %_ptr_Function_v4float Function %43 + OpStore %arg_2 %13 + OpStore %arg_3 %int_1 + OpStore %arg_4 %float_1 + %27 = OpLoad %7 %arg_1 + %28 = OpLoad %3 %arg_0 + %30 = OpSampledImage %29 %28 %27 + %32 = OpLoad %v2float %arg_2 + %33 = OpCompositeExtract %float %32 0 + %34 = OpCompositeExtract %float %32 1 + %36 = OpLoad %int %arg_3 + %35 = OpConvertSToF %float %36 + %37 = OpCompositeConstruct %v3float %33 %34 %35 + %38 = OpLoad %float %arg_4 + %25 = OpImageSampleImplicitLod %v4float %30 %37 Bias|ConstOffset %38 %40 + OpStore %res %25 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %45 = OpLabel + %46 = OpFunctionCall %void %textureSampleBias_9dbb51 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.wgsl new file mode 100644 index 0000000000..1498066dab --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.wgsl @@ -0,0 +1,15 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleBias_9dbb51() { + var arg_2 = vec2(); + var arg_3 = 1; + var arg_4 = 1.0; + var res : vec4 = textureSampleBias(arg_0, arg_1, arg_2, arg_3, arg_4, vec2()); +} + +@stage(fragment) +fn fragment_main() { + textureSampleBias_9dbb51(); +} diff --git a/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl b/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl new file mode 100644 index 0000000000..e84735c240 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl @@ -0,0 +1,38 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleBias(texture: texture_2d, sampler: sampler, coords: vec2, bias: f32, @const offset: vec2) -> vec4 +fn textureSampleBias_a161cf() { + var arg_2 = vec2(); + var arg_3 = 1.0; + var res: vec4 = textureSampleBias(arg_0, arg_1, arg_2, arg_3, vec2()); +} + +@stage(fragment) +fn fragment_main() { + textureSampleBias_a161cf(); +} diff --git a/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.glsl new file mode 100644 index 0000000000..fc23dd4b28 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.glsl @@ -0,0 +1,19 @@ +#version 310 es +precision mediump float; + +uniform highp sampler2D arg_0_arg_1; + +void textureSampleBias_a161cf() { + vec2 arg_2 = vec2(0.0f); + float arg_3 = 1.0f; + vec4 res = textureOffset(arg_0_arg_1, arg_2, ivec2(0), arg_3); +} + +void fragment_main() { + textureSampleBias_a161cf(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.hlsl new file mode 100644 index 0000000000..89d28fcd69 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.hlsl @@ -0,0 +1,13 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleBias_a161cf() { + float2 arg_2 = (0.0f).xx; + float arg_3 = 1.0f; + float4 res = arg_0.SampleBias(arg_1, arg_2, arg_3, (0).xx); +} + +void fragment_main() { + textureSampleBias_a161cf(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.msl new file mode 100644 index 0000000000..26145c4757 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +void textureSampleBias_a161cf(texture2d tint_symbol, sampler tint_symbol_1) { + float2 arg_2 = float2(0.0f); + float arg_3 = 1.0f; + float4 res = tint_symbol.sample(tint_symbol_1, arg_2, bias(arg_3), int2(0)); +} + +fragment void fragment_main(texture2d tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSampleBias_a161cf(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.spvasm new file mode 100644 index 0000000000..b4513e6aed --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.spvasm @@ -0,0 +1,63 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleBias_a161cf "textureSampleBias_a161cf" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %13 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %19 = OpConstantNull %float + %v4float = OpTypeVector %float 4 + %24 = OpTypeSampledImage %3 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %30 = OpConstantNull %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %33 = OpConstantNull %v4float +%textureSampleBias_a161cf = OpFunction %void None %8 + %11 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %13 + %arg_3 = OpVariable %_ptr_Function_float Function %19 + %res = OpVariable %_ptr_Function_v4float Function %33 + OpStore %arg_2 %13 + OpStore %arg_3 %float_1 + %22 = OpLoad %7 %arg_1 + %23 = OpLoad %3 %arg_0 + %25 = OpSampledImage %24 %23 %22 + %26 = OpLoad %v2float %arg_2 + %27 = OpLoad %float %arg_3 + %20 = OpImageSampleImplicitLod %v4float %25 %26 Bias|ConstOffset %27 %30 + OpStore %res %20 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %35 = OpLabel + %36 = OpFunctionCall %void %textureSampleBias_a161cf + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.wgsl new file mode 100644 index 0000000000..8ff74b5eb6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.wgsl @@ -0,0 +1,14 @@ +@group(1) @binding(0) var arg_0 : texture_2d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleBias_a161cf() { + var arg_2 = vec2(); + var arg_3 = 1.0; + var res : vec4 = textureSampleBias(arg_0, arg_1, arg_2, arg_3, vec2()); +} + +@stage(fragment) +fn fragment_main() { + textureSampleBias_a161cf(); +} diff --git a/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl b/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl new file mode 100644 index 0000000000..3a77dab76b --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl @@ -0,0 +1,38 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_3d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleBias(texture: texture_3d, sampler: sampler, coords: vec3, bias: f32) -> vec4 +fn textureSampleBias_d3fa1b() { + var arg_2 = vec3(); + var arg_3 = 1.0; + var res: vec4 = textureSampleBias(arg_0, arg_1, arg_2, arg_3); +} + +@stage(fragment) +fn fragment_main() { + textureSampleBias_d3fa1b(); +} diff --git a/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.glsl new file mode 100644 index 0000000000..19f7ed419d --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.glsl @@ -0,0 +1,19 @@ +#version 310 es +precision mediump float; + +uniform highp sampler3D arg_0_arg_1; + +void textureSampleBias_d3fa1b() { + vec3 arg_2 = vec3(0.0f); + float arg_3 = 1.0f; + vec4 res = texture(arg_0_arg_1, arg_2, arg_3); +} + +void fragment_main() { + textureSampleBias_d3fa1b(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.hlsl new file mode 100644 index 0000000000..653f13e9c4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.hlsl @@ -0,0 +1,13 @@ +Texture3D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleBias_d3fa1b() { + float3 arg_2 = (0.0f).xxx; + float arg_3 = 1.0f; + float4 res = arg_0.SampleBias(arg_1, arg_2, arg_3); +} + +void fragment_main() { + textureSampleBias_d3fa1b(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.msl new file mode 100644 index 0000000000..d0ca622a21 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +void textureSampleBias_d3fa1b(texture3d tint_symbol, sampler tint_symbol_1) { + float3 arg_2 = float3(0.0f); + float arg_3 = 1.0f; + float4 res = tint_symbol.sample(tint_symbol_1, arg_2, bias(arg_3)); +} + +fragment void fragment_main(texture3d tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSampleBias_d3fa1b(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.spvasm new file mode 100644 index 0000000000..efaf6083b4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.spvasm @@ -0,0 +1,60 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleBias_d3fa1b "textureSampleBias_d3fa1b" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 3D 0 0 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %13 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %19 = OpConstantNull %float + %v4float = OpTypeVector %float 4 + %24 = OpTypeSampledImage %3 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %30 = OpConstantNull %v4float +%textureSampleBias_d3fa1b = OpFunction %void None %8 + %11 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v3float Function %13 + %arg_3 = OpVariable %_ptr_Function_float Function %19 + %res = OpVariable %_ptr_Function_v4float Function %30 + OpStore %arg_2 %13 + OpStore %arg_3 %float_1 + %22 = OpLoad %7 %arg_1 + %23 = OpLoad %3 %arg_0 + %25 = OpSampledImage %24 %23 %22 + %26 = OpLoad %v3float %arg_2 + %27 = OpLoad %float %arg_3 + %20 = OpImageSampleImplicitLod %v4float %25 %26 Bias %27 + OpStore %res %20 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %32 = OpLabel + %33 = OpFunctionCall %void %textureSampleBias_d3fa1b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.wgsl new file mode 100644 index 0000000000..7c8dd12735 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.wgsl @@ -0,0 +1,14 @@ +@group(1) @binding(0) var arg_0 : texture_3d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleBias_d3fa1b() { + var arg_2 = vec3(); + var arg_3 = 1.0; + var res : vec4 = textureSampleBias(arg_0, arg_1, arg_2, arg_3); +} + +@stage(fragment) +fn fragment_main() { + textureSampleBias_d3fa1b(); +} diff --git a/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl b/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl new file mode 100644 index 0000000000..6e22d238d5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl @@ -0,0 +1,39 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube_array; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleBias(texture: texture_cube_array, sampler: sampler, coords: vec3, array_index: i32, bias: f32) -> vec4 +fn textureSampleBias_eed7c4() { + var arg_2 = vec3(); + var arg_3 = 1; + var arg_4 = 1.0; + var res: vec4 = textureSampleBias(arg_0, arg_1, arg_2, arg_3, arg_4); +} + +@stage(fragment) +fn fragment_main() { + textureSampleBias_eed7c4(); +} diff --git a/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.glsl new file mode 100644 index 0000000000..e26885390c --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.glsl @@ -0,0 +1,29 @@ +SKIP: FAILED + +#version 310 es +precision mediump float; + +uniform highp samplerCubeArray arg_0_arg_1; + +void textureSampleBias_eed7c4() { + vec3 arg_2 = vec3(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + vec4 res = texture(arg_0_arg_1, vec4(arg_2, float(arg_3)), arg_4); +} + +void fragment_main() { + textureSampleBias_eed7c4(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'samplerCubeArray' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.hlsl new file mode 100644 index 0000000000..4c225b0104 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.hlsl @@ -0,0 +1,14 @@ +TextureCubeArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleBias_eed7c4() { + float3 arg_2 = (0.0f).xxx; + int arg_3 = 1; + float arg_4 = 1.0f; + float4 res = arg_0.SampleBias(arg_1, float4(arg_2, float(arg_3)), arg_4); +} + +void fragment_main() { + textureSampleBias_eed7c4(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.msl new file mode 100644 index 0000000000..5017e44af1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.msl @@ -0,0 +1,15 @@ +#include + +using namespace metal; +void textureSampleBias_eed7c4(texturecube_array tint_symbol, sampler tint_symbol_1) { + float3 arg_2 = float3(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + float4 res = tint_symbol.sample(tint_symbol_1, arg_2, arg_3, bias(arg_4)); +} + +fragment void fragment_main(texturecube_array tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSampleBias_eed7c4(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.spvasm new file mode 100644 index 0000000000..82c77fb665 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleBias_eed7c4 "textureSampleBias_eed7c4" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %arg_4 "arg_4" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %13 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %20 = OpConstantNull %int + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %24 = OpConstantNull %float + %v4float = OpTypeVector %float 4 + %29 = OpTypeSampledImage %3 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %41 = OpConstantNull %v4float +%textureSampleBias_eed7c4 = OpFunction %void None %8 + %11 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v3float Function %13 + %arg_3 = OpVariable %_ptr_Function_int Function %20 + %arg_4 = OpVariable %_ptr_Function_float Function %24 + %res = OpVariable %_ptr_Function_v4float Function %41 + OpStore %arg_2 %13 + OpStore %arg_3 %int_1 + OpStore %arg_4 %float_1 + %27 = OpLoad %7 %arg_1 + %28 = OpLoad %3 %arg_0 + %30 = OpSampledImage %29 %28 %27 + %31 = OpLoad %v3float %arg_2 + %32 = OpCompositeExtract %float %31 0 + %33 = OpCompositeExtract %float %31 1 + %34 = OpCompositeExtract %float %31 2 + %36 = OpLoad %int %arg_3 + %35 = OpConvertSToF %float %36 + %37 = OpCompositeConstruct %v4float %32 %33 %34 %35 + %38 = OpLoad %float %arg_4 + %25 = OpImageSampleImplicitLod %v4float %30 %37 Bias %38 + OpStore %res %25 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %43 = OpLabel + %44 = OpFunctionCall %void %textureSampleBias_eed7c4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.wgsl new file mode 100644 index 0000000000..df368935f3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.wgsl @@ -0,0 +1,15 @@ +@group(1) @binding(0) var arg_0 : texture_cube_array; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleBias_eed7c4() { + var arg_2 = vec3(); + var arg_3 = 1; + var arg_4 = 1.0; + var res : vec4 = textureSampleBias(arg_0, arg_1, arg_2, arg_3, arg_4); +} + +@stage(fragment) +fn fragment_main() { + textureSampleBias_eed7c4(); +} diff --git a/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl b/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl new file mode 100644 index 0000000000..f8b96de4a2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl @@ -0,0 +1,38 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d; +@group(1) @binding(1) var arg_1: sampler_comparison; + +// fn textureSampleCompare(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2, depth_ref: f32) -> f32 +fn textureSampleCompare_3a5923() { + var arg_2 = vec2(); + var arg_3 = 1.0; + var res: f32 = textureSampleCompare(arg_0, arg_1, arg_2, arg_3); +} + +@stage(fragment) +fn fragment_main() { + textureSampleCompare_3a5923(); +} diff --git a/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.glsl new file mode 100644 index 0000000000..3de47a5e46 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.glsl @@ -0,0 +1,19 @@ +#version 310 es +precision mediump float; + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureSampleCompare_3a5923() { + vec2 arg_2 = vec2(0.0f); + float arg_3 = 1.0f; + float res = texture(arg_0_arg_1, vec3(arg_2, arg_3)); +} + +void fragment_main() { + textureSampleCompare_3a5923(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.hlsl new file mode 100644 index 0000000000..3bc8810b56 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.hlsl @@ -0,0 +1,13 @@ +Texture2D arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureSampleCompare_3a5923() { + float2 arg_2 = (0.0f).xx; + float arg_3 = 1.0f; + float res = arg_0.SampleCmp(arg_1, arg_2, arg_3); +} + +void fragment_main() { + textureSampleCompare_3a5923(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.msl new file mode 100644 index 0000000000..a4ccb01b8f --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +void textureSampleCompare_3a5923(depth2d tint_symbol, sampler tint_symbol_1) { + float2 arg_2 = float2(0.0f); + float arg_3 = 1.0f; + float res = tint_symbol.sample_compare(tint_symbol_1, arg_2, arg_3); +} + +fragment void fragment_main(depth2d tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSampleCompare_3a5923(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.spvasm new file mode 100644 index 0000000000..b8f13d0c93 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.spvasm @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 31 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleCompare_3a5923 "textureSampleCompare_3a5923" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %13 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %19 = OpConstantNull %float + %23 = OpTypeSampledImage %3 +%textureSampleCompare_3a5923 = OpFunction %void None %8 + %11 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %13 + %arg_3 = OpVariable %_ptr_Function_float Function %19 + %res = OpVariable %_ptr_Function_float Function %19 + OpStore %arg_2 %13 + OpStore %arg_3 %float_1 + %21 = OpLoad %7 %arg_1 + %22 = OpLoad %3 %arg_0 + %24 = OpSampledImage %23 %22 %21 + %25 = OpLoad %v2float %arg_2 + %26 = OpLoad %float %arg_3 + %20 = OpImageSampleDrefImplicitLod %float %24 %25 %26 + OpStore %res %20 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %29 = OpLabel + %30 = OpFunctionCall %void %textureSampleCompare_3a5923 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.wgsl new file mode 100644 index 0000000000..f2d1921b9e --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.wgsl @@ -0,0 +1,14 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d; + +@group(1) @binding(1) var arg_1 : sampler_comparison; + +fn textureSampleCompare_3a5923() { + var arg_2 = vec2(); + var arg_3 = 1.0; + var res : f32 = textureSampleCompare(arg_0, arg_1, arg_2, arg_3); +} + +@stage(fragment) +fn fragment_main() { + textureSampleCompare_3a5923(); +} diff --git a/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl b/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl new file mode 100644 index 0000000000..04a8dde952 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl @@ -0,0 +1,38 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_cube; +@group(1) @binding(1) var arg_1: sampler_comparison; + +// fn textureSampleCompare(texture: texture_depth_cube, sampler: sampler_comparison, coords: vec3, depth_ref: f32) -> f32 +fn textureSampleCompare_63fb83() { + var arg_2 = vec3(); + var arg_3 = 1.0; + var res: f32 = textureSampleCompare(arg_0, arg_1, arg_2, arg_3); +} + +@stage(fragment) +fn fragment_main() { + textureSampleCompare_63fb83(); +} diff --git a/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.glsl new file mode 100644 index 0000000000..d83c925b15 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.glsl @@ -0,0 +1,19 @@ +#version 310 es +precision mediump float; + +uniform highp samplerCubeShadow arg_0_arg_1; + +void textureSampleCompare_63fb83() { + vec3 arg_2 = vec3(0.0f); + float arg_3 = 1.0f; + float res = texture(arg_0_arg_1, vec4(arg_2, arg_3)); +} + +void fragment_main() { + textureSampleCompare_63fb83(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.hlsl new file mode 100644 index 0000000000..01de180398 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.hlsl @@ -0,0 +1,13 @@ +TextureCube arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureSampleCompare_63fb83() { + float3 arg_2 = (0.0f).xxx; + float arg_3 = 1.0f; + float res = arg_0.SampleCmp(arg_1, arg_2, arg_3); +} + +void fragment_main() { + textureSampleCompare_63fb83(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.msl new file mode 100644 index 0000000000..826159e5bc --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +void textureSampleCompare_63fb83(depthcube tint_symbol, sampler tint_symbol_1) { + float3 arg_2 = float3(0.0f); + float arg_3 = 1.0f; + float res = tint_symbol.sample_compare(tint_symbol_1, arg_2, arg_3); +} + +fragment void fragment_main(depthcube tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSampleCompare_63fb83(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.spvasm new file mode 100644 index 0000000000..dde09fdc78 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.spvasm @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 31 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleCompare_63fb83 "textureSampleCompare_63fb83" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float Cube 0 0 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %13 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %19 = OpConstantNull %float + %23 = OpTypeSampledImage %3 +%textureSampleCompare_63fb83 = OpFunction %void None %8 + %11 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v3float Function %13 + %arg_3 = OpVariable %_ptr_Function_float Function %19 + %res = OpVariable %_ptr_Function_float Function %19 + OpStore %arg_2 %13 + OpStore %arg_3 %float_1 + %21 = OpLoad %7 %arg_1 + %22 = OpLoad %3 %arg_0 + %24 = OpSampledImage %23 %22 %21 + %25 = OpLoad %v3float %arg_2 + %26 = OpLoad %float %arg_3 + %20 = OpImageSampleDrefImplicitLod %float %24 %25 %26 + OpStore %res %20 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %29 = OpLabel + %30 = OpFunctionCall %void %textureSampleCompare_63fb83 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.wgsl new file mode 100644 index 0000000000..6763ef1196 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.wgsl @@ -0,0 +1,14 @@ +@group(1) @binding(0) var arg_0 : texture_depth_cube; + +@group(1) @binding(1) var arg_1 : sampler_comparison; + +fn textureSampleCompare_63fb83() { + var arg_2 = vec3(); + var arg_3 = 1.0; + var res : f32 = textureSampleCompare(arg_0, arg_1, arg_2, arg_3); +} + +@stage(fragment) +fn fragment_main() { + textureSampleCompare_63fb83(); +} diff --git a/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl b/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl new file mode 100644 index 0000000000..b3b5cf0d41 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl @@ -0,0 +1,39 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_cube_array; +@group(1) @binding(1) var arg_1: sampler_comparison; + +// fn textureSampleCompare(texture: texture_depth_cube_array, sampler: sampler_comparison, coords: vec3, array_index: i32, depth_ref: f32) -> f32 +fn textureSampleCompare_a3ca7e() { + var arg_2 = vec3(); + var arg_3 = 1; + var arg_4 = 1.0; + var res: f32 = textureSampleCompare(arg_0, arg_1, arg_2, arg_3, arg_4); +} + +@stage(fragment) +fn fragment_main() { + textureSampleCompare_a3ca7e(); +} diff --git a/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.glsl new file mode 100644 index 0000000000..f822276b23 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.glsl @@ -0,0 +1,29 @@ +SKIP: FAILED + +#version 310 es +precision mediump float; + +uniform highp samplerCubeArrayShadow arg_0_arg_1; + +void textureSampleCompare_a3ca7e() { + vec3 arg_2 = vec3(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + float res = texture(arg_0_arg_1, vec4(arg_2, float(arg_3)), arg_4); +} + +void fragment_main() { + textureSampleCompare_a3ca7e(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'samplerCubeArrayShadow' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.hlsl new file mode 100644 index 0000000000..06ac88bc5c --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.hlsl @@ -0,0 +1,14 @@ +TextureCubeArray arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureSampleCompare_a3ca7e() { + float3 arg_2 = (0.0f).xxx; + int arg_3 = 1; + float arg_4 = 1.0f; + float res = arg_0.SampleCmp(arg_1, float4(arg_2, float(arg_3)), arg_4); +} + +void fragment_main() { + textureSampleCompare_a3ca7e(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.msl new file mode 100644 index 0000000000..884983e782 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.msl @@ -0,0 +1,15 @@ +#include + +using namespace metal; +void textureSampleCompare_a3ca7e(depthcube_array tint_symbol, sampler tint_symbol_1) { + float3 arg_2 = float3(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + float res = tint_symbol.sample_compare(tint_symbol_1, arg_2, arg_3, arg_4); +} + +fragment void fragment_main(depthcube_array tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSampleCompare_a3ca7e(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.spvasm new file mode 100644 index 0000000000..8438b3e9d4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleCompare_a3ca7e "textureSampleCompare_a3ca7e" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %arg_4 "arg_4" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %13 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %20 = OpConstantNull %int + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %24 = OpConstantNull %float + %28 = OpTypeSampledImage %3 + %v4float = OpTypeVector %float 4 +%textureSampleCompare_a3ca7e = OpFunction %void None %8 + %11 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v3float Function %13 + %arg_3 = OpVariable %_ptr_Function_int Function %20 + %arg_4 = OpVariable %_ptr_Function_float Function %24 + %res = OpVariable %_ptr_Function_float Function %24 + OpStore %arg_2 %13 + OpStore %arg_3 %int_1 + OpStore %arg_4 %float_1 + %26 = OpLoad %7 %arg_1 + %27 = OpLoad %3 %arg_0 + %29 = OpSampledImage %28 %27 %26 + %31 = OpLoad %v3float %arg_2 + %32 = OpCompositeExtract %float %31 0 + %33 = OpCompositeExtract %float %31 1 + %34 = OpCompositeExtract %float %31 2 + %36 = OpLoad %int %arg_3 + %35 = OpConvertSToF %float %36 + %37 = OpCompositeConstruct %v4float %32 %33 %34 %35 + %38 = OpLoad %float %arg_4 + %25 = OpImageSampleDrefImplicitLod %float %29 %37 %38 + OpStore %res %25 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %41 = OpLabel + %42 = OpFunctionCall %void %textureSampleCompare_a3ca7e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.wgsl new file mode 100644 index 0000000000..7d34be2536 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.wgsl @@ -0,0 +1,15 @@ +@group(1) @binding(0) var arg_0 : texture_depth_cube_array; + +@group(1) @binding(1) var arg_1 : sampler_comparison; + +fn textureSampleCompare_a3ca7e() { + var arg_2 = vec3(); + var arg_3 = 1; + var arg_4 = 1.0; + var res : f32 = textureSampleCompare(arg_0, arg_1, arg_2, arg_3, arg_4); +} + +@stage(fragment) +fn fragment_main() { + textureSampleCompare_a3ca7e(); +} diff --git a/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl b/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl new file mode 100644 index 0000000000..c61a1c1d92 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl @@ -0,0 +1,39 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d_array; +@group(1) @binding(1) var arg_1: sampler_comparison; + +// fn textureSampleCompare(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2, array_index: i32, depth_ref: f32, @const offset: vec2) -> f32 +fn textureSampleCompare_af1051() { + var arg_2 = vec2(); + var arg_3 = 1; + var arg_4 = 1.0; + var res: f32 = textureSampleCompare(arg_0, arg_1, arg_2, arg_3, arg_4, vec2()); +} + +@stage(fragment) +fn fragment_main() { + textureSampleCompare_af1051(); +} diff --git a/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.glsl new file mode 100644 index 0000000000..3633f07d0e --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.glsl @@ -0,0 +1,29 @@ +SKIP: FAILED + +#version 310 es +precision mediump float; + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureSampleCompare_af1051() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + float res = textureOffset(arg_0_arg_1, vec4(vec3(arg_2, float(arg_3)), arg_4), ivec2(0)); +} + +void fragment_main() { + textureSampleCompare_af1051(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:10: 'sampler' : TextureOffset does not support sampler2DArrayShadow : ES Profile +ERROR: 0:10: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.hlsl new file mode 100644 index 0000000000..ad6956408e --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.hlsl @@ -0,0 +1,14 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureSampleCompare_af1051() { + float2 arg_2 = (0.0f).xx; + int arg_3 = 1; + float arg_4 = 1.0f; + float res = arg_0.SampleCmp(arg_1, float3(arg_2, float(arg_3)), arg_4, (0).xx); +} + +void fragment_main() { + textureSampleCompare_af1051(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.msl new file mode 100644 index 0000000000..e241a74c0e --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.msl @@ -0,0 +1,15 @@ +#include + +using namespace metal; +void textureSampleCompare_af1051(depth2d_array tint_symbol, sampler tint_symbol_1) { + float2 arg_2 = float2(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + float res = tint_symbol.sample_compare(tint_symbol_1, arg_2, arg_3, arg_4, int2(0)); +} + +fragment void fragment_main(depth2d_array tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSampleCompare_af1051(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.spvasm new file mode 100644 index 0000000000..290d5fef51 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleCompare_af1051 "textureSampleCompare_af1051" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %arg_4 "arg_4" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %13 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %20 = OpConstantNull %int + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %24 = OpConstantNull %float + %28 = OpTypeSampledImage %3 + %v3float = OpTypeVector %float 3 + %v2int = OpTypeVector %int 2 + %39 = OpConstantNull %v2int +%textureSampleCompare_af1051 = OpFunction %void None %8 + %11 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %13 + %arg_3 = OpVariable %_ptr_Function_int Function %20 + %arg_4 = OpVariable %_ptr_Function_float Function %24 + %res = OpVariable %_ptr_Function_float Function %24 + OpStore %arg_2 %13 + OpStore %arg_3 %int_1 + OpStore %arg_4 %float_1 + %26 = OpLoad %7 %arg_1 + %27 = OpLoad %3 %arg_0 + %29 = OpSampledImage %28 %27 %26 + %31 = OpLoad %v2float %arg_2 + %32 = OpCompositeExtract %float %31 0 + %33 = OpCompositeExtract %float %31 1 + %35 = OpLoad %int %arg_3 + %34 = OpConvertSToF %float %35 + %36 = OpCompositeConstruct %v3float %32 %33 %34 + %37 = OpLoad %float %arg_4 + %25 = OpImageSampleDrefImplicitLod %float %29 %36 %37 ConstOffset %39 + OpStore %res %25 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %42 = OpLabel + %43 = OpFunctionCall %void %textureSampleCompare_af1051 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.wgsl new file mode 100644 index 0000000000..6f34ddcc85 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.wgsl @@ -0,0 +1,15 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d_array; + +@group(1) @binding(1) var arg_1 : sampler_comparison; + +fn textureSampleCompare_af1051() { + var arg_2 = vec2(); + var arg_3 = 1; + var arg_4 = 1.0; + var res : f32 = textureSampleCompare(arg_0, arg_1, arg_2, arg_3, arg_4, vec2()); +} + +@stage(fragment) +fn fragment_main() { + textureSampleCompare_af1051(); +} diff --git a/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl b/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl new file mode 100644 index 0000000000..287d827b61 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl @@ -0,0 +1,39 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d_array; +@group(1) @binding(1) var arg_1: sampler_comparison; + +// fn textureSampleCompare(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2, array_index: i32, depth_ref: f32) -> f32 +fn textureSampleCompare_dd431d() { + var arg_2 = vec2(); + var arg_3 = 1; + var arg_4 = 1.0; + var res: f32 = textureSampleCompare(arg_0, arg_1, arg_2, arg_3, arg_4); +} + +@stage(fragment) +fn fragment_main() { + textureSampleCompare_dd431d(); +} diff --git a/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.glsl new file mode 100644 index 0000000000..edba551a2b --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.glsl @@ -0,0 +1,20 @@ +#version 310 es +precision mediump float; + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureSampleCompare_dd431d() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + float res = texture(arg_0_arg_1, vec4(vec3(arg_2, float(arg_3)), arg_4)); +} + +void fragment_main() { + textureSampleCompare_dd431d(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.hlsl new file mode 100644 index 0000000000..aed9ea373a --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.hlsl @@ -0,0 +1,14 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureSampleCompare_dd431d() { + float2 arg_2 = (0.0f).xx; + int arg_3 = 1; + float arg_4 = 1.0f; + float res = arg_0.SampleCmp(arg_1, float3(arg_2, float(arg_3)), arg_4); +} + +void fragment_main() { + textureSampleCompare_dd431d(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.msl new file mode 100644 index 0000000000..525ba3b182 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.msl @@ -0,0 +1,15 @@ +#include + +using namespace metal; +void textureSampleCompare_dd431d(depth2d_array tint_symbol, sampler tint_symbol_1) { + float2 arg_2 = float2(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + float res = tint_symbol.sample_compare(tint_symbol_1, arg_2, arg_3, arg_4); +} + +fragment void fragment_main(depth2d_array tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSampleCompare_dd431d(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.spvasm new file mode 100644 index 0000000000..a5fb4fc841 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 42 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleCompare_dd431d "textureSampleCompare_dd431d" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %arg_4 "arg_4" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %13 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %20 = OpConstantNull %int + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %24 = OpConstantNull %float + %28 = OpTypeSampledImage %3 + %v3float = OpTypeVector %float 3 +%textureSampleCompare_dd431d = OpFunction %void None %8 + %11 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %13 + %arg_3 = OpVariable %_ptr_Function_int Function %20 + %arg_4 = OpVariable %_ptr_Function_float Function %24 + %res = OpVariable %_ptr_Function_float Function %24 + OpStore %arg_2 %13 + OpStore %arg_3 %int_1 + OpStore %arg_4 %float_1 + %26 = OpLoad %7 %arg_1 + %27 = OpLoad %3 %arg_0 + %29 = OpSampledImage %28 %27 %26 + %31 = OpLoad %v2float %arg_2 + %32 = OpCompositeExtract %float %31 0 + %33 = OpCompositeExtract %float %31 1 + %35 = OpLoad %int %arg_3 + %34 = OpConvertSToF %float %35 + %36 = OpCompositeConstruct %v3float %32 %33 %34 + %37 = OpLoad %float %arg_4 + %25 = OpImageSampleDrefImplicitLod %float %29 %36 %37 + OpStore %res %25 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %40 = OpLabel + %41 = OpFunctionCall %void %textureSampleCompare_dd431d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.wgsl new file mode 100644 index 0000000000..762d558df8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.wgsl @@ -0,0 +1,15 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d_array; + +@group(1) @binding(1) var arg_1 : sampler_comparison; + +fn textureSampleCompare_dd431d() { + var arg_2 = vec2(); + var arg_3 = 1; + var arg_4 = 1.0; + var res : f32 = textureSampleCompare(arg_0, arg_1, arg_2, arg_3, arg_4); +} + +@stage(fragment) +fn fragment_main() { + textureSampleCompare_dd431d(); +} diff --git a/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl b/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl new file mode 100644 index 0000000000..dd9d45ec17 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl @@ -0,0 +1,38 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d; +@group(1) @binding(1) var arg_1: sampler_comparison; + +// fn textureSampleCompare(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2, depth_ref: f32, @const offset: vec2) -> f32 +fn textureSampleCompare_dec064() { + var arg_2 = vec2(); + var arg_3 = 1.0; + var res: f32 = textureSampleCompare(arg_0, arg_1, arg_2, arg_3, vec2()); +} + +@stage(fragment) +fn fragment_main() { + textureSampleCompare_dec064(); +} diff --git a/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.glsl new file mode 100644 index 0000000000..8adb0eeeda --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.glsl @@ -0,0 +1,19 @@ +#version 310 es +precision mediump float; + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureSampleCompare_dec064() { + vec2 arg_2 = vec2(0.0f); + float arg_3 = 1.0f; + float res = textureOffset(arg_0_arg_1, vec3(arg_2, arg_3), ivec2(0)); +} + +void fragment_main() { + textureSampleCompare_dec064(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.hlsl new file mode 100644 index 0000000000..21bf5e0222 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.hlsl @@ -0,0 +1,13 @@ +Texture2D arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureSampleCompare_dec064() { + float2 arg_2 = (0.0f).xx; + float arg_3 = 1.0f; + float res = arg_0.SampleCmp(arg_1, arg_2, arg_3, (0).xx); +} + +void fragment_main() { + textureSampleCompare_dec064(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.msl new file mode 100644 index 0000000000..c22e9dd8ec --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +void textureSampleCompare_dec064(depth2d tint_symbol, sampler tint_symbol_1) { + float2 arg_2 = float2(0.0f); + float arg_3 = 1.0f; + float res = tint_symbol.sample_compare(tint_symbol_1, arg_2, arg_3, int2(0)); +} + +fragment void fragment_main(depth2d tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSampleCompare_dec064(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.spvasm new file mode 100644 index 0000000000..6e55366615 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.spvasm @@ -0,0 +1,60 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleCompare_dec064 "textureSampleCompare_dec064" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %13 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %19 = OpConstantNull %float + %23 = OpTypeSampledImage %3 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %29 = OpConstantNull %v2int +%textureSampleCompare_dec064 = OpFunction %void None %8 + %11 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %13 + %arg_3 = OpVariable %_ptr_Function_float Function %19 + %res = OpVariable %_ptr_Function_float Function %19 + OpStore %arg_2 %13 + OpStore %arg_3 %float_1 + %21 = OpLoad %7 %arg_1 + %22 = OpLoad %3 %arg_0 + %24 = OpSampledImage %23 %22 %21 + %25 = OpLoad %v2float %arg_2 + %26 = OpLoad %float %arg_3 + %20 = OpImageSampleDrefImplicitLod %float %24 %25 %26 ConstOffset %29 + OpStore %res %20 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %32 = OpLabel + %33 = OpFunctionCall %void %textureSampleCompare_dec064 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.wgsl new file mode 100644 index 0000000000..a77c90f0ad --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.wgsl @@ -0,0 +1,14 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d; + +@group(1) @binding(1) var arg_1 : sampler_comparison; + +fn textureSampleCompare_dec064() { + var arg_2 = vec2(); + var arg_3 = 1.0; + var res : f32 = textureSampleCompare(arg_0, arg_1, arg_2, arg_3, vec2()); +} + +@stage(fragment) +fn fragment_main() { + textureSampleCompare_dec064(); +} diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/1116ed.wgsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/1116ed.wgsl new file mode 100644 index 0000000000..d5f827a7d9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/1116ed.wgsl @@ -0,0 +1,50 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d_array; +@group(1) @binding(1) var arg_1: sampler_comparison; + +// fn textureSampleCompareLevel(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2, array_index: i32, depth_ref: f32) -> f32 +fn textureSampleCompareLevel_1116ed() { + var arg_2 = vec2(); + var arg_3 = 1; + var arg_4 = 1.0; + var res: f32 = textureSampleCompareLevel(arg_0, arg_1, arg_2, arg_3, arg_4); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleCompareLevel_1116ed(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleCompareLevel_1116ed(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleCompareLevel_1116ed(); +} diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/1116ed.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/1116ed.wgsl.expected.glsl new file mode 100644 index 0000000000..c5a1359557 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/1116ed.wgsl.expected.glsl @@ -0,0 +1,64 @@ +#version 310 es + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureSampleCompareLevel_1116ed() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + float res = texture(arg_0_arg_1, vec4(vec3(arg_2, float(arg_3)), arg_4)); +} + +vec4 vertex_main() { + textureSampleCompareLevel_1116ed(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureSampleCompareLevel_1116ed() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + float res = texture(arg_0_arg_1, vec4(vec3(arg_2, float(arg_3)), arg_4)); +} + +void fragment_main() { + textureSampleCompareLevel_1116ed(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureSampleCompareLevel_1116ed() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + float res = texture(arg_0_arg_1, vec4(vec3(arg_2, float(arg_3)), arg_4)); +} + +void compute_main() { + textureSampleCompareLevel_1116ed(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/1116ed.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/1116ed.wgsl.expected.hlsl new file mode 100644 index 0000000000..dfdafaafad --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/1116ed.wgsl.expected.hlsl @@ -0,0 +1,36 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureSampleCompareLevel_1116ed() { + float2 arg_2 = (0.0f).xx; + int arg_3 = 1; + float arg_4 = 1.0f; + float res = arg_0.SampleCmpLevelZero(arg_1, float3(arg_2, float(arg_3)), arg_4); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleCompareLevel_1116ed(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleCompareLevel_1116ed(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleCompareLevel_1116ed(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/1116ed.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleCompareLevel/1116ed.wgsl.expected.msl new file mode 100644 index 0000000000..f4bf8844b1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/1116ed.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureSampleCompareLevel_1116ed(depth2d_array tint_symbol_1, sampler tint_symbol_2) { + float2 arg_2 = float2(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + float res = tint_symbol_1.sample_compare(tint_symbol_2, arg_2, arg_3, arg_4, level(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d_array tint_symbol_3, sampler tint_symbol_4) { + textureSampleCompareLevel_1116ed(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleCompareLevel_1116ed(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depth2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleCompareLevel_1116ed(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/1116ed.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleCompareLevel/1116ed.wgsl.expected.spvasm new file mode 100644 index 0000000000..fb2da605d9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/1116ed.wgsl.expected.spvasm @@ -0,0 +1,105 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 59 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleCompareLevel_1116ed "textureSampleCompareLevel_1116ed" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %arg_4 "arg_4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %20 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %27 = OpConstantNull %int + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %34 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 + %float_0 = OpConstant %float 0 + %46 = OpTypeFunction %v4float +%textureSampleCompareLevel_1116ed = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %20 + %arg_3 = OpVariable %_ptr_Function_int Function %27 + %arg_4 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_2 %20 + OpStore %arg_3 %int_1 + OpStore %arg_4 %float_1 + %32 = OpLoad %14 %arg_1 + %33 = OpLoad %11 %arg_0 + %35 = OpSampledImage %34 %33 %32 + %37 = OpLoad %v2float %arg_2 + %38 = OpCompositeExtract %float %37 0 + %39 = OpCompositeExtract %float %37 1 + %41 = OpLoad %int %arg_3 + %40 = OpConvertSToF %float %41 + %42 = OpCompositeConstruct %v3float %38 %39 %40 + %43 = OpLoad %float %arg_4 + %31 = OpImageSampleDrefExplicitLod %float %35 %42 %43 Lod %float_0 + OpStore %res %31 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %46 + %48 = OpLabel + %49 = OpFunctionCall %void %textureSampleCompareLevel_1116ed + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %51 = OpLabel + %52 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %52 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %54 = OpLabel + %55 = OpFunctionCall %void %textureSampleCompareLevel_1116ed + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %57 = OpLabel + %58 = OpFunctionCall %void %textureSampleCompareLevel_1116ed + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/1116ed.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/1116ed.wgsl.expected.wgsl new file mode 100644 index 0000000000..87b42dde1a --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/1116ed.wgsl.expected.wgsl @@ -0,0 +1,26 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d_array; + +@group(1) @binding(1) var arg_1 : sampler_comparison; + +fn textureSampleCompareLevel_1116ed() { + var arg_2 = vec2(); + var arg_3 = 1; + var arg_4 = 1.0; + var res : f32 = textureSampleCompareLevel(arg_0, arg_1, arg_2, arg_3, arg_4); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleCompareLevel_1116ed(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleCompareLevel_1116ed(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleCompareLevel_1116ed(); +} diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/1568e3.wgsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/1568e3.wgsl new file mode 100644 index 0000000000..3580ff66f3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/1568e3.wgsl @@ -0,0 +1,49 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_cube; +@group(1) @binding(1) var arg_1: sampler_comparison; + +// fn textureSampleCompareLevel(texture: texture_depth_cube, sampler: sampler_comparison, coords: vec3, depth_ref: f32) -> f32 +fn textureSampleCompareLevel_1568e3() { + var arg_2 = vec3(); + var arg_3 = 1.0; + var res: f32 = textureSampleCompareLevel(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleCompareLevel_1568e3(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleCompareLevel_1568e3(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleCompareLevel_1568e3(); +} diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/1568e3.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/1568e3.wgsl.expected.glsl new file mode 100644 index 0000000000..d877ce43e2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/1568e3.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +uniform highp samplerCubeShadow arg_0_arg_1; + +void textureSampleCompareLevel_1568e3() { + vec3 arg_2 = vec3(0.0f); + float arg_3 = 1.0f; + float res = texture(arg_0_arg_1, vec4(arg_2, arg_3)); +} + +vec4 vertex_main() { + textureSampleCompareLevel_1568e3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp samplerCubeShadow arg_0_arg_1; + +void textureSampleCompareLevel_1568e3() { + vec3 arg_2 = vec3(0.0f); + float arg_3 = 1.0f; + float res = texture(arg_0_arg_1, vec4(arg_2, arg_3)); +} + +void fragment_main() { + textureSampleCompareLevel_1568e3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp samplerCubeShadow arg_0_arg_1; + +void textureSampleCompareLevel_1568e3() { + vec3 arg_2 = vec3(0.0f); + float arg_3 = 1.0f; + float res = texture(arg_0_arg_1, vec4(arg_2, arg_3)); +} + +void compute_main() { + textureSampleCompareLevel_1568e3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/1568e3.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/1568e3.wgsl.expected.hlsl new file mode 100644 index 0000000000..a0b30fbcff --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/1568e3.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +TextureCube arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureSampleCompareLevel_1568e3() { + float3 arg_2 = (0.0f).xxx; + float arg_3 = 1.0f; + float res = arg_0.SampleCmpLevelZero(arg_1, arg_2, arg_3); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleCompareLevel_1568e3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleCompareLevel_1568e3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleCompareLevel_1568e3(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/1568e3.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleCompareLevel/1568e3.wgsl.expected.msl new file mode 100644 index 0000000000..410b28c70d --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/1568e3.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureSampleCompareLevel_1568e3(depthcube tint_symbol_1, sampler tint_symbol_2) { + float3 arg_2 = float3(0.0f); + float arg_3 = 1.0f; + float res = tint_symbol_1.sample_compare(tint_symbol_2, arg_2, arg_3, level(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depthcube tint_symbol_3, sampler tint_symbol_4) { + textureSampleCompareLevel_1568e3(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depthcube tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depthcube tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleCompareLevel_1568e3(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depthcube tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleCompareLevel_1568e3(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/1568e3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleCompareLevel/1568e3.wgsl.expected.spvasm new file mode 100644 index 0000000000..b0d97d3bec --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/1568e3.wgsl.expected.spvasm @@ -0,0 +1,92 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 48 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleCompareLevel_1568e3 "textureSampleCompareLevel_1568e3" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float Cube 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %20 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %29 = OpTypeSampledImage %11 + %float_0 = OpConstant %float 0 + %35 = OpTypeFunction %v4float +%textureSampleCompareLevel_1568e3 = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v3float Function %20 + %arg_3 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_2 %20 + OpStore %arg_3 %float_1 + %27 = OpLoad %14 %arg_1 + %28 = OpLoad %11 %arg_0 + %30 = OpSampledImage %29 %28 %27 + %31 = OpLoad %v3float %arg_2 + %32 = OpLoad %float %arg_3 + %26 = OpImageSampleDrefExplicitLod %float %30 %31 %32 Lod %float_0 + OpStore %res %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %35 + %37 = OpLabel + %38 = OpFunctionCall %void %textureSampleCompareLevel_1568e3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %40 = OpLabel + %41 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %41 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %43 = OpLabel + %44 = OpFunctionCall %void %textureSampleCompareLevel_1568e3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %46 = OpLabel + %47 = OpFunctionCall %void %textureSampleCompareLevel_1568e3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/1568e3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/1568e3.wgsl.expected.wgsl new file mode 100644 index 0000000000..408a7daeeb --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/1568e3.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +@group(1) @binding(0) var arg_0 : texture_depth_cube; + +@group(1) @binding(1) var arg_1 : sampler_comparison; + +fn textureSampleCompareLevel_1568e3() { + var arg_2 = vec3(); + var arg_3 = 1.0; + var res : f32 = textureSampleCompareLevel(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleCompareLevel_1568e3(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleCompareLevel_1568e3(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleCompareLevel_1568e3(); +} diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/2ad2b1.wgsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/2ad2b1.wgsl new file mode 100644 index 0000000000..e97fbb7561 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/2ad2b1.wgsl @@ -0,0 +1,49 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d; +@group(1) @binding(1) var arg_1: sampler_comparison; + +// fn textureSampleCompareLevel(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2, depth_ref: f32) -> f32 +fn textureSampleCompareLevel_2ad2b1() { + var arg_2 = vec2(); + var arg_3 = 1.0; + var res: f32 = textureSampleCompareLevel(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleCompareLevel_2ad2b1(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleCompareLevel_2ad2b1(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleCompareLevel_2ad2b1(); +} diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/2ad2b1.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/2ad2b1.wgsl.expected.glsl new file mode 100644 index 0000000000..fb730f0af0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/2ad2b1.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureSampleCompareLevel_2ad2b1() { + vec2 arg_2 = vec2(0.0f); + float arg_3 = 1.0f; + float res = texture(arg_0_arg_1, vec3(arg_2, arg_3)); +} + +vec4 vertex_main() { + textureSampleCompareLevel_2ad2b1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureSampleCompareLevel_2ad2b1() { + vec2 arg_2 = vec2(0.0f); + float arg_3 = 1.0f; + float res = texture(arg_0_arg_1, vec3(arg_2, arg_3)); +} + +void fragment_main() { + textureSampleCompareLevel_2ad2b1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureSampleCompareLevel_2ad2b1() { + vec2 arg_2 = vec2(0.0f); + float arg_3 = 1.0f; + float res = texture(arg_0_arg_1, vec3(arg_2, arg_3)); +} + +void compute_main() { + textureSampleCompareLevel_2ad2b1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/2ad2b1.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/2ad2b1.wgsl.expected.hlsl new file mode 100644 index 0000000000..c47f096ba8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/2ad2b1.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +Texture2D arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureSampleCompareLevel_2ad2b1() { + float2 arg_2 = (0.0f).xx; + float arg_3 = 1.0f; + float res = arg_0.SampleCmpLevelZero(arg_1, arg_2, arg_3); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleCompareLevel_2ad2b1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleCompareLevel_2ad2b1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleCompareLevel_2ad2b1(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/2ad2b1.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleCompareLevel/2ad2b1.wgsl.expected.msl new file mode 100644 index 0000000000..fb1f7ca9d8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/2ad2b1.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureSampleCompareLevel_2ad2b1(depth2d tint_symbol_1, sampler tint_symbol_2) { + float2 arg_2 = float2(0.0f); + float arg_3 = 1.0f; + float res = tint_symbol_1.sample_compare(tint_symbol_2, arg_2, arg_3, level(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d tint_symbol_3, sampler tint_symbol_4) { + textureSampleCompareLevel_2ad2b1(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleCompareLevel_2ad2b1(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depth2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleCompareLevel_2ad2b1(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/2ad2b1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleCompareLevel/2ad2b1.wgsl.expected.spvasm new file mode 100644 index 0000000000..58b009040d --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/2ad2b1.wgsl.expected.spvasm @@ -0,0 +1,92 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 48 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleCompareLevel_2ad2b1 "textureSampleCompareLevel_2ad2b1" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %20 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %29 = OpTypeSampledImage %11 + %float_0 = OpConstant %float 0 + %35 = OpTypeFunction %v4float +%textureSampleCompareLevel_2ad2b1 = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %20 + %arg_3 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_2 %20 + OpStore %arg_3 %float_1 + %27 = OpLoad %14 %arg_1 + %28 = OpLoad %11 %arg_0 + %30 = OpSampledImage %29 %28 %27 + %31 = OpLoad %v2float %arg_2 + %32 = OpLoad %float %arg_3 + %26 = OpImageSampleDrefExplicitLod %float %30 %31 %32 Lod %float_0 + OpStore %res %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %35 + %37 = OpLabel + %38 = OpFunctionCall %void %textureSampleCompareLevel_2ad2b1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %40 = OpLabel + %41 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %41 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %43 = OpLabel + %44 = OpFunctionCall %void %textureSampleCompareLevel_2ad2b1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %46 = OpLabel + %47 = OpFunctionCall %void %textureSampleCompareLevel_2ad2b1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/2ad2b1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/2ad2b1.wgsl.expected.wgsl new file mode 100644 index 0000000000..561b93631e --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/2ad2b1.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d; + +@group(1) @binding(1) var arg_1 : sampler_comparison; + +fn textureSampleCompareLevel_2ad2b1() { + var arg_2 = vec2(); + var arg_3 = 1.0; + var res : f32 = textureSampleCompareLevel(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleCompareLevel_2ad2b1(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleCompareLevel_2ad2b1(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleCompareLevel_2ad2b1(); +} diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/4cf3a2.wgsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/4cf3a2.wgsl new file mode 100644 index 0000000000..7b14c4724c --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/4cf3a2.wgsl @@ -0,0 +1,50 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_cube_array; +@group(1) @binding(1) var arg_1: sampler_comparison; + +// fn textureSampleCompareLevel(texture: texture_depth_cube_array, sampler: sampler_comparison, coords: vec3, array_index: i32, depth_ref: f32) -> f32 +fn textureSampleCompareLevel_4cf3a2() { + var arg_2 = vec3(); + var arg_3 = 1; + var arg_4 = 1.0; + var res: f32 = textureSampleCompareLevel(arg_0, arg_1, arg_2, arg_3, arg_4); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleCompareLevel_4cf3a2(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleCompareLevel_4cf3a2(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleCompareLevel_4cf3a2(); +} diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/4cf3a2.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/4cf3a2.wgsl.expected.glsl new file mode 100644 index 0000000000..dbec8ba1ac --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/4cf3a2.wgsl.expected.glsl @@ -0,0 +1,87 @@ +SKIP: FAILED + +#version 310 es + +uniform highp samplerCubeArrayShadow arg_0_arg_1; + +void textureSampleCompareLevel_4cf3a2() { + vec3 arg_2 = vec3(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + float res = texture(arg_0_arg_1, vec4(arg_2, float(arg_3)), arg_4); +} + +vec4 vertex_main() { + textureSampleCompareLevel_4cf3a2(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArrayShadow' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp samplerCubeArrayShadow arg_0_arg_1; + +void textureSampleCompareLevel_4cf3a2() { + vec3 arg_2 = vec3(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + float res = texture(arg_0_arg_1, vec4(arg_2, float(arg_3)), arg_4); +} + +void fragment_main() { + textureSampleCompareLevel_4cf3a2(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'samplerCubeArrayShadow' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp samplerCubeArrayShadow arg_0_arg_1; + +void textureSampleCompareLevel_4cf3a2() { + vec3 arg_2 = vec3(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + float res = texture(arg_0_arg_1, vec4(arg_2, float(arg_3)), arg_4); +} + +void compute_main() { + textureSampleCompareLevel_4cf3a2(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArrayShadow' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/4cf3a2.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/4cf3a2.wgsl.expected.hlsl new file mode 100644 index 0000000000..7910d95baa --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/4cf3a2.wgsl.expected.hlsl @@ -0,0 +1,36 @@ +TextureCubeArray arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureSampleCompareLevel_4cf3a2() { + float3 arg_2 = (0.0f).xxx; + int arg_3 = 1; + float arg_4 = 1.0f; + float res = arg_0.SampleCmpLevelZero(arg_1, float4(arg_2, float(arg_3)), arg_4); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleCompareLevel_4cf3a2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleCompareLevel_4cf3a2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleCompareLevel_4cf3a2(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/4cf3a2.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleCompareLevel/4cf3a2.wgsl.expected.msl new file mode 100644 index 0000000000..0378014821 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/4cf3a2.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureSampleCompareLevel_4cf3a2(depthcube_array tint_symbol_1, sampler tint_symbol_2) { + float3 arg_2 = float3(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + float res = tint_symbol_1.sample_compare(tint_symbol_2, arg_2, arg_3, arg_4, level(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depthcube_array tint_symbol_3, sampler tint_symbol_4) { + textureSampleCompareLevel_4cf3a2(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depthcube_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depthcube_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleCompareLevel_4cf3a2(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depthcube_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleCompareLevel_4cf3a2(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/4cf3a2.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleCompareLevel/4cf3a2.wgsl.expected.spvasm new file mode 100644 index 0000000000..e5a685673b --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/4cf3a2.wgsl.expected.spvasm @@ -0,0 +1,106 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 59 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleCompareLevel_4cf3a2 "textureSampleCompareLevel_4cf3a2" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %arg_4 "arg_4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %20 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %27 = OpConstantNull %int + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %34 = OpTypeSampledImage %11 + %float_0 = OpConstant %float 0 + %46 = OpTypeFunction %v4float +%textureSampleCompareLevel_4cf3a2 = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v3float Function %20 + %arg_3 = OpVariable %_ptr_Function_int Function %27 + %arg_4 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_2 %20 + OpStore %arg_3 %int_1 + OpStore %arg_4 %float_1 + %32 = OpLoad %14 %arg_1 + %33 = OpLoad %11 %arg_0 + %35 = OpSampledImage %34 %33 %32 + %36 = OpLoad %v3float %arg_2 + %37 = OpCompositeExtract %float %36 0 + %38 = OpCompositeExtract %float %36 1 + %39 = OpCompositeExtract %float %36 2 + %41 = OpLoad %int %arg_3 + %40 = OpConvertSToF %float %41 + %42 = OpCompositeConstruct %v4float %37 %38 %39 %40 + %43 = OpLoad %float %arg_4 + %31 = OpImageSampleDrefExplicitLod %float %35 %42 %43 Lod %float_0 + OpStore %res %31 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %46 + %48 = OpLabel + %49 = OpFunctionCall %void %textureSampleCompareLevel_4cf3a2 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %51 = OpLabel + %52 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %52 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %54 = OpLabel + %55 = OpFunctionCall %void %textureSampleCompareLevel_4cf3a2 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %57 = OpLabel + %58 = OpFunctionCall %void %textureSampleCompareLevel_4cf3a2 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/4cf3a2.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/4cf3a2.wgsl.expected.wgsl new file mode 100644 index 0000000000..d28a73116f --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/4cf3a2.wgsl.expected.wgsl @@ -0,0 +1,26 @@ +@group(1) @binding(0) var arg_0 : texture_depth_cube_array; + +@group(1) @binding(1) var arg_1 : sampler_comparison; + +fn textureSampleCompareLevel_4cf3a2() { + var arg_2 = vec3(); + var arg_3 = 1; + var arg_4 = 1.0; + var res : f32 = textureSampleCompareLevel(arg_0, arg_1, arg_2, arg_3, arg_4); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleCompareLevel_4cf3a2(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleCompareLevel_4cf3a2(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleCompareLevel_4cf3a2(); +} diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/7f2b9a.wgsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/7f2b9a.wgsl new file mode 100644 index 0000000000..a42e7beecd --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/7f2b9a.wgsl @@ -0,0 +1,49 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d; +@group(1) @binding(1) var arg_1: sampler_comparison; + +// fn textureSampleCompareLevel(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2, depth_ref: f32, @const offset: vec2) -> f32 +fn textureSampleCompareLevel_7f2b9a() { + var arg_2 = vec2(); + var arg_3 = 1.0; + var res: f32 = textureSampleCompareLevel(arg_0, arg_1, arg_2, arg_3, vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleCompareLevel_7f2b9a(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleCompareLevel_7f2b9a(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleCompareLevel_7f2b9a(); +} diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/7f2b9a.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/7f2b9a.wgsl.expected.glsl new file mode 100644 index 0000000000..0dcecc2690 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/7f2b9a.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureSampleCompareLevel_7f2b9a() { + vec2 arg_2 = vec2(0.0f); + float arg_3 = 1.0f; + float res = textureOffset(arg_0_arg_1, vec3(arg_2, arg_3), ivec2(0)); +} + +vec4 vertex_main() { + textureSampleCompareLevel_7f2b9a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureSampleCompareLevel_7f2b9a() { + vec2 arg_2 = vec2(0.0f); + float arg_3 = 1.0f; + float res = textureOffset(arg_0_arg_1, vec3(arg_2, arg_3), ivec2(0)); +} + +void fragment_main() { + textureSampleCompareLevel_7f2b9a(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureSampleCompareLevel_7f2b9a() { + vec2 arg_2 = vec2(0.0f); + float arg_3 = 1.0f; + float res = textureOffset(arg_0_arg_1, vec3(arg_2, arg_3), ivec2(0)); +} + +void compute_main() { + textureSampleCompareLevel_7f2b9a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/7f2b9a.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/7f2b9a.wgsl.expected.hlsl new file mode 100644 index 0000000000..6365c43b70 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/7f2b9a.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +Texture2D arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureSampleCompareLevel_7f2b9a() { + float2 arg_2 = (0.0f).xx; + float arg_3 = 1.0f; + float res = arg_0.SampleCmpLevelZero(arg_1, arg_2, arg_3, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleCompareLevel_7f2b9a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleCompareLevel_7f2b9a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleCompareLevel_7f2b9a(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/7f2b9a.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleCompareLevel/7f2b9a.wgsl.expected.msl new file mode 100644 index 0000000000..12a1172be9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/7f2b9a.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureSampleCompareLevel_7f2b9a(depth2d tint_symbol_1, sampler tint_symbol_2) { + float2 arg_2 = float2(0.0f); + float arg_3 = 1.0f; + float res = tint_symbol_1.sample_compare(tint_symbol_2, arg_2, arg_3, level(0), int2(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d tint_symbol_3, sampler tint_symbol_4) { + textureSampleCompareLevel_7f2b9a(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleCompareLevel_7f2b9a(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depth2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleCompareLevel_7f2b9a(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/7f2b9a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleCompareLevel/7f2b9a.wgsl.expected.spvasm new file mode 100644 index 0000000000..8e4ef7ce83 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/7f2b9a.wgsl.expected.spvasm @@ -0,0 +1,95 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 51 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleCompareLevel_7f2b9a "textureSampleCompareLevel_7f2b9a" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %20 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %29 = OpTypeSampledImage %11 + %float_0 = OpConstant %float 0 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %36 = OpConstantNull %v2int + %38 = OpTypeFunction %v4float +%textureSampleCompareLevel_7f2b9a = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %20 + %arg_3 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_2 %20 + OpStore %arg_3 %float_1 + %27 = OpLoad %14 %arg_1 + %28 = OpLoad %11 %arg_0 + %30 = OpSampledImage %29 %28 %27 + %31 = OpLoad %v2float %arg_2 + %32 = OpLoad %float %arg_3 + %26 = OpImageSampleDrefExplicitLod %float %30 %31 %32 Lod|ConstOffset %float_0 %36 + OpStore %res %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %38 + %40 = OpLabel + %41 = OpFunctionCall %void %textureSampleCompareLevel_7f2b9a + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %43 = OpLabel + %44 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %44 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %46 = OpLabel + %47 = OpFunctionCall %void %textureSampleCompareLevel_7f2b9a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %49 = OpLabel + %50 = OpFunctionCall %void %textureSampleCompareLevel_7f2b9a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/7f2b9a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/7f2b9a.wgsl.expected.wgsl new file mode 100644 index 0000000000..9b8be3bb9f --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/7f2b9a.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d; + +@group(1) @binding(1) var arg_1 : sampler_comparison; + +fn textureSampleCompareLevel_7f2b9a() { + var arg_2 = vec2(); + var arg_3 = 1.0; + var res : f32 = textureSampleCompareLevel(arg_0, arg_1, arg_2, arg_3, vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleCompareLevel_7f2b9a(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleCompareLevel_7f2b9a(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleCompareLevel_7f2b9a(); +} diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/b6e47c.wgsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/b6e47c.wgsl new file mode 100644 index 0000000000..477267244e --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/b6e47c.wgsl @@ -0,0 +1,50 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d_array; +@group(1) @binding(1) var arg_1: sampler_comparison; + +// fn textureSampleCompareLevel(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2, array_index: i32, depth_ref: f32, @const offset: vec2) -> f32 +fn textureSampleCompareLevel_b6e47c() { + var arg_2 = vec2(); + var arg_3 = 1; + var arg_4 = 1.0; + var res: f32 = textureSampleCompareLevel(arg_0, arg_1, arg_2, arg_3, arg_4, vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleCompareLevel_b6e47c(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleCompareLevel_b6e47c(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleCompareLevel_b6e47c(); +} diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/b6e47c.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/b6e47c.wgsl.expected.glsl new file mode 100644 index 0000000000..abe4ad64e6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/b6e47c.wgsl.expected.glsl @@ -0,0 +1,87 @@ +SKIP: FAILED + +#version 310 es + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureSampleCompareLevel_b6e47c() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + float res = textureOffset(arg_0_arg_1, vec4(vec3(arg_2, float(arg_3)), arg_4), ivec2(0)); +} + +vec4 vertex_main() { + textureSampleCompareLevel_b6e47c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:9: 'sampler' : TextureOffset does not support sampler2DArrayShadow : ES Profile +ERROR: 0:9: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureSampleCompareLevel_b6e47c() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + float res = textureOffset(arg_0_arg_1, vec4(vec3(arg_2, float(arg_3)), arg_4), ivec2(0)); +} + +void fragment_main() { + textureSampleCompareLevel_b6e47c(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:10: 'sampler' : TextureOffset does not support sampler2DArrayShadow : ES Profile +ERROR: 0:10: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureSampleCompareLevel_b6e47c() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + float res = textureOffset(arg_0_arg_1, vec4(vec3(arg_2, float(arg_3)), arg_4), ivec2(0)); +} + +void compute_main() { + textureSampleCompareLevel_b6e47c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:9: 'sampler' : TextureOffset does not support sampler2DArrayShadow : ES Profile +ERROR: 0:9: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/b6e47c.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/b6e47c.wgsl.expected.hlsl new file mode 100644 index 0000000000..43587976e3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/b6e47c.wgsl.expected.hlsl @@ -0,0 +1,36 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureSampleCompareLevel_b6e47c() { + float2 arg_2 = (0.0f).xx; + int arg_3 = 1; + float arg_4 = 1.0f; + float res = arg_0.SampleCmpLevelZero(arg_1, float3(arg_2, float(arg_3)), arg_4, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleCompareLevel_b6e47c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleCompareLevel_b6e47c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleCompareLevel_b6e47c(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/b6e47c.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleCompareLevel/b6e47c.wgsl.expected.msl new file mode 100644 index 0000000000..a20d5d2cab --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/b6e47c.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureSampleCompareLevel_b6e47c(depth2d_array tint_symbol_1, sampler tint_symbol_2) { + float2 arg_2 = float2(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + float res = tint_symbol_1.sample_compare(tint_symbol_2, arg_2, arg_3, arg_4, level(0), int2(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d_array tint_symbol_3, sampler tint_symbol_4) { + textureSampleCompareLevel_b6e47c(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleCompareLevel_b6e47c(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depth2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleCompareLevel_b6e47c(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/b6e47c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleCompareLevel/b6e47c.wgsl.expected.spvasm new file mode 100644 index 0000000000..8401e93459 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/b6e47c.wgsl.expected.spvasm @@ -0,0 +1,107 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 61 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleCompareLevel_b6e47c "textureSampleCompareLevel_b6e47c" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %arg_4 "arg_4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %20 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %27 = OpConstantNull %int + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %34 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 + %float_0 = OpConstant %float 0 + %v2int = OpTypeVector %int 2 + %46 = OpConstantNull %v2int + %48 = OpTypeFunction %v4float +%textureSampleCompareLevel_b6e47c = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %20 + %arg_3 = OpVariable %_ptr_Function_int Function %27 + %arg_4 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_2 %20 + OpStore %arg_3 %int_1 + OpStore %arg_4 %float_1 + %32 = OpLoad %14 %arg_1 + %33 = OpLoad %11 %arg_0 + %35 = OpSampledImage %34 %33 %32 + %37 = OpLoad %v2float %arg_2 + %38 = OpCompositeExtract %float %37 0 + %39 = OpCompositeExtract %float %37 1 + %41 = OpLoad %int %arg_3 + %40 = OpConvertSToF %float %41 + %42 = OpCompositeConstruct %v3float %38 %39 %40 + %43 = OpLoad %float %arg_4 + %31 = OpImageSampleDrefExplicitLod %float %35 %42 %43 Lod|ConstOffset %float_0 %46 + OpStore %res %31 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %48 + %50 = OpLabel + %51 = OpFunctionCall %void %textureSampleCompareLevel_b6e47c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %53 = OpLabel + %54 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %54 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %56 = OpLabel + %57 = OpFunctionCall %void %textureSampleCompareLevel_b6e47c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %59 = OpLabel + %60 = OpFunctionCall %void %textureSampleCompareLevel_b6e47c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/b6e47c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/b6e47c.wgsl.expected.wgsl new file mode 100644 index 0000000000..15f99569e5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/b6e47c.wgsl.expected.wgsl @@ -0,0 +1,26 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d_array; + +@group(1) @binding(1) var arg_1 : sampler_comparison; + +fn textureSampleCompareLevel_b6e47c() { + var arg_2 = vec2(); + var arg_3 = 1; + var arg_4 = 1.0; + var res : f32 = textureSampleCompareLevel(arg_0, arg_1, arg_2, arg_3, arg_4, vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleCompareLevel_b6e47c(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleCompareLevel_b6e47c(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleCompareLevel_b6e47c(); +} diff --git a/test/tint/builtins/gen/var/textureSampleGrad/21402b.wgsl b/test/tint/builtins/gen/var/textureSampleGrad/21402b.wgsl new file mode 100644 index 0000000000..bd6e7a0ad5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/21402b.wgsl @@ -0,0 +1,50 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_3d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleGrad(texture: texture_3d, sampler: sampler, coords: vec3, ddx: vec3, ddy: vec3) -> vec4 +fn textureSampleGrad_21402b() { + var arg_2 = vec3(); + var arg_3 = vec3(); + var arg_4 = vec3(); + var res: vec4 = textureSampleGrad(arg_0, arg_1, arg_2, arg_3, arg_4); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleGrad_21402b(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleGrad_21402b(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleGrad_21402b(); +} diff --git a/test/tint/builtins/gen/var/textureSampleGrad/21402b.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleGrad/21402b.wgsl.expected.glsl new file mode 100644 index 0000000000..f480d789eb --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/21402b.wgsl.expected.glsl @@ -0,0 +1,64 @@ +#version 310 es + +uniform highp sampler3D arg_0_arg_1; + +void textureSampleGrad_21402b() { + vec3 arg_2 = vec3(0.0f); + vec3 arg_3 = vec3(0.0f); + vec3 arg_4 = vec3(0.0f); + vec4 res = textureGrad(arg_0_arg_1, arg_2, arg_3, arg_4); +} + +vec4 vertex_main() { + textureSampleGrad_21402b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler3D arg_0_arg_1; + +void textureSampleGrad_21402b() { + vec3 arg_2 = vec3(0.0f); + vec3 arg_3 = vec3(0.0f); + vec3 arg_4 = vec3(0.0f); + vec4 res = textureGrad(arg_0_arg_1, arg_2, arg_3, arg_4); +} + +void fragment_main() { + textureSampleGrad_21402b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler3D arg_0_arg_1; + +void textureSampleGrad_21402b() { + vec3 arg_2 = vec3(0.0f); + vec3 arg_3 = vec3(0.0f); + vec3 arg_4 = vec3(0.0f); + vec4 res = textureGrad(arg_0_arg_1, arg_2, arg_3, arg_4); +} + +void compute_main() { + textureSampleGrad_21402b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleGrad/21402b.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleGrad/21402b.wgsl.expected.hlsl new file mode 100644 index 0000000000..037d976713 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/21402b.wgsl.expected.hlsl @@ -0,0 +1,36 @@ +Texture3D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleGrad_21402b() { + float3 arg_2 = (0.0f).xxx; + float3 arg_3 = (0.0f).xxx; + float3 arg_4 = (0.0f).xxx; + float4 res = arg_0.SampleGrad(arg_1, arg_2, arg_3, arg_4); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleGrad_21402b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleGrad_21402b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleGrad_21402b(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleGrad/21402b.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleGrad/21402b.wgsl.expected.msl new file mode 100644 index 0000000000..8be83cd224 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/21402b.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureSampleGrad_21402b(texture3d tint_symbol_1, sampler tint_symbol_2) { + float3 arg_2 = float3(0.0f); + float3 arg_3 = float3(0.0f); + float3 arg_4 = float3(0.0f); + float4 res = tint_symbol_1.sample(tint_symbol_2, arg_2, gradient3d(arg_3, arg_4)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_3, sampler tint_symbol_4) { + textureSampleGrad_21402b(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleGrad_21402b(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture3d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleGrad_21402b(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleGrad/21402b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleGrad/21402b.wgsl.expected.spvasm new file mode 100644 index 0000000000..19f41b27cf --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/21402b.wgsl.expected.spvasm @@ -0,0 +1,95 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 49 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleGrad_21402b "textureSampleGrad_21402b" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %arg_4 "arg_4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 3D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %20 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %28 = OpTypeSampledImage %11 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %35 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureSampleGrad_21402b = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v3float Function %20 + %arg_3 = OpVariable %_ptr_Function_v3float Function %20 + %arg_4 = OpVariable %_ptr_Function_v3float Function %20 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_2 %20 + OpStore %arg_3 %20 + OpStore %arg_4 %20 + %26 = OpLoad %14 %arg_1 + %27 = OpLoad %11 %arg_0 + %29 = OpSampledImage %28 %27 %26 + %30 = OpLoad %v3float %arg_2 + %31 = OpLoad %v3float %arg_3 + %32 = OpLoad %v3float %arg_4 + %25 = OpImageSampleExplicitLod %v4float %29 %30 Grad %31 %32 + OpStore %res %25 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %35 + %37 = OpLabel + %38 = OpFunctionCall %void %textureSampleGrad_21402b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %40 = OpLabel + %41 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %41 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %44 = OpLabel + %45 = OpFunctionCall %void %textureSampleGrad_21402b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %47 = OpLabel + %48 = OpFunctionCall %void %textureSampleGrad_21402b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleGrad/21402b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleGrad/21402b.wgsl.expected.wgsl new file mode 100644 index 0000000000..23170fb580 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/21402b.wgsl.expected.wgsl @@ -0,0 +1,26 @@ +@group(1) @binding(0) var arg_0 : texture_3d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleGrad_21402b() { + var arg_2 = vec3(); + var arg_3 = vec3(); + var arg_4 = vec3(); + var res : vec4 = textureSampleGrad(arg_0, arg_1, arg_2, arg_3, arg_4); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleGrad_21402b(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleGrad_21402b(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleGrad_21402b(); +} diff --git a/test/tint/builtins/gen/var/textureSampleGrad/2ecd8f.wgsl b/test/tint/builtins/gen/var/textureSampleGrad/2ecd8f.wgsl new file mode 100644 index 0000000000..ae3e70fe17 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/2ecd8f.wgsl @@ -0,0 +1,51 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleGrad(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, ddx: vec2, ddy: vec2) -> vec4 +fn textureSampleGrad_2ecd8f() { + var arg_2 = vec2(); + var arg_3 = 1; + var arg_4 = vec2(); + var arg_5 = vec2(); + var res: vec4 = textureSampleGrad(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleGrad_2ecd8f(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleGrad_2ecd8f(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleGrad_2ecd8f(); +} diff --git a/test/tint/builtins/gen/var/textureSampleGrad/2ecd8f.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleGrad/2ecd8f.wgsl.expected.glsl new file mode 100644 index 0000000000..62edc1550f --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/2ecd8f.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es + +uniform highp sampler2DArray arg_0_arg_1; + +void textureSampleGrad_2ecd8f() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + vec2 arg_4 = vec2(0.0f); + vec2 arg_5 = vec2(0.0f); + vec4 res = textureGrad(arg_0_arg_1, vec3(arg_2, float(arg_3)), arg_4, arg_5); +} + +vec4 vertex_main() { + textureSampleGrad_2ecd8f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DArray arg_0_arg_1; + +void textureSampleGrad_2ecd8f() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + vec2 arg_4 = vec2(0.0f); + vec2 arg_5 = vec2(0.0f); + vec4 res = textureGrad(arg_0_arg_1, vec3(arg_2, float(arg_3)), arg_4, arg_5); +} + +void fragment_main() { + textureSampleGrad_2ecd8f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DArray arg_0_arg_1; + +void textureSampleGrad_2ecd8f() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + vec2 arg_4 = vec2(0.0f); + vec2 arg_5 = vec2(0.0f); + vec4 res = textureGrad(arg_0_arg_1, vec3(arg_2, float(arg_3)), arg_4, arg_5); +} + +void compute_main() { + textureSampleGrad_2ecd8f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleGrad/2ecd8f.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleGrad/2ecd8f.wgsl.expected.hlsl new file mode 100644 index 0000000000..51d6b37c44 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/2ecd8f.wgsl.expected.hlsl @@ -0,0 +1,37 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleGrad_2ecd8f() { + float2 arg_2 = (0.0f).xx; + int arg_3 = 1; + float2 arg_4 = (0.0f).xx; + float2 arg_5 = (0.0f).xx; + float4 res = arg_0.SampleGrad(arg_1, float3(arg_2, float(arg_3)), arg_4, arg_5); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleGrad_2ecd8f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleGrad_2ecd8f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleGrad_2ecd8f(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleGrad/2ecd8f.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleGrad/2ecd8f.wgsl.expected.msl new file mode 100644 index 0000000000..0fc4d01071 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/2ecd8f.wgsl.expected.msl @@ -0,0 +1,37 @@ +#include + +using namespace metal; +void textureSampleGrad_2ecd8f(texture2d_array tint_symbol_1, sampler tint_symbol_2) { + float2 arg_2 = float2(0.0f); + int arg_3 = 1; + float2 arg_4 = float2(0.0f); + float2 arg_5 = float2(0.0f); + float4 res = tint_symbol_1.sample(tint_symbol_2, arg_2, arg_3, gradient2d(arg_4, arg_5)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_3, sampler tint_symbol_4) { + textureSampleGrad_2ecd8f(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleGrad_2ecd8f(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleGrad_2ecd8f(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleGrad/2ecd8f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleGrad/2ecd8f.wgsl.expected.spvasm new file mode 100644 index 0000000000..adfcab266a --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/2ecd8f.wgsl.expected.spvasm @@ -0,0 +1,108 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 60 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleGrad_2ecd8f "textureSampleGrad_2ecd8f" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %arg_4 "arg_4" + OpName %arg_5 "arg_5" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %20 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %27 = OpConstantNull %int + %33 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %46 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureSampleGrad_2ecd8f = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %20 + %arg_3 = OpVariable %_ptr_Function_int Function %27 + %arg_4 = OpVariable %_ptr_Function_v2float Function %20 + %arg_5 = OpVariable %_ptr_Function_v2float Function %20 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_2 %20 + OpStore %arg_3 %int_1 + OpStore %arg_4 %20 + OpStore %arg_5 %20 + %31 = OpLoad %14 %arg_1 + %32 = OpLoad %11 %arg_0 + %34 = OpSampledImage %33 %32 %31 + %36 = OpLoad %v2float %arg_2 + %37 = OpCompositeExtract %float %36 0 + %38 = OpCompositeExtract %float %36 1 + %40 = OpLoad %int %arg_3 + %39 = OpConvertSToF %float %40 + %41 = OpCompositeConstruct %v3float %37 %38 %39 + %42 = OpLoad %v2float %arg_4 + %43 = OpLoad %v2float %arg_5 + %30 = OpImageSampleExplicitLod %v4float %34 %41 Grad %42 %43 + OpStore %res %30 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %46 + %48 = OpLabel + %49 = OpFunctionCall %void %textureSampleGrad_2ecd8f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %51 = OpLabel + %52 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %52 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %55 = OpLabel + %56 = OpFunctionCall %void %textureSampleGrad_2ecd8f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %58 = OpLabel + %59 = OpFunctionCall %void %textureSampleGrad_2ecd8f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleGrad/2ecd8f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleGrad/2ecd8f.wgsl.expected.wgsl new file mode 100644 index 0000000000..f9434a9f8a --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/2ecd8f.wgsl.expected.wgsl @@ -0,0 +1,27 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleGrad_2ecd8f() { + var arg_2 = vec2(); + var arg_3 = 1; + var arg_4 = vec2(); + var arg_5 = vec2(); + var res : vec4 = textureSampleGrad(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleGrad_2ecd8f(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleGrad_2ecd8f(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleGrad_2ecd8f(); +} diff --git a/test/tint/builtins/gen/var/textureSampleGrad/521263.wgsl b/test/tint/builtins/gen/var/textureSampleGrad/521263.wgsl new file mode 100644 index 0000000000..66d675581c --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/521263.wgsl @@ -0,0 +1,50 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleGrad(texture: texture_2d, sampler: sampler, coords: vec2, ddx: vec2, ddy: vec2) -> vec4 +fn textureSampleGrad_521263() { + var arg_2 = vec2(); + var arg_3 = vec2(); + var arg_4 = vec2(); + var res: vec4 = textureSampleGrad(arg_0, arg_1, arg_2, arg_3, arg_4); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleGrad_521263(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleGrad_521263(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleGrad_521263(); +} diff --git a/test/tint/builtins/gen/var/textureSampleGrad/521263.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleGrad/521263.wgsl.expected.glsl new file mode 100644 index 0000000000..eb7aee0631 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/521263.wgsl.expected.glsl @@ -0,0 +1,64 @@ +#version 310 es + +uniform highp sampler2D arg_0_arg_1; + +void textureSampleGrad_521263() { + vec2 arg_2 = vec2(0.0f); + vec2 arg_3 = vec2(0.0f); + vec2 arg_4 = vec2(0.0f); + vec4 res = textureGrad(arg_0_arg_1, arg_2, arg_3, arg_4); +} + +vec4 vertex_main() { + textureSampleGrad_521263(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2D arg_0_arg_1; + +void textureSampleGrad_521263() { + vec2 arg_2 = vec2(0.0f); + vec2 arg_3 = vec2(0.0f); + vec2 arg_4 = vec2(0.0f); + vec4 res = textureGrad(arg_0_arg_1, arg_2, arg_3, arg_4); +} + +void fragment_main() { + textureSampleGrad_521263(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2D arg_0_arg_1; + +void textureSampleGrad_521263() { + vec2 arg_2 = vec2(0.0f); + vec2 arg_3 = vec2(0.0f); + vec2 arg_4 = vec2(0.0f); + vec4 res = textureGrad(arg_0_arg_1, arg_2, arg_3, arg_4); +} + +void compute_main() { + textureSampleGrad_521263(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleGrad/521263.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleGrad/521263.wgsl.expected.hlsl new file mode 100644 index 0000000000..b184cd79b9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/521263.wgsl.expected.hlsl @@ -0,0 +1,36 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleGrad_521263() { + float2 arg_2 = (0.0f).xx; + float2 arg_3 = (0.0f).xx; + float2 arg_4 = (0.0f).xx; + float4 res = arg_0.SampleGrad(arg_1, arg_2, arg_3, arg_4); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleGrad_521263(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleGrad_521263(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleGrad_521263(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleGrad/521263.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleGrad/521263.wgsl.expected.msl new file mode 100644 index 0000000000..89f9e8756c --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/521263.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureSampleGrad_521263(texture2d tint_symbol_1, sampler tint_symbol_2) { + float2 arg_2 = float2(0.0f); + float2 arg_3 = float2(0.0f); + float2 arg_4 = float2(0.0f); + float4 res = tint_symbol_1.sample(tint_symbol_2, arg_2, gradient2d(arg_3, arg_4)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_3, sampler tint_symbol_4) { + textureSampleGrad_521263(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleGrad_521263(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleGrad_521263(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleGrad/521263.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleGrad/521263.wgsl.expected.spvasm new file mode 100644 index 0000000000..5b90d6c400 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/521263.wgsl.expected.spvasm @@ -0,0 +1,95 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 49 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleGrad_521263 "textureSampleGrad_521263" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %arg_4 "arg_4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %20 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %28 = OpTypeSampledImage %11 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %35 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureSampleGrad_521263 = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %20 + %arg_3 = OpVariable %_ptr_Function_v2float Function %20 + %arg_4 = OpVariable %_ptr_Function_v2float Function %20 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_2 %20 + OpStore %arg_3 %20 + OpStore %arg_4 %20 + %26 = OpLoad %14 %arg_1 + %27 = OpLoad %11 %arg_0 + %29 = OpSampledImage %28 %27 %26 + %30 = OpLoad %v2float %arg_2 + %31 = OpLoad %v2float %arg_3 + %32 = OpLoad %v2float %arg_4 + %25 = OpImageSampleExplicitLod %v4float %29 %30 Grad %31 %32 + OpStore %res %25 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %35 + %37 = OpLabel + %38 = OpFunctionCall %void %textureSampleGrad_521263 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %40 = OpLabel + %41 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %41 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %44 = OpLabel + %45 = OpFunctionCall %void %textureSampleGrad_521263 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %47 = OpLabel + %48 = OpFunctionCall %void %textureSampleGrad_521263 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleGrad/521263.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleGrad/521263.wgsl.expected.wgsl new file mode 100644 index 0000000000..e229216d8b --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/521263.wgsl.expected.wgsl @@ -0,0 +1,26 @@ +@group(1) @binding(0) var arg_0 : texture_2d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleGrad_521263() { + var arg_2 = vec2(); + var arg_3 = vec2(); + var arg_4 = vec2(); + var res : vec4 = textureSampleGrad(arg_0, arg_1, arg_2, arg_3, arg_4); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleGrad_521263(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleGrad_521263(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleGrad_521263(); +} diff --git a/test/tint/builtins/gen/var/textureSampleGrad/5312f4.wgsl b/test/tint/builtins/gen/var/textureSampleGrad/5312f4.wgsl new file mode 100644 index 0000000000..7d6f633e4a --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/5312f4.wgsl @@ -0,0 +1,50 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleGrad(texture: texture_cube, sampler: sampler, coords: vec3, ddx: vec3, ddy: vec3) -> vec4 +fn textureSampleGrad_5312f4() { + var arg_2 = vec3(); + var arg_3 = vec3(); + var arg_4 = vec3(); + var res: vec4 = textureSampleGrad(arg_0, arg_1, arg_2, arg_3, arg_4); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleGrad_5312f4(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleGrad_5312f4(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleGrad_5312f4(); +} diff --git a/test/tint/builtins/gen/var/textureSampleGrad/5312f4.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleGrad/5312f4.wgsl.expected.glsl new file mode 100644 index 0000000000..7278ce3735 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/5312f4.wgsl.expected.glsl @@ -0,0 +1,64 @@ +#version 310 es + +uniform highp samplerCube arg_0_arg_1; + +void textureSampleGrad_5312f4() { + vec3 arg_2 = vec3(0.0f); + vec3 arg_3 = vec3(0.0f); + vec3 arg_4 = vec3(0.0f); + vec4 res = textureGrad(arg_0_arg_1, arg_2, arg_3, arg_4); +} + +vec4 vertex_main() { + textureSampleGrad_5312f4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp samplerCube arg_0_arg_1; + +void textureSampleGrad_5312f4() { + vec3 arg_2 = vec3(0.0f); + vec3 arg_3 = vec3(0.0f); + vec3 arg_4 = vec3(0.0f); + vec4 res = textureGrad(arg_0_arg_1, arg_2, arg_3, arg_4); +} + +void fragment_main() { + textureSampleGrad_5312f4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp samplerCube arg_0_arg_1; + +void textureSampleGrad_5312f4() { + vec3 arg_2 = vec3(0.0f); + vec3 arg_3 = vec3(0.0f); + vec3 arg_4 = vec3(0.0f); + vec4 res = textureGrad(arg_0_arg_1, arg_2, arg_3, arg_4); +} + +void compute_main() { + textureSampleGrad_5312f4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleGrad/5312f4.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleGrad/5312f4.wgsl.expected.hlsl new file mode 100644 index 0000000000..14508e1a60 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/5312f4.wgsl.expected.hlsl @@ -0,0 +1,36 @@ +TextureCube arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleGrad_5312f4() { + float3 arg_2 = (0.0f).xxx; + float3 arg_3 = (0.0f).xxx; + float3 arg_4 = (0.0f).xxx; + float4 res = arg_0.SampleGrad(arg_1, arg_2, arg_3, arg_4); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleGrad_5312f4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleGrad_5312f4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleGrad_5312f4(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleGrad/5312f4.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleGrad/5312f4.wgsl.expected.msl new file mode 100644 index 0000000000..d7f4659730 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/5312f4.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureSampleGrad_5312f4(texturecube tint_symbol_1, sampler tint_symbol_2) { + float3 arg_2 = float3(0.0f); + float3 arg_3 = float3(0.0f); + float3 arg_4 = float3(0.0f); + float4 res = tint_symbol_1.sample(tint_symbol_2, arg_2, gradientcube(arg_3, arg_4)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube tint_symbol_3, sampler tint_symbol_4) { + textureSampleGrad_5312f4(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleGrad_5312f4(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texturecube tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleGrad_5312f4(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleGrad/5312f4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleGrad/5312f4.wgsl.expected.spvasm new file mode 100644 index 0000000000..149aba6073 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/5312f4.wgsl.expected.spvasm @@ -0,0 +1,95 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 49 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleGrad_5312f4 "textureSampleGrad_5312f4" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %arg_4 "arg_4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float Cube 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %20 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %28 = OpTypeSampledImage %11 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %35 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureSampleGrad_5312f4 = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v3float Function %20 + %arg_3 = OpVariable %_ptr_Function_v3float Function %20 + %arg_4 = OpVariable %_ptr_Function_v3float Function %20 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_2 %20 + OpStore %arg_3 %20 + OpStore %arg_4 %20 + %26 = OpLoad %14 %arg_1 + %27 = OpLoad %11 %arg_0 + %29 = OpSampledImage %28 %27 %26 + %30 = OpLoad %v3float %arg_2 + %31 = OpLoad %v3float %arg_3 + %32 = OpLoad %v3float %arg_4 + %25 = OpImageSampleExplicitLod %v4float %29 %30 Grad %31 %32 + OpStore %res %25 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %35 + %37 = OpLabel + %38 = OpFunctionCall %void %textureSampleGrad_5312f4 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %40 = OpLabel + %41 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %41 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %44 = OpLabel + %45 = OpFunctionCall %void %textureSampleGrad_5312f4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %47 = OpLabel + %48 = OpFunctionCall %void %textureSampleGrad_5312f4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleGrad/5312f4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleGrad/5312f4.wgsl.expected.wgsl new file mode 100644 index 0000000000..badb6a104a --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/5312f4.wgsl.expected.wgsl @@ -0,0 +1,26 @@ +@group(1) @binding(0) var arg_0 : texture_cube; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleGrad_5312f4() { + var arg_2 = vec3(); + var arg_3 = vec3(); + var arg_4 = vec3(); + var res : vec4 = textureSampleGrad(arg_0, arg_1, arg_2, arg_3, arg_4); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleGrad_5312f4(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleGrad_5312f4(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleGrad_5312f4(); +} diff --git a/test/tint/builtins/gen/var/textureSampleGrad/5884dd.wgsl b/test/tint/builtins/gen/var/textureSampleGrad/5884dd.wgsl new file mode 100644 index 0000000000..993eb737c4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/5884dd.wgsl @@ -0,0 +1,50 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_3d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleGrad(texture: texture_3d, sampler: sampler, coords: vec3, ddx: vec3, ddy: vec3, @const offset: vec3) -> vec4 +fn textureSampleGrad_5884dd() { + var arg_2 = vec3(); + var arg_3 = vec3(); + var arg_4 = vec3(); + var res: vec4 = textureSampleGrad(arg_0, arg_1, arg_2, arg_3, arg_4, vec3()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleGrad_5884dd(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleGrad_5884dd(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleGrad_5884dd(); +} diff --git a/test/tint/builtins/gen/var/textureSampleGrad/5884dd.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleGrad/5884dd.wgsl.expected.glsl new file mode 100644 index 0000000000..a20b4b4a49 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/5884dd.wgsl.expected.glsl @@ -0,0 +1,64 @@ +#version 310 es + +uniform highp sampler3D arg_0_arg_1; + +void textureSampleGrad_5884dd() { + vec3 arg_2 = vec3(0.0f); + vec3 arg_3 = vec3(0.0f); + vec3 arg_4 = vec3(0.0f); + vec4 res = textureGradOffset(arg_0_arg_1, arg_2, arg_3, arg_4, ivec3(0)); +} + +vec4 vertex_main() { + textureSampleGrad_5884dd(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler3D arg_0_arg_1; + +void textureSampleGrad_5884dd() { + vec3 arg_2 = vec3(0.0f); + vec3 arg_3 = vec3(0.0f); + vec3 arg_4 = vec3(0.0f); + vec4 res = textureGradOffset(arg_0_arg_1, arg_2, arg_3, arg_4, ivec3(0)); +} + +void fragment_main() { + textureSampleGrad_5884dd(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler3D arg_0_arg_1; + +void textureSampleGrad_5884dd() { + vec3 arg_2 = vec3(0.0f); + vec3 arg_3 = vec3(0.0f); + vec3 arg_4 = vec3(0.0f); + vec4 res = textureGradOffset(arg_0_arg_1, arg_2, arg_3, arg_4, ivec3(0)); +} + +void compute_main() { + textureSampleGrad_5884dd(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleGrad/5884dd.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleGrad/5884dd.wgsl.expected.hlsl new file mode 100644 index 0000000000..695dd3062e --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/5884dd.wgsl.expected.hlsl @@ -0,0 +1,36 @@ +Texture3D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleGrad_5884dd() { + float3 arg_2 = (0.0f).xxx; + float3 arg_3 = (0.0f).xxx; + float3 arg_4 = (0.0f).xxx; + float4 res = arg_0.SampleGrad(arg_1, arg_2, arg_3, arg_4, (0).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleGrad_5884dd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleGrad_5884dd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleGrad_5884dd(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleGrad/5884dd.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleGrad/5884dd.wgsl.expected.msl new file mode 100644 index 0000000000..87a518a419 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/5884dd.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureSampleGrad_5884dd(texture3d tint_symbol_1, sampler tint_symbol_2) { + float3 arg_2 = float3(0.0f); + float3 arg_3 = float3(0.0f); + float3 arg_4 = float3(0.0f); + float4 res = tint_symbol_1.sample(tint_symbol_2, arg_2, gradient3d(arg_3, arg_4), int3(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_3, sampler tint_symbol_4) { + textureSampleGrad_5884dd(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleGrad_5884dd(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture3d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleGrad_5884dd(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleGrad/5884dd.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleGrad/5884dd.wgsl.expected.spvasm new file mode 100644 index 0000000000..cfe63ebfdc --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/5884dd.wgsl.expected.spvasm @@ -0,0 +1,98 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 52 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleGrad_5884dd "textureSampleGrad_5884dd" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %arg_4 "arg_4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 3D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %20 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %28 = OpTypeSampledImage %11 + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %35 = OpConstantNull %v3int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %38 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureSampleGrad_5884dd = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v3float Function %20 + %arg_3 = OpVariable %_ptr_Function_v3float Function %20 + %arg_4 = OpVariable %_ptr_Function_v3float Function %20 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_2 %20 + OpStore %arg_3 %20 + OpStore %arg_4 %20 + %26 = OpLoad %14 %arg_1 + %27 = OpLoad %11 %arg_0 + %29 = OpSampledImage %28 %27 %26 + %30 = OpLoad %v3float %arg_2 + %31 = OpLoad %v3float %arg_3 + %32 = OpLoad %v3float %arg_4 + %25 = OpImageSampleExplicitLod %v4float %29 %30 Grad|ConstOffset %31 %32 %35 + OpStore %res %25 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %38 + %40 = OpLabel + %41 = OpFunctionCall %void %textureSampleGrad_5884dd + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %43 = OpLabel + %44 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %44 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %47 = OpLabel + %48 = OpFunctionCall %void %textureSampleGrad_5884dd + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %50 = OpLabel + %51 = OpFunctionCall %void %textureSampleGrad_5884dd + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleGrad/5884dd.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleGrad/5884dd.wgsl.expected.wgsl new file mode 100644 index 0000000000..cc0659497c --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/5884dd.wgsl.expected.wgsl @@ -0,0 +1,26 @@ +@group(1) @binding(0) var arg_0 : texture_3d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleGrad_5884dd() { + var arg_2 = vec3(); + var arg_3 = vec3(); + var arg_4 = vec3(); + var res : vec4 = textureSampleGrad(arg_0, arg_1, arg_2, arg_3, arg_4, vec3()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleGrad_5884dd(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleGrad_5884dd(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleGrad_5884dd(); +} diff --git a/test/tint/builtins/gen/var/textureSampleGrad/d4e3c5.wgsl b/test/tint/builtins/gen/var/textureSampleGrad/d4e3c5.wgsl new file mode 100644 index 0000000000..6528fbf40a --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/d4e3c5.wgsl @@ -0,0 +1,50 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleGrad(texture: texture_2d, sampler: sampler, coords: vec2, ddx: vec2, ddy: vec2, @const offset: vec2) -> vec4 +fn textureSampleGrad_d4e3c5() { + var arg_2 = vec2(); + var arg_3 = vec2(); + var arg_4 = vec2(); + var res: vec4 = textureSampleGrad(arg_0, arg_1, arg_2, arg_3, arg_4, vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleGrad_d4e3c5(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleGrad_d4e3c5(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleGrad_d4e3c5(); +} diff --git a/test/tint/builtins/gen/var/textureSampleGrad/d4e3c5.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleGrad/d4e3c5.wgsl.expected.glsl new file mode 100644 index 0000000000..a772706f45 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/d4e3c5.wgsl.expected.glsl @@ -0,0 +1,64 @@ +#version 310 es + +uniform highp sampler2D arg_0_arg_1; + +void textureSampleGrad_d4e3c5() { + vec2 arg_2 = vec2(0.0f); + vec2 arg_3 = vec2(0.0f); + vec2 arg_4 = vec2(0.0f); + vec4 res = textureGradOffset(arg_0_arg_1, arg_2, arg_3, arg_4, ivec2(0)); +} + +vec4 vertex_main() { + textureSampleGrad_d4e3c5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2D arg_0_arg_1; + +void textureSampleGrad_d4e3c5() { + vec2 arg_2 = vec2(0.0f); + vec2 arg_3 = vec2(0.0f); + vec2 arg_4 = vec2(0.0f); + vec4 res = textureGradOffset(arg_0_arg_1, arg_2, arg_3, arg_4, ivec2(0)); +} + +void fragment_main() { + textureSampleGrad_d4e3c5(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2D arg_0_arg_1; + +void textureSampleGrad_d4e3c5() { + vec2 arg_2 = vec2(0.0f); + vec2 arg_3 = vec2(0.0f); + vec2 arg_4 = vec2(0.0f); + vec4 res = textureGradOffset(arg_0_arg_1, arg_2, arg_3, arg_4, ivec2(0)); +} + +void compute_main() { + textureSampleGrad_d4e3c5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleGrad/d4e3c5.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleGrad/d4e3c5.wgsl.expected.hlsl new file mode 100644 index 0000000000..203eca8fb1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/d4e3c5.wgsl.expected.hlsl @@ -0,0 +1,36 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleGrad_d4e3c5() { + float2 arg_2 = (0.0f).xx; + float2 arg_3 = (0.0f).xx; + float2 arg_4 = (0.0f).xx; + float4 res = arg_0.SampleGrad(arg_1, arg_2, arg_3, arg_4, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleGrad_d4e3c5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleGrad_d4e3c5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleGrad_d4e3c5(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleGrad/d4e3c5.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleGrad/d4e3c5.wgsl.expected.msl new file mode 100644 index 0000000000..166bab5879 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/d4e3c5.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureSampleGrad_d4e3c5(texture2d tint_symbol_1, sampler tint_symbol_2) { + float2 arg_2 = float2(0.0f); + float2 arg_3 = float2(0.0f); + float2 arg_4 = float2(0.0f); + float4 res = tint_symbol_1.sample(tint_symbol_2, arg_2, gradient2d(arg_3, arg_4), int2(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_3, sampler tint_symbol_4) { + textureSampleGrad_d4e3c5(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleGrad_d4e3c5(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleGrad_d4e3c5(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleGrad/d4e3c5.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleGrad/d4e3c5.wgsl.expected.spvasm new file mode 100644 index 0000000000..817905adcf --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/d4e3c5.wgsl.expected.spvasm @@ -0,0 +1,98 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 52 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleGrad_d4e3c5 "textureSampleGrad_d4e3c5" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %arg_4 "arg_4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %20 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %28 = OpTypeSampledImage %11 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %35 = OpConstantNull %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %38 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureSampleGrad_d4e3c5 = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %20 + %arg_3 = OpVariable %_ptr_Function_v2float Function %20 + %arg_4 = OpVariable %_ptr_Function_v2float Function %20 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_2 %20 + OpStore %arg_3 %20 + OpStore %arg_4 %20 + %26 = OpLoad %14 %arg_1 + %27 = OpLoad %11 %arg_0 + %29 = OpSampledImage %28 %27 %26 + %30 = OpLoad %v2float %arg_2 + %31 = OpLoad %v2float %arg_3 + %32 = OpLoad %v2float %arg_4 + %25 = OpImageSampleExplicitLod %v4float %29 %30 Grad|ConstOffset %31 %32 %35 + OpStore %res %25 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %38 + %40 = OpLabel + %41 = OpFunctionCall %void %textureSampleGrad_d4e3c5 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %43 = OpLabel + %44 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %44 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %47 = OpLabel + %48 = OpFunctionCall %void %textureSampleGrad_d4e3c5 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %50 = OpLabel + %51 = OpFunctionCall %void %textureSampleGrad_d4e3c5 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleGrad/d4e3c5.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleGrad/d4e3c5.wgsl.expected.wgsl new file mode 100644 index 0000000000..65b1b2d247 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/d4e3c5.wgsl.expected.wgsl @@ -0,0 +1,26 @@ +@group(1) @binding(0) var arg_0 : texture_2d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleGrad_d4e3c5() { + var arg_2 = vec2(); + var arg_3 = vec2(); + var arg_4 = vec2(); + var res : vec4 = textureSampleGrad(arg_0, arg_1, arg_2, arg_3, arg_4, vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleGrad_d4e3c5(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleGrad_d4e3c5(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleGrad_d4e3c5(); +} diff --git a/test/tint/builtins/gen/var/textureSampleGrad/d65515.wgsl b/test/tint/builtins/gen/var/textureSampleGrad/d65515.wgsl new file mode 100644 index 0000000000..5e91af750b --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/d65515.wgsl @@ -0,0 +1,51 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleGrad(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, ddx: vec2, ddy: vec2, @const offset: vec2) -> vec4 +fn textureSampleGrad_d65515() { + var arg_2 = vec2(); + var arg_3 = 1; + var arg_4 = vec2(); + var arg_5 = vec2(); + var res: vec4 = textureSampleGrad(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleGrad_d65515(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleGrad_d65515(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleGrad_d65515(); +} diff --git a/test/tint/builtins/gen/var/textureSampleGrad/d65515.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleGrad/d65515.wgsl.expected.glsl new file mode 100644 index 0000000000..31c47a2771 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/d65515.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es + +uniform highp sampler2DArray arg_0_arg_1; + +void textureSampleGrad_d65515() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + vec2 arg_4 = vec2(0.0f); + vec2 arg_5 = vec2(0.0f); + vec4 res = textureGradOffset(arg_0_arg_1, vec3(arg_2, float(arg_3)), arg_4, arg_5, ivec2(0)); +} + +vec4 vertex_main() { + textureSampleGrad_d65515(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DArray arg_0_arg_1; + +void textureSampleGrad_d65515() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + vec2 arg_4 = vec2(0.0f); + vec2 arg_5 = vec2(0.0f); + vec4 res = textureGradOffset(arg_0_arg_1, vec3(arg_2, float(arg_3)), arg_4, arg_5, ivec2(0)); +} + +void fragment_main() { + textureSampleGrad_d65515(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DArray arg_0_arg_1; + +void textureSampleGrad_d65515() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + vec2 arg_4 = vec2(0.0f); + vec2 arg_5 = vec2(0.0f); + vec4 res = textureGradOffset(arg_0_arg_1, vec3(arg_2, float(arg_3)), arg_4, arg_5, ivec2(0)); +} + +void compute_main() { + textureSampleGrad_d65515(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleGrad/d65515.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleGrad/d65515.wgsl.expected.hlsl new file mode 100644 index 0000000000..91e62c1e3a --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/d65515.wgsl.expected.hlsl @@ -0,0 +1,37 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleGrad_d65515() { + float2 arg_2 = (0.0f).xx; + int arg_3 = 1; + float2 arg_4 = (0.0f).xx; + float2 arg_5 = (0.0f).xx; + float4 res = arg_0.SampleGrad(arg_1, float3(arg_2, float(arg_3)), arg_4, arg_5, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleGrad_d65515(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleGrad_d65515(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleGrad_d65515(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleGrad/d65515.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleGrad/d65515.wgsl.expected.msl new file mode 100644 index 0000000000..ad234a07d2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/d65515.wgsl.expected.msl @@ -0,0 +1,37 @@ +#include + +using namespace metal; +void textureSampleGrad_d65515(texture2d_array tint_symbol_1, sampler tint_symbol_2) { + float2 arg_2 = float2(0.0f); + int arg_3 = 1; + float2 arg_4 = float2(0.0f); + float2 arg_5 = float2(0.0f); + float4 res = tint_symbol_1.sample(tint_symbol_2, arg_2, arg_3, gradient2d(arg_4, arg_5), int2(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_3, sampler tint_symbol_4) { + textureSampleGrad_d65515(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleGrad_d65515(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleGrad_d65515(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleGrad/d65515.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleGrad/d65515.wgsl.expected.spvasm new file mode 100644 index 0000000000..274c793254 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/d65515.wgsl.expected.spvasm @@ -0,0 +1,110 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 62 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleGrad_d65515 "textureSampleGrad_d65515" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %arg_4 "arg_4" + OpName %arg_5 "arg_5" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %20 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %27 = OpConstantNull %int + %33 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 + %v2int = OpTypeVector %int 2 + %45 = OpConstantNull %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %48 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureSampleGrad_d65515 = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %20 + %arg_3 = OpVariable %_ptr_Function_int Function %27 + %arg_4 = OpVariable %_ptr_Function_v2float Function %20 + %arg_5 = OpVariable %_ptr_Function_v2float Function %20 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_2 %20 + OpStore %arg_3 %int_1 + OpStore %arg_4 %20 + OpStore %arg_5 %20 + %31 = OpLoad %14 %arg_1 + %32 = OpLoad %11 %arg_0 + %34 = OpSampledImage %33 %32 %31 + %36 = OpLoad %v2float %arg_2 + %37 = OpCompositeExtract %float %36 0 + %38 = OpCompositeExtract %float %36 1 + %40 = OpLoad %int %arg_3 + %39 = OpConvertSToF %float %40 + %41 = OpCompositeConstruct %v3float %37 %38 %39 + %42 = OpLoad %v2float %arg_4 + %43 = OpLoad %v2float %arg_5 + %30 = OpImageSampleExplicitLod %v4float %34 %41 Grad|ConstOffset %42 %43 %45 + OpStore %res %30 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %48 + %50 = OpLabel + %51 = OpFunctionCall %void %textureSampleGrad_d65515 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %53 = OpLabel + %54 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %54 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %57 = OpLabel + %58 = OpFunctionCall %void %textureSampleGrad_d65515 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %60 = OpLabel + %61 = OpFunctionCall %void %textureSampleGrad_d65515 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleGrad/d65515.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleGrad/d65515.wgsl.expected.wgsl new file mode 100644 index 0000000000..b62881937e --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/d65515.wgsl.expected.wgsl @@ -0,0 +1,27 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleGrad_d65515() { + var arg_2 = vec2(); + var arg_3 = 1; + var arg_4 = vec2(); + var arg_5 = vec2(); + var res : vec4 = textureSampleGrad(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleGrad_d65515(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleGrad_d65515(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleGrad_d65515(); +} diff --git a/test/tint/builtins/gen/var/textureSampleGrad/e383db.wgsl b/test/tint/builtins/gen/var/textureSampleGrad/e383db.wgsl new file mode 100644 index 0000000000..a39b52250e --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/e383db.wgsl @@ -0,0 +1,51 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube_array; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleGrad(texture: texture_cube_array, sampler: sampler, coords: vec3, array_index: i32, ddx: vec3, ddy: vec3) -> vec4 +fn textureSampleGrad_e383db() { + var arg_2 = vec3(); + var arg_3 = 1; + var arg_4 = vec3(); + var arg_5 = vec3(); + var res: vec4 = textureSampleGrad(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleGrad_e383db(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleGrad_e383db(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleGrad_e383db(); +} diff --git a/test/tint/builtins/gen/var/textureSampleGrad/e383db.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleGrad/e383db.wgsl.expected.glsl new file mode 100644 index 0000000000..7e0c762254 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/e383db.wgsl.expected.glsl @@ -0,0 +1,90 @@ +SKIP: FAILED + +#version 310 es + +uniform highp samplerCubeArray arg_0_arg_1; + +void textureSampleGrad_e383db() { + vec3 arg_2 = vec3(0.0f); + int arg_3 = 1; + vec3 arg_4 = vec3(0.0f); + vec3 arg_5 = vec3(0.0f); + vec4 res = textureGrad(arg_0_arg_1, vec4(arg_2, float(arg_3)), arg_4, arg_5); +} + +vec4 vertex_main() { + textureSampleGrad_e383db(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp samplerCubeArray arg_0_arg_1; + +void textureSampleGrad_e383db() { + vec3 arg_2 = vec3(0.0f); + int arg_3 = 1; + vec3 arg_4 = vec3(0.0f); + vec3 arg_5 = vec3(0.0f); + vec4 res = textureGrad(arg_0_arg_1, vec4(arg_2, float(arg_3)), arg_4, arg_5); +} + +void fragment_main() { + textureSampleGrad_e383db(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'samplerCubeArray' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp samplerCubeArray arg_0_arg_1; + +void textureSampleGrad_e383db() { + vec3 arg_2 = vec3(0.0f); + int arg_3 = 1; + vec3 arg_4 = vec3(0.0f); + vec3 arg_5 = vec3(0.0f); + vec4 res = textureGrad(arg_0_arg_1, vec4(arg_2, float(arg_3)), arg_4, arg_5); +} + +void compute_main() { + textureSampleGrad_e383db(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureSampleGrad/e383db.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleGrad/e383db.wgsl.expected.hlsl new file mode 100644 index 0000000000..1f111fbf1a --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/e383db.wgsl.expected.hlsl @@ -0,0 +1,37 @@ +TextureCubeArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleGrad_e383db() { + float3 arg_2 = (0.0f).xxx; + int arg_3 = 1; + float3 arg_4 = (0.0f).xxx; + float3 arg_5 = (0.0f).xxx; + float4 res = arg_0.SampleGrad(arg_1, float4(arg_2, float(arg_3)), arg_4, arg_5); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleGrad_e383db(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleGrad_e383db(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleGrad_e383db(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleGrad/e383db.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleGrad/e383db.wgsl.expected.msl new file mode 100644 index 0000000000..e452422810 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/e383db.wgsl.expected.msl @@ -0,0 +1,37 @@ +#include + +using namespace metal; +void textureSampleGrad_e383db(texturecube_array tint_symbol_1, sampler tint_symbol_2) { + float3 arg_2 = float3(0.0f); + int arg_3 = 1; + float3 arg_4 = float3(0.0f); + float3 arg_5 = float3(0.0f); + float4 res = tint_symbol_1.sample(tint_symbol_2, arg_2, arg_3, gradientcube(arg_4, arg_5)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube_array tint_symbol_3, sampler tint_symbol_4) { + textureSampleGrad_e383db(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleGrad_e383db(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texturecube_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleGrad_e383db(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleGrad/e383db.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleGrad/e383db.wgsl.expected.spvasm new file mode 100644 index 0000000000..b63df46741 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/e383db.wgsl.expected.spvasm @@ -0,0 +1,109 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 60 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleGrad_e383db "textureSampleGrad_e383db" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %arg_4 "arg_4" + OpName %arg_5 "arg_5" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %20 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %27 = OpConstantNull %int + %33 = OpTypeSampledImage %11 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %46 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureSampleGrad_e383db = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v3float Function %20 + %arg_3 = OpVariable %_ptr_Function_int Function %27 + %arg_4 = OpVariable %_ptr_Function_v3float Function %20 + %arg_5 = OpVariable %_ptr_Function_v3float Function %20 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_2 %20 + OpStore %arg_3 %int_1 + OpStore %arg_4 %20 + OpStore %arg_5 %20 + %31 = OpLoad %14 %arg_1 + %32 = OpLoad %11 %arg_0 + %34 = OpSampledImage %33 %32 %31 + %35 = OpLoad %v3float %arg_2 + %36 = OpCompositeExtract %float %35 0 + %37 = OpCompositeExtract %float %35 1 + %38 = OpCompositeExtract %float %35 2 + %40 = OpLoad %int %arg_3 + %39 = OpConvertSToF %float %40 + %41 = OpCompositeConstruct %v4float %36 %37 %38 %39 + %42 = OpLoad %v3float %arg_4 + %43 = OpLoad %v3float %arg_5 + %30 = OpImageSampleExplicitLod %v4float %34 %41 Grad %42 %43 + OpStore %res %30 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %46 + %48 = OpLabel + %49 = OpFunctionCall %void %textureSampleGrad_e383db + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %51 = OpLabel + %52 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %52 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %55 = OpLabel + %56 = OpFunctionCall %void %textureSampleGrad_e383db + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %58 = OpLabel + %59 = OpFunctionCall %void %textureSampleGrad_e383db + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleGrad/e383db.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleGrad/e383db.wgsl.expected.wgsl new file mode 100644 index 0000000000..0085daffd3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/e383db.wgsl.expected.wgsl @@ -0,0 +1,27 @@ +@group(1) @binding(0) var arg_0 : texture_cube_array; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleGrad_e383db() { + var arg_2 = vec3(); + var arg_3 = 1; + var arg_4 = vec3(); + var arg_5 = vec3(); + var res : vec4 = textureSampleGrad(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleGrad_e383db(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleGrad_e383db(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleGrad_e383db(); +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/02be59.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/02be59.wgsl new file mode 100644 index 0000000000..04c34b704d --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/02be59.wgsl @@ -0,0 +1,49 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleLevel(texture: texture_depth_2d, sampler: sampler, coords: vec2, level: i32) -> f32 +fn textureSampleLevel_02be59() { + var arg_2 = vec2(); + var arg_3 = 0; + var res: f32 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_02be59(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleLevel_02be59(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleLevel_02be59(); +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/02be59.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleLevel/02be59.wgsl.expected.glsl new file mode 100644 index 0000000000..eb71fe0465 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/02be59.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureSampleLevel_02be59() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 0; + float res = textureLod(arg_0_arg_1, vec3(arg_2, 0.0f), float(arg_3)); +} + +vec4 vertex_main() { + textureSampleLevel_02be59(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureSampleLevel_02be59() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 0; + float res = textureLod(arg_0_arg_1, vec3(arg_2, 0.0f), float(arg_3)); +} + +void fragment_main() { + textureSampleLevel_02be59(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureSampleLevel_02be59() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 0; + float res = textureLod(arg_0_arg_1, vec3(arg_2, 0.0f), float(arg_3)); +} + +void compute_main() { + textureSampleLevel_02be59(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/02be59.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/02be59.wgsl.expected.hlsl new file mode 100644 index 0000000000..fd23cee6f9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/02be59.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_02be59() { + float2 arg_2 = (0.0f).xx; + int arg_3 = 0; + float res = arg_0.SampleLevel(arg_1, arg_2, arg_3).x; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_02be59(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_02be59(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_02be59(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/02be59.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleLevel/02be59.wgsl.expected.msl new file mode 100644 index 0000000000..8aa0c8550b --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/02be59.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureSampleLevel_02be59(depth2d tint_symbol_1, sampler tint_symbol_2) { + float2 arg_2 = float2(0.0f); + int arg_3 = 0; + float res = tint_symbol_1.sample(tint_symbol_2, arg_2, level(arg_3)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d tint_symbol_3, sampler tint_symbol_4) { + textureSampleLevel_02be59(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleLevel_02be59(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depth2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleLevel_02be59(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleLevel/02be59.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleLevel/02be59.wgsl.expected.spvasm new file mode 100644 index 0000000000..4d1fcc2fa6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/02be59.wgsl.expected.spvasm @@ -0,0 +1,96 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 52 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleLevel_02be59 "textureSampleLevel_02be59" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %20 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %int = OpTypeInt 32 1 + %24 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %31 = OpTypeSampledImage %11 +%_ptr_Function_float = OpTypePointer Function %float + %38 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureSampleLevel_02be59 = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %20 + %arg_3 = OpVariable %_ptr_Function_int Function %24 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_2 %20 + OpStore %arg_3 %24 + %29 = OpLoad %14 %arg_1 + %30 = OpLoad %11 %arg_0 + %32 = OpSampledImage %31 %30 %29 + %33 = OpLoad %v2float %arg_2 + %35 = OpLoad %int %arg_3 + %34 = OpConvertSToF %float %35 + %28 = OpImageSampleExplicitLod %v4float %32 %33 Lod %34 + %27 = OpCompositeExtract %float %28 0 + OpStore %res %27 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %38 + %40 = OpLabel + %41 = OpFunctionCall %void %textureSampleLevel_02be59 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %43 = OpLabel + %44 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %44 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %47 = OpLabel + %48 = OpFunctionCall %void %textureSampleLevel_02be59 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %50 = OpLabel + %51 = OpFunctionCall %void %textureSampleLevel_02be59 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleLevel/02be59.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/02be59.wgsl.expected.wgsl new file mode 100644 index 0000000000..22ba96499a --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/02be59.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleLevel_02be59() { + var arg_2 = vec2(); + var arg_3 = 0; + var res : f32 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_02be59(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleLevel_02be59(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleLevel_02be59(); +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/0b0a1b.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/0b0a1b.wgsl new file mode 100644 index 0000000000..f73b6b70f5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/0b0a1b.wgsl @@ -0,0 +1,49 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleLevel(texture: texture_2d, sampler: sampler, coords: vec2, level: f32, @const offset: vec2) -> vec4 +fn textureSampleLevel_0b0a1b() { + var arg_2 = vec2(); + var arg_3 = 1.0; + var res: vec4 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3, vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_0b0a1b(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleLevel_0b0a1b(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleLevel_0b0a1b(); +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/0b0a1b.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleLevel/0b0a1b.wgsl.expected.glsl new file mode 100644 index 0000000000..156234643e --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/0b0a1b.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +uniform highp sampler2D arg_0_arg_1; + +void textureSampleLevel_0b0a1b() { + vec2 arg_2 = vec2(0.0f); + float arg_3 = 1.0f; + vec4 res = textureLodOffset(arg_0_arg_1, arg_2, arg_3, ivec2(0)); +} + +vec4 vertex_main() { + textureSampleLevel_0b0a1b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2D arg_0_arg_1; + +void textureSampleLevel_0b0a1b() { + vec2 arg_2 = vec2(0.0f); + float arg_3 = 1.0f; + vec4 res = textureLodOffset(arg_0_arg_1, arg_2, arg_3, ivec2(0)); +} + +void fragment_main() { + textureSampleLevel_0b0a1b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2D arg_0_arg_1; + +void textureSampleLevel_0b0a1b() { + vec2 arg_2 = vec2(0.0f); + float arg_3 = 1.0f; + vec4 res = textureLodOffset(arg_0_arg_1, arg_2, arg_3, ivec2(0)); +} + +void compute_main() { + textureSampleLevel_0b0a1b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/0b0a1b.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/0b0a1b.wgsl.expected.hlsl new file mode 100644 index 0000000000..d57bb5e533 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/0b0a1b.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_0b0a1b() { + float2 arg_2 = (0.0f).xx; + float arg_3 = 1.0f; + float4 res = arg_0.SampleLevel(arg_1, arg_2, arg_3, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_0b0a1b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_0b0a1b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_0b0a1b(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/0b0a1b.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleLevel/0b0a1b.wgsl.expected.msl new file mode 100644 index 0000000000..5aec41a85d --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/0b0a1b.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureSampleLevel_0b0a1b(texture2d tint_symbol_1, sampler tint_symbol_2) { + float2 arg_2 = float2(0.0f); + float arg_3 = 1.0f; + float4 res = tint_symbol_1.sample(tint_symbol_2, arg_2, level(arg_3), int2(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_3, sampler tint_symbol_4) { + textureSampleLevel_0b0a1b(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleLevel_0b0a1b(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleLevel_0b0a1b(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleLevel/0b0a1b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleLevel/0b0a1b.wgsl.expected.spvasm new file mode 100644 index 0000000000..128e2c99f0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/0b0a1b.wgsl.expected.spvasm @@ -0,0 +1,95 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 51 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleLevel_0b0a1b "textureSampleLevel_0b0a1b" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %20 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %29 = OpTypeSampledImage %11 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %35 = OpConstantNull %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %38 = OpTypeFunction %v4float +%textureSampleLevel_0b0a1b = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %20 + %arg_3 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_2 %20 + OpStore %arg_3 %float_1 + %27 = OpLoad %14 %arg_1 + %28 = OpLoad %11 %arg_0 + %30 = OpSampledImage %29 %28 %27 + %31 = OpLoad %v2float %arg_2 + %32 = OpLoad %float %arg_3 + %26 = OpImageSampleExplicitLod %v4float %30 %31 Lod|ConstOffset %32 %35 + OpStore %res %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %38 + %40 = OpLabel + %41 = OpFunctionCall %void %textureSampleLevel_0b0a1b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %43 = OpLabel + %44 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %44 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %46 = OpLabel + %47 = OpFunctionCall %void %textureSampleLevel_0b0a1b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %49 = OpLabel + %50 = OpFunctionCall %void %textureSampleLevel_0b0a1b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleLevel/0b0a1b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/0b0a1b.wgsl.expected.wgsl new file mode 100644 index 0000000000..4924f7f1e6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/0b0a1b.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +@group(1) @binding(0) var arg_0 : texture_2d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleLevel_0b0a1b() { + var arg_2 = vec2(); + var arg_3 = 1.0; + var res : vec4 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3, vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_0b0a1b(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleLevel_0b0a1b(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleLevel_0b0a1b(); +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/0bdd9a.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/0bdd9a.wgsl new file mode 100644 index 0000000000..098737a5eb --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/0bdd9a.wgsl @@ -0,0 +1,50 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube_array; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleLevel(texture: texture_cube_array, sampler: sampler, coords: vec3, array_index: i32, level: f32) -> vec4 +fn textureSampleLevel_0bdd9a() { + var arg_2 = vec3(); + var arg_3 = 1; + var arg_4 = 1.0; + var res: vec4 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3, arg_4); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_0bdd9a(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleLevel_0bdd9a(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleLevel_0bdd9a(); +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/0bdd9a.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleLevel/0bdd9a.wgsl.expected.glsl new file mode 100644 index 0000000000..5cff227c6b --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/0bdd9a.wgsl.expected.glsl @@ -0,0 +1,87 @@ +SKIP: FAILED + +#version 310 es + +uniform highp samplerCubeArray arg_0_arg_1; + +void textureSampleLevel_0bdd9a() { + vec3 arg_2 = vec3(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + vec4 res = textureLod(arg_0_arg_1, vec4(arg_2, float(arg_3)), arg_4); +} + +vec4 vertex_main() { + textureSampleLevel_0bdd9a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp samplerCubeArray arg_0_arg_1; + +void textureSampleLevel_0bdd9a() { + vec3 arg_2 = vec3(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + vec4 res = textureLod(arg_0_arg_1, vec4(arg_2, float(arg_3)), arg_4); +} + +void fragment_main() { + textureSampleLevel_0bdd9a(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'samplerCubeArray' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp samplerCubeArray arg_0_arg_1; + +void textureSampleLevel_0bdd9a() { + vec3 arg_2 = vec3(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + vec4 res = textureLod(arg_0_arg_1, vec4(arg_2, float(arg_3)), arg_4); +} + +void compute_main() { + textureSampleLevel_0bdd9a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureSampleLevel/0bdd9a.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/0bdd9a.wgsl.expected.hlsl new file mode 100644 index 0000000000..fd1c612315 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/0bdd9a.wgsl.expected.hlsl @@ -0,0 +1,36 @@ +TextureCubeArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_0bdd9a() { + float3 arg_2 = (0.0f).xxx; + int arg_3 = 1; + float arg_4 = 1.0f; + float4 res = arg_0.SampleLevel(arg_1, float4(arg_2, float(arg_3)), arg_4); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_0bdd9a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_0bdd9a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_0bdd9a(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/0bdd9a.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleLevel/0bdd9a.wgsl.expected.msl new file mode 100644 index 0000000000..1a157e0443 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/0bdd9a.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureSampleLevel_0bdd9a(texturecube_array tint_symbol_1, sampler tint_symbol_2) { + float3 arg_2 = float3(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + float4 res = tint_symbol_1.sample(tint_symbol_2, arg_2, arg_3, level(arg_4)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube_array tint_symbol_3, sampler tint_symbol_4) { + textureSampleLevel_0bdd9a(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleLevel_0bdd9a(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texturecube_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleLevel_0bdd9a(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleLevel/0bdd9a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleLevel/0bdd9a.wgsl.expected.spvasm new file mode 100644 index 0000000000..31adb35595 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/0bdd9a.wgsl.expected.spvasm @@ -0,0 +1,106 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 59 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleLevel_0bdd9a "textureSampleLevel_0bdd9a" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %arg_4 "arg_4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %20 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %27 = OpConstantNull %int + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %34 = OpTypeSampledImage %11 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %46 = OpTypeFunction %v4float +%textureSampleLevel_0bdd9a = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v3float Function %20 + %arg_3 = OpVariable %_ptr_Function_int Function %27 + %arg_4 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_2 %20 + OpStore %arg_3 %int_1 + OpStore %arg_4 %float_1 + %32 = OpLoad %14 %arg_1 + %33 = OpLoad %11 %arg_0 + %35 = OpSampledImage %34 %33 %32 + %36 = OpLoad %v3float %arg_2 + %37 = OpCompositeExtract %float %36 0 + %38 = OpCompositeExtract %float %36 1 + %39 = OpCompositeExtract %float %36 2 + %41 = OpLoad %int %arg_3 + %40 = OpConvertSToF %float %41 + %42 = OpCompositeConstruct %v4float %37 %38 %39 %40 + %43 = OpLoad %float %arg_4 + %31 = OpImageSampleExplicitLod %v4float %35 %42 Lod %43 + OpStore %res %31 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %46 + %48 = OpLabel + %49 = OpFunctionCall %void %textureSampleLevel_0bdd9a + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %51 = OpLabel + %52 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %52 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %54 = OpLabel + %55 = OpFunctionCall %void %textureSampleLevel_0bdd9a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %57 = OpLabel + %58 = OpFunctionCall %void %textureSampleLevel_0bdd9a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleLevel/0bdd9a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/0bdd9a.wgsl.expected.wgsl new file mode 100644 index 0000000000..39434a16f6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/0bdd9a.wgsl.expected.wgsl @@ -0,0 +1,26 @@ +@group(1) @binding(0) var arg_0 : texture_cube_array; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleLevel_0bdd9a() { + var arg_2 = vec3(); + var arg_3 = 1; + var arg_4 = 1.0; + var res : vec4 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3, arg_4); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_0bdd9a(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleLevel_0bdd9a(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleLevel_0bdd9a(); +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/1b0291.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/1b0291.wgsl new file mode 100644 index 0000000000..db67e3ca4b --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/1b0291.wgsl @@ -0,0 +1,49 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_cube; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleLevel(texture: texture_depth_cube, sampler: sampler, coords: vec3, level: i32) -> f32 +fn textureSampleLevel_1b0291() { + var arg_2 = vec3(); + var arg_3 = 0; + var res: f32 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_1b0291(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleLevel_1b0291(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleLevel_1b0291(); +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/1b0291.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleLevel/1b0291.wgsl.expected.glsl new file mode 100644 index 0000000000..19d3183e63 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/1b0291.wgsl.expected.glsl @@ -0,0 +1,84 @@ +SKIP: FAILED + +#version 310 es + +uniform highp samplerCubeShadow arg_0_arg_1; + +void textureSampleLevel_1b0291() { + vec3 arg_2 = vec3(0.0f); + int arg_3 = 0; + float res = textureLod(arg_0_arg_1, vec4(arg_2, 0.0f), float(arg_3)); +} + +vec4 vertex_main() { + textureSampleLevel_1b0291(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:8: 'textureLod' : no matching overloaded function found +ERROR: 0:8: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp samplerCubeShadow arg_0_arg_1; + +void textureSampleLevel_1b0291() { + vec3 arg_2 = vec3(0.0f); + int arg_3 = 0; + float res = textureLod(arg_0_arg_1, vec4(arg_2, 0.0f), float(arg_3)); +} + +void fragment_main() { + textureSampleLevel_1b0291(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:9: 'textureLod' : no matching overloaded function found +ERROR: 0:9: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp samplerCubeShadow arg_0_arg_1; + +void textureSampleLevel_1b0291() { + vec3 arg_2 = vec3(0.0f); + int arg_3 = 0; + float res = textureLod(arg_0_arg_1, vec4(arg_2, 0.0f), float(arg_3)); +} + +void compute_main() { + textureSampleLevel_1b0291(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:8: 'textureLod' : no matching overloaded function found +ERROR: 0:8: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureSampleLevel/1b0291.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/1b0291.wgsl.expected.hlsl new file mode 100644 index 0000000000..db87195d36 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/1b0291.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +TextureCube arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_1b0291() { + float3 arg_2 = (0.0f).xxx; + int arg_3 = 0; + float res = arg_0.SampleLevel(arg_1, arg_2, arg_3).x; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_1b0291(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_1b0291(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_1b0291(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/1b0291.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleLevel/1b0291.wgsl.expected.msl new file mode 100644 index 0000000000..6da05d0d63 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/1b0291.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureSampleLevel_1b0291(depthcube tint_symbol_1, sampler tint_symbol_2) { + float3 arg_2 = float3(0.0f); + int arg_3 = 0; + float res = tint_symbol_1.sample(tint_symbol_2, arg_2, level(arg_3)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depthcube tint_symbol_3, sampler tint_symbol_4) { + textureSampleLevel_1b0291(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depthcube tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depthcube tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleLevel_1b0291(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depthcube tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleLevel_1b0291(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleLevel/1b0291.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleLevel/1b0291.wgsl.expected.spvasm new file mode 100644 index 0000000000..89a2e52bfa --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/1b0291.wgsl.expected.spvasm @@ -0,0 +1,96 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 52 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleLevel_1b0291 "textureSampleLevel_1b0291" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float Cube 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %20 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %int = OpTypeInt 32 1 + %24 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %31 = OpTypeSampledImage %11 +%_ptr_Function_float = OpTypePointer Function %float + %38 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureSampleLevel_1b0291 = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v3float Function %20 + %arg_3 = OpVariable %_ptr_Function_int Function %24 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_2 %20 + OpStore %arg_3 %24 + %29 = OpLoad %14 %arg_1 + %30 = OpLoad %11 %arg_0 + %32 = OpSampledImage %31 %30 %29 + %33 = OpLoad %v3float %arg_2 + %35 = OpLoad %int %arg_3 + %34 = OpConvertSToF %float %35 + %28 = OpImageSampleExplicitLod %v4float %32 %33 Lod %34 + %27 = OpCompositeExtract %float %28 0 + OpStore %res %27 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %38 + %40 = OpLabel + %41 = OpFunctionCall %void %textureSampleLevel_1b0291 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %43 = OpLabel + %44 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %44 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %47 = OpLabel + %48 = OpFunctionCall %void %textureSampleLevel_1b0291 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %50 = OpLabel + %51 = OpFunctionCall %void %textureSampleLevel_1b0291 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleLevel/1b0291.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/1b0291.wgsl.expected.wgsl new file mode 100644 index 0000000000..8a2bf5cb54 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/1b0291.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +@group(1) @binding(0) var arg_0 : texture_depth_cube; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleLevel_1b0291() { + var arg_2 = vec3(); + var arg_3 = 0; + var res : f32 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_1b0291(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleLevel_1b0291(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleLevel_1b0291(); +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/1bf73e.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/1bf73e.wgsl new file mode 100644 index 0000000000..673604dfec --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/1bf73e.wgsl @@ -0,0 +1,50 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d_array; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleLevel(texture: texture_depth_2d_array, sampler: sampler, coords: vec2, array_index: i32, level: i32) -> f32 +fn textureSampleLevel_1bf73e() { + var arg_2 = vec2(); + var arg_3 = 1; + var arg_4 = 0; + var res: f32 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3, arg_4); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_1bf73e(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleLevel_1bf73e(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleLevel_1bf73e(); +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/1bf73e.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleLevel/1bf73e.wgsl.expected.glsl new file mode 100644 index 0000000000..910156b507 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/1bf73e.wgsl.expected.glsl @@ -0,0 +1,87 @@ +SKIP: FAILED + +#version 310 es + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureSampleLevel_1bf73e() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + int arg_4 = 0; + float res = textureLod(arg_0_arg_1, vec4(vec3(arg_2, float(arg_3)), 0.0f), float(arg_4)); +} + +vec4 vertex_main() { + textureSampleLevel_1bf73e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:9: 'textureLod' : no matching overloaded function found +ERROR: 0:9: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureSampleLevel_1bf73e() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + int arg_4 = 0; + float res = textureLod(arg_0_arg_1, vec4(vec3(arg_2, float(arg_3)), 0.0f), float(arg_4)); +} + +void fragment_main() { + textureSampleLevel_1bf73e(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:10: 'textureLod' : no matching overloaded function found +ERROR: 0:10: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureSampleLevel_1bf73e() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + int arg_4 = 0; + float res = textureLod(arg_0_arg_1, vec4(vec3(arg_2, float(arg_3)), 0.0f), float(arg_4)); +} + +void compute_main() { + textureSampleLevel_1bf73e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:9: 'textureLod' : no matching overloaded function found +ERROR: 0:9: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureSampleLevel/1bf73e.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/1bf73e.wgsl.expected.hlsl new file mode 100644 index 0000000000..7f04b03a14 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/1bf73e.wgsl.expected.hlsl @@ -0,0 +1,36 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_1bf73e() { + float2 arg_2 = (0.0f).xx; + int arg_3 = 1; + int arg_4 = 0; + float res = arg_0.SampleLevel(arg_1, float3(arg_2, float(arg_3)), arg_4).x; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_1bf73e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_1bf73e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_1bf73e(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/1bf73e.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleLevel/1bf73e.wgsl.expected.msl new file mode 100644 index 0000000000..672e629841 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/1bf73e.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureSampleLevel_1bf73e(depth2d_array tint_symbol_1, sampler tint_symbol_2) { + float2 arg_2 = float2(0.0f); + int arg_3 = 1; + int arg_4 = 0; + float res = tint_symbol_1.sample(tint_symbol_2, arg_2, arg_3, level(arg_4)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d_array tint_symbol_3, sampler tint_symbol_4) { + textureSampleLevel_1bf73e(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleLevel_1bf73e(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depth2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleLevel_1bf73e(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleLevel/1bf73e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleLevel/1bf73e.wgsl.expected.spvasm new file mode 100644 index 0000000000..e19fd5b69e --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/1bf73e.wgsl.expected.spvasm @@ -0,0 +1,106 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 60 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleLevel_1bf73e "textureSampleLevel_1bf73e" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %arg_4 "arg_4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %20 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %27 = OpConstantNull %int + %33 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 +%_ptr_Function_float = OpTypePointer Function %float + %46 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureSampleLevel_1bf73e = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %20 + %arg_3 = OpVariable %_ptr_Function_int Function %27 + %arg_4 = OpVariable %_ptr_Function_int Function %27 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_2 %20 + OpStore %arg_3 %int_1 + OpStore %arg_4 %27 + %31 = OpLoad %14 %arg_1 + %32 = OpLoad %11 %arg_0 + %34 = OpSampledImage %33 %32 %31 + %36 = OpLoad %v2float %arg_2 + %37 = OpCompositeExtract %float %36 0 + %38 = OpCompositeExtract %float %36 1 + %40 = OpLoad %int %arg_3 + %39 = OpConvertSToF %float %40 + %41 = OpCompositeConstruct %v3float %37 %38 %39 + %43 = OpLoad %int %arg_4 + %42 = OpConvertSToF %float %43 + %30 = OpImageSampleExplicitLod %v4float %34 %41 Lod %42 + %29 = OpCompositeExtract %float %30 0 + OpStore %res %29 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %46 + %48 = OpLabel + %49 = OpFunctionCall %void %textureSampleLevel_1bf73e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %51 = OpLabel + %52 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %52 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %55 = OpLabel + %56 = OpFunctionCall %void %textureSampleLevel_1bf73e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %58 = OpLabel + %59 = OpFunctionCall %void %textureSampleLevel_1bf73e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleLevel/1bf73e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/1bf73e.wgsl.expected.wgsl new file mode 100644 index 0000000000..26332ba5fa --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/1bf73e.wgsl.expected.wgsl @@ -0,0 +1,26 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d_array; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleLevel_1bf73e() { + var arg_2 = vec2(); + var arg_3 = 1; + var arg_4 = 0; + var res : f32 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3, arg_4); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_1bf73e(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleLevel_1bf73e(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleLevel_1bf73e(); +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/302be4.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/302be4.wgsl new file mode 100644 index 0000000000..5797dbca60 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/302be4.wgsl @@ -0,0 +1,50 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleLevel(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, level: f32) -> vec4 +fn textureSampleLevel_302be4() { + var arg_2 = vec2(); + var arg_3 = 1; + var arg_4 = 1.0; + var res: vec4 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3, arg_4); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_302be4(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleLevel_302be4(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleLevel_302be4(); +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/302be4.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleLevel/302be4.wgsl.expected.glsl new file mode 100644 index 0000000000..faded30067 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/302be4.wgsl.expected.glsl @@ -0,0 +1,64 @@ +#version 310 es + +uniform highp sampler2DArray arg_0_arg_1; + +void textureSampleLevel_302be4() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + vec4 res = textureLod(arg_0_arg_1, vec3(arg_2, float(arg_3)), arg_4); +} + +vec4 vertex_main() { + textureSampleLevel_302be4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DArray arg_0_arg_1; + +void textureSampleLevel_302be4() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + vec4 res = textureLod(arg_0_arg_1, vec3(arg_2, float(arg_3)), arg_4); +} + +void fragment_main() { + textureSampleLevel_302be4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DArray arg_0_arg_1; + +void textureSampleLevel_302be4() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + vec4 res = textureLod(arg_0_arg_1, vec3(arg_2, float(arg_3)), arg_4); +} + +void compute_main() { + textureSampleLevel_302be4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/302be4.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/302be4.wgsl.expected.hlsl new file mode 100644 index 0000000000..997a9e9d52 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/302be4.wgsl.expected.hlsl @@ -0,0 +1,36 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_302be4() { + float2 arg_2 = (0.0f).xx; + int arg_3 = 1; + float arg_4 = 1.0f; + float4 res = arg_0.SampleLevel(arg_1, float3(arg_2, float(arg_3)), arg_4); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_302be4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_302be4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_302be4(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/302be4.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleLevel/302be4.wgsl.expected.msl new file mode 100644 index 0000000000..ec288702ac --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/302be4.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureSampleLevel_302be4(texture2d_array tint_symbol_1, sampler tint_symbol_2) { + float2 arg_2 = float2(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + float4 res = tint_symbol_1.sample(tint_symbol_2, arg_2, arg_3, level(arg_4)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_3, sampler tint_symbol_4) { + textureSampleLevel_302be4(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleLevel_302be4(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleLevel_302be4(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleLevel/302be4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleLevel/302be4.wgsl.expected.spvasm new file mode 100644 index 0000000000..bebc87fe92 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/302be4.wgsl.expected.spvasm @@ -0,0 +1,105 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 59 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleLevel_302be4 "textureSampleLevel_302be4" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %arg_4 "arg_4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %20 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %27 = OpConstantNull %int + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %34 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %46 = OpTypeFunction %v4float +%textureSampleLevel_302be4 = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %20 + %arg_3 = OpVariable %_ptr_Function_int Function %27 + %arg_4 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_2 %20 + OpStore %arg_3 %int_1 + OpStore %arg_4 %float_1 + %32 = OpLoad %14 %arg_1 + %33 = OpLoad %11 %arg_0 + %35 = OpSampledImage %34 %33 %32 + %37 = OpLoad %v2float %arg_2 + %38 = OpCompositeExtract %float %37 0 + %39 = OpCompositeExtract %float %37 1 + %41 = OpLoad %int %arg_3 + %40 = OpConvertSToF %float %41 + %42 = OpCompositeConstruct %v3float %38 %39 %40 + %43 = OpLoad %float %arg_4 + %31 = OpImageSampleExplicitLod %v4float %35 %42 Lod %43 + OpStore %res %31 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %46 + %48 = OpLabel + %49 = OpFunctionCall %void %textureSampleLevel_302be4 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %51 = OpLabel + %52 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %52 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %54 = OpLabel + %55 = OpFunctionCall %void %textureSampleLevel_302be4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %57 = OpLabel + %58 = OpFunctionCall %void %textureSampleLevel_302be4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleLevel/302be4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/302be4.wgsl.expected.wgsl new file mode 100644 index 0000000000..a31a4bc659 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/302be4.wgsl.expected.wgsl @@ -0,0 +1,26 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleLevel_302be4() { + var arg_2 = vec2(); + var arg_3 = 1; + var arg_4 = 1.0; + var res : vec4 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3, arg_4); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_302be4(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleLevel_302be4(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleLevel_302be4(); +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/36780e.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/36780e.wgsl new file mode 100644 index 0000000000..5069204f1b --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/36780e.wgsl @@ -0,0 +1,50 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d_array; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleLevel(texture: texture_depth_2d_array, sampler: sampler, coords: vec2, array_index: i32, level: i32, @const offset: vec2) -> f32 +fn textureSampleLevel_36780e() { + var arg_2 = vec2(); + var arg_3 = 1; + var arg_4 = 0; + var res: f32 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3, arg_4, vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_36780e(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleLevel_36780e(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleLevel_36780e(); +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/36780e.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleLevel/36780e.wgsl.expected.glsl new file mode 100644 index 0000000000..643f052d7e --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/36780e.wgsl.expected.glsl @@ -0,0 +1,87 @@ +SKIP: FAILED + +#version 310 es + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureSampleLevel_36780e() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + int arg_4 = 0; + float res = textureLodOffset(arg_0_arg_1, vec4(vec3(arg_2, float(arg_3)), 0.0f), float(arg_4), ivec2(0)); +} + +vec4 vertex_main() { + textureSampleLevel_36780e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:9: 'textureLodOffset' : no matching overloaded function found +ERROR: 0:9: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureSampleLevel_36780e() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + int arg_4 = 0; + float res = textureLodOffset(arg_0_arg_1, vec4(vec3(arg_2, float(arg_3)), 0.0f), float(arg_4), ivec2(0)); +} + +void fragment_main() { + textureSampleLevel_36780e(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:10: 'textureLodOffset' : no matching overloaded function found +ERROR: 0:10: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureSampleLevel_36780e() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + int arg_4 = 0; + float res = textureLodOffset(arg_0_arg_1, vec4(vec3(arg_2, float(arg_3)), 0.0f), float(arg_4), ivec2(0)); +} + +void compute_main() { + textureSampleLevel_36780e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:9: 'textureLodOffset' : no matching overloaded function found +ERROR: 0:9: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureSampleLevel/36780e.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/36780e.wgsl.expected.hlsl new file mode 100644 index 0000000000..419b8c9a18 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/36780e.wgsl.expected.hlsl @@ -0,0 +1,36 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_36780e() { + float2 arg_2 = (0.0f).xx; + int arg_3 = 1; + int arg_4 = 0; + float res = arg_0.SampleLevel(arg_1, float3(arg_2, float(arg_3)), arg_4, (0).xx).x; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_36780e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_36780e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_36780e(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/36780e.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleLevel/36780e.wgsl.expected.msl new file mode 100644 index 0000000000..8c15da14c8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/36780e.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureSampleLevel_36780e(depth2d_array tint_symbol_1, sampler tint_symbol_2) { + float2 arg_2 = float2(0.0f); + int arg_3 = 1; + int arg_4 = 0; + float res = tint_symbol_1.sample(tint_symbol_2, arg_2, arg_3, level(arg_4), int2(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d_array tint_symbol_3, sampler tint_symbol_4) { + textureSampleLevel_36780e(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleLevel_36780e(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depth2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleLevel_36780e(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleLevel/36780e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleLevel/36780e.wgsl.expected.spvasm new file mode 100644 index 0000000000..cd86de3942 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/36780e.wgsl.expected.spvasm @@ -0,0 +1,108 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 62 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleLevel_36780e "textureSampleLevel_36780e" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %arg_4 "arg_4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %20 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %27 = OpConstantNull %int + %33 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 + %v2int = OpTypeVector %int 2 + %45 = OpConstantNull %v2int +%_ptr_Function_float = OpTypePointer Function %float + %48 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureSampleLevel_36780e = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %20 + %arg_3 = OpVariable %_ptr_Function_int Function %27 + %arg_4 = OpVariable %_ptr_Function_int Function %27 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_2 %20 + OpStore %arg_3 %int_1 + OpStore %arg_4 %27 + %31 = OpLoad %14 %arg_1 + %32 = OpLoad %11 %arg_0 + %34 = OpSampledImage %33 %32 %31 + %36 = OpLoad %v2float %arg_2 + %37 = OpCompositeExtract %float %36 0 + %38 = OpCompositeExtract %float %36 1 + %40 = OpLoad %int %arg_3 + %39 = OpConvertSToF %float %40 + %41 = OpCompositeConstruct %v3float %37 %38 %39 + %43 = OpLoad %int %arg_4 + %42 = OpConvertSToF %float %43 + %30 = OpImageSampleExplicitLod %v4float %34 %41 Lod|ConstOffset %42 %45 + %29 = OpCompositeExtract %float %30 0 + OpStore %res %29 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %48 + %50 = OpLabel + %51 = OpFunctionCall %void %textureSampleLevel_36780e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %53 = OpLabel + %54 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %54 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %57 = OpLabel + %58 = OpFunctionCall %void %textureSampleLevel_36780e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %60 = OpLabel + %61 = OpFunctionCall %void %textureSampleLevel_36780e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleLevel/36780e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/36780e.wgsl.expected.wgsl new file mode 100644 index 0000000000..affece6cad --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/36780e.wgsl.expected.wgsl @@ -0,0 +1,26 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d_array; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleLevel_36780e() { + var arg_2 = vec2(); + var arg_3 = 1; + var arg_4 = 0; + var res : f32 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3, arg_4, vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_36780e(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleLevel_36780e(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleLevel_36780e(); +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/749baf.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/749baf.wgsl new file mode 100644 index 0000000000..a64a9e9d1d --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/749baf.wgsl @@ -0,0 +1,49 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleLevel(texture: texture_depth_2d, sampler: sampler, coords: vec2, level: i32, @const offset: vec2) -> f32 +fn textureSampleLevel_749baf() { + var arg_2 = vec2(); + var arg_3 = 0; + var res: f32 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3, vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_749baf(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleLevel_749baf(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleLevel_749baf(); +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/749baf.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleLevel/749baf.wgsl.expected.glsl new file mode 100644 index 0000000000..a2d34d0805 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/749baf.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureSampleLevel_749baf() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 0; + float res = textureLodOffset(arg_0_arg_1, vec3(arg_2, 0.0f), float(arg_3), ivec2(0)); +} + +vec4 vertex_main() { + textureSampleLevel_749baf(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureSampleLevel_749baf() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 0; + float res = textureLodOffset(arg_0_arg_1, vec3(arg_2, 0.0f), float(arg_3), ivec2(0)); +} + +void fragment_main() { + textureSampleLevel_749baf(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureSampleLevel_749baf() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 0; + float res = textureLodOffset(arg_0_arg_1, vec3(arg_2, 0.0f), float(arg_3), ivec2(0)); +} + +void compute_main() { + textureSampleLevel_749baf(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/749baf.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/749baf.wgsl.expected.hlsl new file mode 100644 index 0000000000..b1b58de933 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/749baf.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_749baf() { + float2 arg_2 = (0.0f).xx; + int arg_3 = 0; + float res = arg_0.SampleLevel(arg_1, arg_2, arg_3, (0).xx).x; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_749baf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_749baf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_749baf(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/749baf.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleLevel/749baf.wgsl.expected.msl new file mode 100644 index 0000000000..8ea81b154f --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/749baf.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureSampleLevel_749baf(depth2d tint_symbol_1, sampler tint_symbol_2) { + float2 arg_2 = float2(0.0f); + int arg_3 = 0; + float res = tint_symbol_1.sample(tint_symbol_2, arg_2, level(arg_3), int2(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d tint_symbol_3, sampler tint_symbol_4) { + textureSampleLevel_749baf(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleLevel_749baf(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depth2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleLevel_749baf(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleLevel/749baf.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleLevel/749baf.wgsl.expected.spvasm new file mode 100644 index 0000000000..c48597cfd0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/749baf.wgsl.expected.spvasm @@ -0,0 +1,98 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 54 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleLevel_749baf "textureSampleLevel_749baf" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %20 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %int = OpTypeInt 32 1 + %24 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %31 = OpTypeSampledImage %11 + %v2int = OpTypeVector %int 2 + %37 = OpConstantNull %v2int +%_ptr_Function_float = OpTypePointer Function %float + %40 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureSampleLevel_749baf = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %20 + %arg_3 = OpVariable %_ptr_Function_int Function %24 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_2 %20 + OpStore %arg_3 %24 + %29 = OpLoad %14 %arg_1 + %30 = OpLoad %11 %arg_0 + %32 = OpSampledImage %31 %30 %29 + %33 = OpLoad %v2float %arg_2 + %35 = OpLoad %int %arg_3 + %34 = OpConvertSToF %float %35 + %28 = OpImageSampleExplicitLod %v4float %32 %33 Lod|ConstOffset %34 %37 + %27 = OpCompositeExtract %float %28 0 + OpStore %res %27 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %40 + %42 = OpLabel + %43 = OpFunctionCall %void %textureSampleLevel_749baf + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %45 = OpLabel + %46 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %46 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %49 = OpLabel + %50 = OpFunctionCall %void %textureSampleLevel_749baf + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %52 = OpLabel + %53 = OpFunctionCall %void %textureSampleLevel_749baf + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleLevel/749baf.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/749baf.wgsl.expected.wgsl new file mode 100644 index 0000000000..f6f7597571 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/749baf.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleLevel_749baf() { + var arg_2 = vec2(); + var arg_3 = 0; + var res : f32 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3, vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_749baf(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleLevel_749baf(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleLevel_749baf(); +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/979816.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/979816.wgsl new file mode 100644 index 0000000000..fce2b831b7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/979816.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_external; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleLevel(texture: texture_external, sampler: sampler, coords: vec2) -> vec4 +fn textureSampleLevel_979816() { + var arg_2 = vec2(); + var res: vec4 = textureSampleLevel(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_979816(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleLevel_979816(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleLevel_979816(); +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/979816.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleLevel/979816.wgsl.expected.glsl new file mode 100644 index 0000000000..b55ac19d33 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/979816.wgsl.expected.glsl @@ -0,0 +1,228 @@ +SKIP: FAILED + +#version 310 es + +struct GammaTransferParams { + float G; + float A; + float B; + float C; + float D; + float E; + float F; + uint padding; +}; + +struct ExternalTextureParams { + uint numPlanes; + mat3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + mat3 gamutConversionMatrix; +}; + +layout(binding = 3) uniform ExternalTextureParams_1 { + uint numPlanes; + mat3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + mat3 gamutConversionMatrix; +} ext_tex_params; + +vec3 gammaCorrection(vec3 v, GammaTransferParams params) { + bvec3 cond = lessThan(abs(v), vec3(params.D)); + vec3 t = (sign(v) * ((params.C * abs(v)) + params.F)); + vec3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), vec3(params.G)) + params.E)); + return mix(f, t, cond); +} + + +vec4 textureSampleExternal(highp sampler2D plane0_smp, highp sampler2D plane1_smp, vec2 coord, ExternalTextureParams params) { + vec3 color = vec3(0.0f, 0.0f, 0.0f); + if ((params.numPlanes == 1u)) { + color = textureLod(plane0_smp, coord, 0.0f).rgb; + } else { + color = (vec4(textureLod(plane0_smp, coord, 0.0f).r, textureLod(plane1_smp, coord, 0.0f).rg, 1.0f) * params.yuvToRgbConversionMatrix); + } + color = gammaCorrection(color, params.gammaDecodeParams); + color = (params.gamutConversionMatrix * color); + color = gammaCorrection(color, params.gammaEncodeParams); + return vec4(color, 1.0f); +} + +uniform highp sampler2D arg_0_arg_1; +uniform highp sampler2D ext_tex_plane_1_arg_1; +void textureSampleLevel_979816() { + vec2 arg_2 = vec2(0.0f); + vec4 res = textureSampleExternal(arg_0_arg_1, ext_tex_plane_1_arg_1, arg_2, ext_tex_params); +} + +vec4 vertex_main() { + textureSampleLevel_979816(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:55: 'textureSampleExternal' : no matching overloaded function found +ERROR: 0:55: '=' : cannot convert from ' const float' to ' temp highp 4-component vector of float' +ERROR: 0:55: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +struct GammaTransferParams { + float G; + float A; + float B; + float C; + float D; + float E; + float F; + uint padding; +}; + +struct ExternalTextureParams { + uint numPlanes; + mat3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + mat3 gamutConversionMatrix; +}; + +layout(binding = 3) uniform ExternalTextureParams_1 { + uint numPlanes; + mat3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + mat3 gamutConversionMatrix; +} ext_tex_params; + +vec3 gammaCorrection(vec3 v, GammaTransferParams params) { + bvec3 cond = lessThan(abs(v), vec3(params.D)); + vec3 t = (sign(v) * ((params.C * abs(v)) + params.F)); + vec3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), vec3(params.G)) + params.E)); + return mix(f, t, cond); +} + + +vec4 textureSampleExternal(highp sampler2D plane0_smp, highp sampler2D plane1_smp, vec2 coord, ExternalTextureParams params) { + vec3 color = vec3(0.0f, 0.0f, 0.0f); + if ((params.numPlanes == 1u)) { + color = textureLod(plane0_smp, coord, 0.0f).rgb; + } else { + color = (vec4(textureLod(plane0_smp, coord, 0.0f).r, textureLod(plane1_smp, coord, 0.0f).rg, 1.0f) * params.yuvToRgbConversionMatrix); + } + color = gammaCorrection(color, params.gammaDecodeParams); + color = (params.gamutConversionMatrix * color); + color = gammaCorrection(color, params.gammaEncodeParams); + return vec4(color, 1.0f); +} + +uniform highp sampler2D arg_0_arg_1; +uniform highp sampler2D ext_tex_plane_1_arg_1; +void textureSampleLevel_979816() { + vec2 arg_2 = vec2(0.0f); + vec4 res = textureSampleExternal(arg_0_arg_1, ext_tex_plane_1_arg_1, arg_2, ext_tex_params); +} + +void fragment_main() { + textureSampleLevel_979816(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:56: 'textureSampleExternal' : no matching overloaded function found +ERROR: 0:56: '=' : cannot convert from ' const float' to ' temp mediump 4-component vector of float' +ERROR: 0:56: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es + +struct GammaTransferParams { + float G; + float A; + float B; + float C; + float D; + float E; + float F; + uint padding; +}; + +struct ExternalTextureParams { + uint numPlanes; + mat3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + mat3 gamutConversionMatrix; +}; + +layout(binding = 3) uniform ExternalTextureParams_1 { + uint numPlanes; + mat3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + mat3 gamutConversionMatrix; +} ext_tex_params; + +vec3 gammaCorrection(vec3 v, GammaTransferParams params) { + bvec3 cond = lessThan(abs(v), vec3(params.D)); + vec3 t = (sign(v) * ((params.C * abs(v)) + params.F)); + vec3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), vec3(params.G)) + params.E)); + return mix(f, t, cond); +} + + +vec4 textureSampleExternal(highp sampler2D plane0_smp, highp sampler2D plane1_smp, vec2 coord, ExternalTextureParams params) { + vec3 color = vec3(0.0f, 0.0f, 0.0f); + if ((params.numPlanes == 1u)) { + color = textureLod(plane0_smp, coord, 0.0f).rgb; + } else { + color = (vec4(textureLod(plane0_smp, coord, 0.0f).r, textureLod(plane1_smp, coord, 0.0f).rg, 1.0f) * params.yuvToRgbConversionMatrix); + } + color = gammaCorrection(color, params.gammaDecodeParams); + color = (params.gamutConversionMatrix * color); + color = gammaCorrection(color, params.gammaEncodeParams); + return vec4(color, 1.0f); +} + +uniform highp sampler2D arg_0_arg_1; +uniform highp sampler2D ext_tex_plane_1_arg_1; +void textureSampleLevel_979816() { + vec2 arg_2 = vec2(0.0f); + vec4 res = textureSampleExternal(arg_0_arg_1, ext_tex_plane_1_arg_1, arg_2, ext_tex_params); +} + +void compute_main() { + textureSampleLevel_979816(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:55: 'textureSampleExternal' : no matching overloaded function found +ERROR: 0:55: '=' : cannot convert from ' const float' to ' temp highp 4-component vector of float' +ERROR: 0:55: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureSampleLevel/979816.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/979816.wgsl.expected.hlsl new file mode 100644 index 0000000000..5aae94c7ad --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/979816.wgsl.expected.hlsl @@ -0,0 +1,109 @@ +struct GammaTransferParams { + float G; + float A; + float B; + float C; + float D; + float E; + float F; + uint padding; +}; +struct ExternalTextureParams { + uint numPlanes; + float3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + float3x3 gamutConversionMatrix; +}; + +Texture2D ext_tex_plane_1 : register(t2, space1); +cbuffer cbuffer_ext_tex_params : register(b3, space1) { + uint4 ext_tex_params[11]; +}; +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +float3 gammaCorrection(float3 v, GammaTransferParams params) { + const bool3 cond = (abs(v) < float3((params.D).xxx)); + const float3 t = (sign(v) * ((params.C * abs(v)) + params.F)); + const float3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), float3((params.G).xxx)) + params.E)); + return (cond ? t : f); +} + +float4 textureSampleExternal(Texture2D plane0, Texture2D plane1, SamplerState smp, float2 coord, ExternalTextureParams params) { + float3 color = float3(0.0f, 0.0f, 0.0f); + if ((params.numPlanes == 1u)) { + color = plane0.SampleLevel(smp, coord, 0.0f).rgb; + } else { + color = mul(params.yuvToRgbConversionMatrix, float4(plane0.SampleLevel(smp, coord, 0.0f).r, plane1.SampleLevel(smp, coord, 0.0f).rg, 1.0f)); + } + color = gammaCorrection(color, params.gammaDecodeParams); + color = mul(color, params.gamutConversionMatrix); + color = gammaCorrection(color, params.gammaEncodeParams); + return float4(color, 1.0f); +} + +float3x4 tint_symbol_3(uint4 buffer[11], uint offset) { + const uint scalar_offset = ((offset + 0u)) / 4; + const uint scalar_offset_1 = ((offset + 16u)) / 4; + const uint scalar_offset_2 = ((offset + 32u)) / 4; + return float3x4(asfloat(buffer[scalar_offset / 4]), asfloat(buffer[scalar_offset_1 / 4]), asfloat(buffer[scalar_offset_2 / 4])); +} + +GammaTransferParams tint_symbol_5(uint4 buffer[11], uint offset) { + const uint scalar_offset_3 = ((offset + 0u)) / 4; + const uint scalar_offset_4 = ((offset + 4u)) / 4; + const uint scalar_offset_5 = ((offset + 8u)) / 4; + const uint scalar_offset_6 = ((offset + 12u)) / 4; + const uint scalar_offset_7 = ((offset + 16u)) / 4; + const uint scalar_offset_8 = ((offset + 20u)) / 4; + const uint scalar_offset_9 = ((offset + 24u)) / 4; + const uint scalar_offset_10 = ((offset + 28u)) / 4; + const GammaTransferParams tint_symbol_9 = {asfloat(buffer[scalar_offset_3 / 4][scalar_offset_3 % 4]), asfloat(buffer[scalar_offset_4 / 4][scalar_offset_4 % 4]), asfloat(buffer[scalar_offset_5 / 4][scalar_offset_5 % 4]), asfloat(buffer[scalar_offset_6 / 4][scalar_offset_6 % 4]), asfloat(buffer[scalar_offset_7 / 4][scalar_offset_7 % 4]), asfloat(buffer[scalar_offset_8 / 4][scalar_offset_8 % 4]), asfloat(buffer[scalar_offset_9 / 4][scalar_offset_9 % 4]), buffer[scalar_offset_10 / 4][scalar_offset_10 % 4]}; + return tint_symbol_9; +} + +float3x3 tint_symbol_7(uint4 buffer[11], uint offset) { + const uint scalar_offset_11 = ((offset + 0u)) / 4; + const uint scalar_offset_12 = ((offset + 16u)) / 4; + const uint scalar_offset_13 = ((offset + 32u)) / 4; + return float3x3(asfloat(buffer[scalar_offset_11 / 4].xyz), asfloat(buffer[scalar_offset_12 / 4].xyz), asfloat(buffer[scalar_offset_13 / 4].xyz)); +} + +ExternalTextureParams tint_symbol_1(uint4 buffer[11], uint offset) { + const uint scalar_offset_14 = ((offset + 0u)) / 4; + const ExternalTextureParams tint_symbol_10 = {buffer[scalar_offset_14 / 4][scalar_offset_14 % 4], tint_symbol_3(buffer, (offset + 16u)), tint_symbol_5(buffer, (offset + 64u)), tint_symbol_5(buffer, (offset + 96u)), tint_symbol_7(buffer, (offset + 128u))}; + return tint_symbol_10; +} + +void textureSampleLevel_979816() { + float2 arg_2 = (0.0f).xx; + float4 res = textureSampleExternal(arg_0, ext_tex_plane_1, arg_1, arg_2, tint_symbol_1(ext_tex_params, 0u)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_979816(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_979816(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_979816(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/979816.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleLevel/979816.wgsl.expected.msl new file mode 100644 index 0000000000..2dabca5298 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/979816.wgsl.expected.msl @@ -0,0 +1,74 @@ +#include + +using namespace metal; +struct GammaTransferParams { + /* 0x0000 */ float G; + /* 0x0004 */ float A; + /* 0x0008 */ float B; + /* 0x000c */ float C; + /* 0x0010 */ float D; + /* 0x0014 */ float E; + /* 0x0018 */ float F; + /* 0x001c */ uint padding; +}; + +struct ExternalTextureParams { + /* 0x0000 */ uint numPlanes; + /* 0x0004 */ int8_t tint_pad[12]; + /* 0x0010 */ float3x4 yuvToRgbConversionMatrix; + /* 0x0040 */ GammaTransferParams gammaDecodeParams; + /* 0x0060 */ GammaTransferParams gammaEncodeParams; + /* 0x0080 */ float3x3 gamutConversionMatrix; +}; + +float3 gammaCorrection(float3 v, GammaTransferParams params) { + bool3 const cond = (fabs(v) < float3(params.D)); + float3 const t = (sign(v) * ((params.C * fabs(v)) + params.F)); + float3 const f = (sign(v) * (pow(((params.A * fabs(v)) + params.B), float3(params.G)) + params.E)); + return select(f, t, cond); +} + +float4 textureSampleExternal(texture2d plane0, texture2d plane1, sampler smp, float2 coord, ExternalTextureParams params) { + float3 color = 0.0f; + if ((params.numPlanes == 1u)) { + color = float4(plane0.sample(smp, coord, level(0.0f))).rgb; + } else { + color = (float4(plane0.sample(smp, coord, level(0.0f))[0], float4(plane1.sample(smp, coord, level(0.0f))).rg, 1.0f) * params.yuvToRgbConversionMatrix); + } + color = gammaCorrection(color, params.gammaDecodeParams); + color = (params.gamutConversionMatrix * color); + color = gammaCorrection(color, params.gammaEncodeParams); + return float4(color, 1.0f); +} + +void textureSampleLevel_979816(texture2d tint_symbol_1, texture2d tint_symbol_2, sampler tint_symbol_3, const constant ExternalTextureParams* const tint_symbol_4) { + float2 arg_2 = float2(0.0f); + float4 res = textureSampleExternal(tint_symbol_1, tint_symbol_2, tint_symbol_3, arg_2, *(tint_symbol_4)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_5, texture2d tint_symbol_6, sampler tint_symbol_7, const constant ExternalTextureParams* const tint_symbol_8) { + textureSampleLevel_979816(tint_symbol_5, tint_symbol_6, tint_symbol_7, tint_symbol_8); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_9 [[texture(0)]], texture2d tint_symbol_10 [[texture(1)]], sampler tint_symbol_11 [[sampler(0)]], const constant ExternalTextureParams* tint_symbol_12 [[buffer(2)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_9, tint_symbol_10, tint_symbol_11, tint_symbol_12); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_13 [[texture(0)]], texture2d tint_symbol_14 [[texture(1)]], sampler tint_symbol_15 [[sampler(0)]], const constant ExternalTextureParams* tint_symbol_16 [[buffer(2)]]) { + textureSampleLevel_979816(tint_symbol_13, tint_symbol_14, tint_symbol_15, tint_symbol_16); + return; +} + +kernel void compute_main(texture2d tint_symbol_17 [[texture(0)]], texture2d tint_symbol_18 [[texture(1)]], sampler tint_symbol_19 [[sampler(0)]], const constant ExternalTextureParams* tint_symbol_20 [[buffer(2)]]) { + textureSampleLevel_979816(tint_symbol_17, tint_symbol_18, tint_symbol_19, tint_symbol_20); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleLevel/979816.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleLevel/979816.wgsl.expected.spvasm new file mode 100644 index 0000000000..69123b5e3a --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/979816.wgsl.expected.spvasm @@ -0,0 +1,243 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 138 +; Schema: 0 + OpCapability Shader + %30 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %ext_tex_plane_1 "ext_tex_plane_1" + OpName %ExternalTextureParams "ExternalTextureParams" + OpMemberName %ExternalTextureParams 0 "numPlanes" + OpMemberName %ExternalTextureParams 1 "yuvToRgbConversionMatrix" + OpMemberName %ExternalTextureParams 2 "gammaDecodeParams" + OpName %GammaTransferParams "GammaTransferParams" + OpMemberName %GammaTransferParams 0 "G" + OpMemberName %GammaTransferParams 1 "A" + OpMemberName %GammaTransferParams 2 "B" + OpMemberName %GammaTransferParams 3 "C" + OpMemberName %GammaTransferParams 4 "D" + OpMemberName %GammaTransferParams 5 "E" + OpMemberName %GammaTransferParams 6 "F" + OpMemberName %GammaTransferParams 7 "padding" + OpMemberName %ExternalTextureParams 3 "gammaEncodeParams" + OpMemberName %ExternalTextureParams 4 "gamutConversionMatrix" + OpName %ext_tex_params "ext_tex_params" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %gammaCorrection "gammaCorrection" + OpName %v "v" + OpName %params "params" + OpName %textureSampleExternal "textureSampleExternal" + OpName %plane0 "plane0" + OpName %plane1 "plane1" + OpName %smp "smp" + OpName %coord "coord" + OpName %params_0 "params" + OpName %color "color" + OpName %textureSampleLevel_979816 "textureSampleLevel_979816" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %ext_tex_plane_1 DescriptorSet 1 + OpDecorate %ext_tex_plane_1 Binding 2 + OpDecorate %ExternalTextureParams Block + OpMemberDecorate %ExternalTextureParams 0 Offset 0 + OpMemberDecorate %ExternalTextureParams 1 Offset 16 + OpMemberDecorate %ExternalTextureParams 1 ColMajor + OpMemberDecorate %ExternalTextureParams 1 MatrixStride 16 + OpMemberDecorate %ExternalTextureParams 2 Offset 64 + OpMemberDecorate %GammaTransferParams 0 Offset 0 + OpMemberDecorate %GammaTransferParams 1 Offset 4 + OpMemberDecorate %GammaTransferParams 2 Offset 8 + OpMemberDecorate %GammaTransferParams 3 Offset 12 + OpMemberDecorate %GammaTransferParams 4 Offset 16 + OpMemberDecorate %GammaTransferParams 5 Offset 20 + OpMemberDecorate %GammaTransferParams 6 Offset 24 + OpMemberDecorate %GammaTransferParams 7 Offset 28 + OpMemberDecorate %ExternalTextureParams 3 Offset 96 + OpMemberDecorate %ExternalTextureParams 4 Offset 128 + OpMemberDecorate %ExternalTextureParams 4 ColMajor + OpMemberDecorate %ExternalTextureParams 4 MatrixStride 16 + OpDecorate %ext_tex_params NonWritable + OpDecorate %ext_tex_params DescriptorSet 1 + OpDecorate %ext_tex_params Binding 3 + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 +%ext_tex_plane_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %uint = OpTypeInt 32 0 +%mat3v4float = OpTypeMatrix %v4float 3 +%GammaTransferParams = OpTypeStruct %float %float %float %float %float %float %float %uint + %v3float = OpTypeVector %float 3 +%mat3v3float = OpTypeMatrix %v3float 3 +%ExternalTextureParams = OpTypeStruct %uint %mat3v4float %GammaTransferParams %GammaTransferParams %mat3v3float +%_ptr_Uniform_ExternalTextureParams = OpTypePointer Uniform %ExternalTextureParams +%ext_tex_params = OpVariable %_ptr_Uniform_ExternalTextureParams Uniform + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %23 = OpTypeSampler +%_ptr_UniformConstant_23 = OpTypePointer UniformConstant %23 + %arg_1 = OpVariable %_ptr_UniformConstant_23 UniformConstant + %24 = OpTypeFunction %v3float %v3float %GammaTransferParams + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %44 = OpConstantNull %v3float + %v2float = OpTypeVector %float 2 + %64 = OpTypeFunction %v4float %11 %11 %23 %v2float %ExternalTextureParams + %uint_1 = OpConstant %uint 1 + %81 = OpTypeSampledImage %11 + %float_1 = OpConstant %float 1 + %void = OpTypeVoid + %110 = OpTypeFunction %void + %114 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float +%_ptr_Function_v4float = OpTypePointer Function %v4float + %125 = OpTypeFunction %v4float +%gammaCorrection = OpFunction %v3float None %24 + %v = OpFunctionParameter %v3float + %params = OpFunctionParameter %GammaTransferParams + %28 = OpLabel + %42 = OpVariable %_ptr_Function_v3float Function %44 + %54 = OpVariable %_ptr_Function_v3float Function %44 + %60 = OpVariable %_ptr_Function_v3float Function %44 + %29 = OpExtInst %v3float %30 FAbs %v + %31 = OpCompositeExtract %float %params 4 + %32 = OpCompositeConstruct %v3float %31 %31 %31 + %33 = OpFOrdLessThan %v3bool %29 %32 + %36 = OpExtInst %v3float %30 FSign %v + %37 = OpCompositeExtract %float %params 3 + %38 = OpExtInst %v3float %30 FAbs %v + %39 = OpVectorTimesScalar %v3float %38 %37 + %40 = OpCompositeExtract %float %params 6 + %45 = OpCompositeConstruct %v3float %40 %40 %40 + %41 = OpFAdd %v3float %39 %45 + %46 = OpFMul %v3float %36 %41 + %47 = OpExtInst %v3float %30 FSign %v + %49 = OpCompositeExtract %float %params 1 + %50 = OpExtInst %v3float %30 FAbs %v + %51 = OpVectorTimesScalar %v3float %50 %49 + %52 = OpCompositeExtract %float %params 2 + %55 = OpCompositeConstruct %v3float %52 %52 %52 + %53 = OpFAdd %v3float %51 %55 + %56 = OpCompositeExtract %float %params 0 + %57 = OpCompositeConstruct %v3float %56 %56 %56 + %48 = OpExtInst %v3float %30 Pow %53 %57 + %58 = OpCompositeExtract %float %params 5 + %61 = OpCompositeConstruct %v3float %58 %58 %58 + %59 = OpFAdd %v3float %48 %61 + %62 = OpFMul %v3float %47 %59 + %63 = OpSelect %v3float %33 %46 %62 + OpReturnValue %63 + OpFunctionEnd +%textureSampleExternal = OpFunction %v4float None %64 + %plane0 = OpFunctionParameter %11 + %plane1 = OpFunctionParameter %11 + %smp = OpFunctionParameter %23 + %coord = OpFunctionParameter %v2float + %params_0 = OpFunctionParameter %ExternalTextureParams + %72 = OpLabel + %color = OpVariable %_ptr_Function_v3float Function %44 + %74 = OpCompositeExtract %uint %params_0 0 + %76 = OpIEqual %bool %74 %uint_1 + OpSelectionMerge %77 None + OpBranchConditional %76 %78 %79 + %78 = OpLabel + %82 = OpSampledImage %81 %plane0 %smp + %80 = OpImageSampleExplicitLod %v4float %82 %coord Lod %8 + %83 = OpVectorShuffle %v3float %80 %80 0 1 2 + OpStore %color %83 + OpBranch %77 + %79 = OpLabel + %85 = OpSampledImage %81 %plane0 %smp + %84 = OpImageSampleExplicitLod %v4float %85 %coord Lod %8 + %86 = OpCompositeExtract %float %84 0 + %88 = OpSampledImage %81 %plane1 %smp + %87 = OpImageSampleExplicitLod %v4float %88 %coord Lod %8 + %89 = OpVectorShuffle %v2float %87 %87 0 1 + %90 = OpCompositeExtract %float %89 0 + %91 = OpCompositeExtract %float %89 1 + %93 = OpCompositeConstruct %v4float %86 %90 %91 %float_1 + %94 = OpCompositeExtract %mat3v4float %params_0 1 + %95 = OpVectorTimesMatrix %v3float %93 %94 + OpStore %color %95 + OpBranch %77 + %77 = OpLabel + %97 = OpLoad %v3float %color + %98 = OpCompositeExtract %GammaTransferParams %params_0 2 + %96 = OpFunctionCall %v3float %gammaCorrection %97 %98 + OpStore %color %96 + %99 = OpCompositeExtract %mat3v3float %params_0 4 + %100 = OpLoad %v3float %color + %101 = OpMatrixTimesVector %v3float %99 %100 + OpStore %color %101 + %103 = OpLoad %v3float %color + %104 = OpCompositeExtract %GammaTransferParams %params_0 3 + %102 = OpFunctionCall %v3float %gammaCorrection %103 %104 + OpStore %color %102 + %105 = OpLoad %v3float %color + %106 = OpCompositeExtract %float %105 0 + %107 = OpCompositeExtract %float %105 1 + %108 = OpCompositeExtract %float %105 2 + %109 = OpCompositeConstruct %v4float %106 %107 %108 %float_1 + OpReturnValue %109 + OpFunctionEnd +%textureSampleLevel_979816 = OpFunction %void None %110 + %113 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %114 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_2 %114 + %118 = OpLoad %11 %arg_0 + %119 = OpLoad %11 %ext_tex_plane_1 + %120 = OpLoad %23 %arg_1 + %121 = OpLoad %v2float %arg_2 + %122 = OpLoad %ExternalTextureParams %ext_tex_params + %117 = OpFunctionCall %v4float %textureSampleExternal %118 %119 %120 %121 %122 + OpStore %res %117 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %125 + %127 = OpLabel + %128 = OpFunctionCall %void %textureSampleLevel_979816 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %110 + %130 = OpLabel + %131 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %131 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %110 + %133 = OpLabel + %134 = OpFunctionCall %void %textureSampleLevel_979816 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %110 + %136 = OpLabel + %137 = OpFunctionCall %void %textureSampleLevel_979816 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleLevel/979816.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/979816.wgsl.expected.wgsl new file mode 100644 index 0000000000..c22b080dfb --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/979816.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +@group(1) @binding(0) var arg_0 : texture_external; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleLevel_979816() { + var arg_2 = vec2(); + var res : vec4 = textureSampleLevel(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_979816(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleLevel_979816(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleLevel_979816(); +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/abfcc0.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/abfcc0.wgsl new file mode 100644 index 0000000000..7df2fc7bb3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/abfcc0.wgsl @@ -0,0 +1,49 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_3d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleLevel(texture: texture_3d, sampler: sampler, coords: vec3, level: f32) -> vec4 +fn textureSampleLevel_abfcc0() { + var arg_2 = vec3(); + var arg_3 = 1.0; + var res: vec4 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_abfcc0(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleLevel_abfcc0(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleLevel_abfcc0(); +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/abfcc0.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleLevel/abfcc0.wgsl.expected.glsl new file mode 100644 index 0000000000..f94eaea51a --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/abfcc0.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +uniform highp sampler3D arg_0_arg_1; + +void textureSampleLevel_abfcc0() { + vec3 arg_2 = vec3(0.0f); + float arg_3 = 1.0f; + vec4 res = textureLod(arg_0_arg_1, arg_2, arg_3); +} + +vec4 vertex_main() { + textureSampleLevel_abfcc0(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler3D arg_0_arg_1; + +void textureSampleLevel_abfcc0() { + vec3 arg_2 = vec3(0.0f); + float arg_3 = 1.0f; + vec4 res = textureLod(arg_0_arg_1, arg_2, arg_3); +} + +void fragment_main() { + textureSampleLevel_abfcc0(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler3D arg_0_arg_1; + +void textureSampleLevel_abfcc0() { + vec3 arg_2 = vec3(0.0f); + float arg_3 = 1.0f; + vec4 res = textureLod(arg_0_arg_1, arg_2, arg_3); +} + +void compute_main() { + textureSampleLevel_abfcc0(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/abfcc0.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/abfcc0.wgsl.expected.hlsl new file mode 100644 index 0000000000..cabcb9012a --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/abfcc0.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +Texture3D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_abfcc0() { + float3 arg_2 = (0.0f).xxx; + float arg_3 = 1.0f; + float4 res = arg_0.SampleLevel(arg_1, arg_2, arg_3); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_abfcc0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_abfcc0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_abfcc0(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/abfcc0.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleLevel/abfcc0.wgsl.expected.msl new file mode 100644 index 0000000000..399820b91b --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/abfcc0.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureSampleLevel_abfcc0(texture3d tint_symbol_1, sampler tint_symbol_2) { + float3 arg_2 = float3(0.0f); + float arg_3 = 1.0f; + float4 res = tint_symbol_1.sample(tint_symbol_2, arg_2, level(arg_3)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_3, sampler tint_symbol_4) { + textureSampleLevel_abfcc0(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleLevel_abfcc0(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture3d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleLevel_abfcc0(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleLevel/abfcc0.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleLevel/abfcc0.wgsl.expected.spvasm new file mode 100644 index 0000000000..46b9eb551b --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/abfcc0.wgsl.expected.spvasm @@ -0,0 +1,92 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 48 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleLevel_abfcc0 "textureSampleLevel_abfcc0" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 3D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %20 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %29 = OpTypeSampledImage %11 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %35 = OpTypeFunction %v4float +%textureSampleLevel_abfcc0 = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v3float Function %20 + %arg_3 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_2 %20 + OpStore %arg_3 %float_1 + %27 = OpLoad %14 %arg_1 + %28 = OpLoad %11 %arg_0 + %30 = OpSampledImage %29 %28 %27 + %31 = OpLoad %v3float %arg_2 + %32 = OpLoad %float %arg_3 + %26 = OpImageSampleExplicitLod %v4float %30 %31 Lod %32 + OpStore %res %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %35 + %37 = OpLabel + %38 = OpFunctionCall %void %textureSampleLevel_abfcc0 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %40 = OpLabel + %41 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %41 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %43 = OpLabel + %44 = OpFunctionCall %void %textureSampleLevel_abfcc0 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %46 = OpLabel + %47 = OpFunctionCall %void %textureSampleLevel_abfcc0 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleLevel/abfcc0.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/abfcc0.wgsl.expected.wgsl new file mode 100644 index 0000000000..744d29cfe7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/abfcc0.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +@group(1) @binding(0) var arg_0 : texture_3d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleLevel_abfcc0() { + var arg_2 = vec3(); + var arg_3 = 1.0; + var res : vec4 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_abfcc0(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleLevel_abfcc0(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleLevel_abfcc0(); +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/ae5e39.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/ae5e39.wgsl new file mode 100644 index 0000000000..1a2708620e --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/ae5e39.wgsl @@ -0,0 +1,50 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_cube_array; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleLevel(texture: texture_depth_cube_array, sampler: sampler, coords: vec3, array_index: i32, level: i32) -> f32 +fn textureSampleLevel_ae5e39() { + var arg_2 = vec3(); + var arg_3 = 1; + var arg_4 = 0; + var res: f32 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3, arg_4); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_ae5e39(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleLevel_ae5e39(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleLevel_ae5e39(); +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/ae5e39.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleLevel/ae5e39.wgsl.expected.glsl new file mode 100644 index 0000000000..9c64c667c3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/ae5e39.wgsl.expected.glsl @@ -0,0 +1,87 @@ +SKIP: FAILED + +#version 310 es + +uniform highp samplerCubeArrayShadow arg_0_arg_1; + +void textureSampleLevel_ae5e39() { + vec3 arg_2 = vec3(0.0f); + int arg_3 = 1; + int arg_4 = 0; + float res = textureLod(arg_0_arg_1, vec4(arg_2, float(arg_3)), float(arg_4)); +} + +vec4 vertex_main() { + textureSampleLevel_ae5e39(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArrayShadow' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp samplerCubeArrayShadow arg_0_arg_1; + +void textureSampleLevel_ae5e39() { + vec3 arg_2 = vec3(0.0f); + int arg_3 = 1; + int arg_4 = 0; + float res = textureLod(arg_0_arg_1, vec4(arg_2, float(arg_3)), float(arg_4)); +} + +void fragment_main() { + textureSampleLevel_ae5e39(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'samplerCubeArrayShadow' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp samplerCubeArrayShadow arg_0_arg_1; + +void textureSampleLevel_ae5e39() { + vec3 arg_2 = vec3(0.0f); + int arg_3 = 1; + int arg_4 = 0; + float res = textureLod(arg_0_arg_1, vec4(arg_2, float(arg_3)), float(arg_4)); +} + +void compute_main() { + textureSampleLevel_ae5e39(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArrayShadow' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureSampleLevel/ae5e39.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/ae5e39.wgsl.expected.hlsl new file mode 100644 index 0000000000..d003c3bf0f --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/ae5e39.wgsl.expected.hlsl @@ -0,0 +1,36 @@ +TextureCubeArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_ae5e39() { + float3 arg_2 = (0.0f).xxx; + int arg_3 = 1; + int arg_4 = 0; + float res = arg_0.SampleLevel(arg_1, float4(arg_2, float(arg_3)), arg_4).x; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_ae5e39(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_ae5e39(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_ae5e39(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/ae5e39.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleLevel/ae5e39.wgsl.expected.msl new file mode 100644 index 0000000000..f50b671b55 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/ae5e39.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureSampleLevel_ae5e39(depthcube_array tint_symbol_1, sampler tint_symbol_2) { + float3 arg_2 = float3(0.0f); + int arg_3 = 1; + int arg_4 = 0; + float res = tint_symbol_1.sample(tint_symbol_2, arg_2, arg_3, level(arg_4)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depthcube_array tint_symbol_3, sampler tint_symbol_4) { + textureSampleLevel_ae5e39(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depthcube_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depthcube_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleLevel_ae5e39(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depthcube_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleLevel_ae5e39(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleLevel/ae5e39.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleLevel/ae5e39.wgsl.expected.spvasm new file mode 100644 index 0000000000..ee03d7f38d --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/ae5e39.wgsl.expected.spvasm @@ -0,0 +1,107 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 60 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleLevel_ae5e39 "textureSampleLevel_ae5e39" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %arg_4 "arg_4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %20 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %27 = OpConstantNull %int + %33 = OpTypeSampledImage %11 +%_ptr_Function_float = OpTypePointer Function %float + %46 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureSampleLevel_ae5e39 = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v3float Function %20 + %arg_3 = OpVariable %_ptr_Function_int Function %27 + %arg_4 = OpVariable %_ptr_Function_int Function %27 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_2 %20 + OpStore %arg_3 %int_1 + OpStore %arg_4 %27 + %31 = OpLoad %14 %arg_1 + %32 = OpLoad %11 %arg_0 + %34 = OpSampledImage %33 %32 %31 + %35 = OpLoad %v3float %arg_2 + %36 = OpCompositeExtract %float %35 0 + %37 = OpCompositeExtract %float %35 1 + %38 = OpCompositeExtract %float %35 2 + %40 = OpLoad %int %arg_3 + %39 = OpConvertSToF %float %40 + %41 = OpCompositeConstruct %v4float %36 %37 %38 %39 + %43 = OpLoad %int %arg_4 + %42 = OpConvertSToF %float %43 + %30 = OpImageSampleExplicitLod %v4float %34 %41 Lod %42 + %29 = OpCompositeExtract %float %30 0 + OpStore %res %29 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %46 + %48 = OpLabel + %49 = OpFunctionCall %void %textureSampleLevel_ae5e39 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %51 = OpLabel + %52 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %52 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %55 = OpLabel + %56 = OpFunctionCall %void %textureSampleLevel_ae5e39 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %58 = OpLabel + %59 = OpFunctionCall %void %textureSampleLevel_ae5e39 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleLevel/ae5e39.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/ae5e39.wgsl.expected.wgsl new file mode 100644 index 0000000000..b67993a7fc --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/ae5e39.wgsl.expected.wgsl @@ -0,0 +1,26 @@ +@group(1) @binding(0) var arg_0 : texture_depth_cube_array; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleLevel_ae5e39() { + var arg_2 = vec3(); + var arg_3 = 1; + var arg_4 = 0; + var res : f32 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3, arg_4); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_ae5e39(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleLevel_ae5e39(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleLevel_ae5e39(); +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/b7c55c.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/b7c55c.wgsl new file mode 100644 index 0000000000..6e68866cc7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/b7c55c.wgsl @@ -0,0 +1,50 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleLevel(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, level: f32, @const offset: vec2) -> vec4 +fn textureSampleLevel_b7c55c() { + var arg_2 = vec2(); + var arg_3 = 1; + var arg_4 = 1.0; + var res: vec4 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3, arg_4, vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_b7c55c(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleLevel_b7c55c(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleLevel_b7c55c(); +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/b7c55c.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleLevel/b7c55c.wgsl.expected.glsl new file mode 100644 index 0000000000..baad6220dd --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/b7c55c.wgsl.expected.glsl @@ -0,0 +1,64 @@ +#version 310 es + +uniform highp sampler2DArray arg_0_arg_1; + +void textureSampleLevel_b7c55c() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + vec4 res = textureLodOffset(arg_0_arg_1, vec3(arg_2, float(arg_3)), arg_4, ivec2(0)); +} + +vec4 vertex_main() { + textureSampleLevel_b7c55c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DArray arg_0_arg_1; + +void textureSampleLevel_b7c55c() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + vec4 res = textureLodOffset(arg_0_arg_1, vec3(arg_2, float(arg_3)), arg_4, ivec2(0)); +} + +void fragment_main() { + textureSampleLevel_b7c55c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DArray arg_0_arg_1; + +void textureSampleLevel_b7c55c() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + vec4 res = textureLodOffset(arg_0_arg_1, vec3(arg_2, float(arg_3)), arg_4, ivec2(0)); +} + +void compute_main() { + textureSampleLevel_b7c55c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/b7c55c.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/b7c55c.wgsl.expected.hlsl new file mode 100644 index 0000000000..df52dfd933 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/b7c55c.wgsl.expected.hlsl @@ -0,0 +1,36 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_b7c55c() { + float2 arg_2 = (0.0f).xx; + int arg_3 = 1; + float arg_4 = 1.0f; + float4 res = arg_0.SampleLevel(arg_1, float3(arg_2, float(arg_3)), arg_4, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_b7c55c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_b7c55c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_b7c55c(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/b7c55c.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleLevel/b7c55c.wgsl.expected.msl new file mode 100644 index 0000000000..a1882e9488 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/b7c55c.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureSampleLevel_b7c55c(texture2d_array tint_symbol_1, sampler tint_symbol_2) { + float2 arg_2 = float2(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + float4 res = tint_symbol_1.sample(tint_symbol_2, arg_2, arg_3, level(arg_4), int2(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_3, sampler tint_symbol_4) { + textureSampleLevel_b7c55c(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleLevel_b7c55c(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleLevel_b7c55c(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleLevel/b7c55c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleLevel/b7c55c.wgsl.expected.spvasm new file mode 100644 index 0000000000..d7121f1b28 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/b7c55c.wgsl.expected.spvasm @@ -0,0 +1,107 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 61 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleLevel_b7c55c "textureSampleLevel_b7c55c" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %arg_4 "arg_4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %20 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %27 = OpConstantNull %int + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %34 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 + %v2int = OpTypeVector %int 2 + %45 = OpConstantNull %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %48 = OpTypeFunction %v4float +%textureSampleLevel_b7c55c = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %20 + %arg_3 = OpVariable %_ptr_Function_int Function %27 + %arg_4 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_2 %20 + OpStore %arg_3 %int_1 + OpStore %arg_4 %float_1 + %32 = OpLoad %14 %arg_1 + %33 = OpLoad %11 %arg_0 + %35 = OpSampledImage %34 %33 %32 + %37 = OpLoad %v2float %arg_2 + %38 = OpCompositeExtract %float %37 0 + %39 = OpCompositeExtract %float %37 1 + %41 = OpLoad %int %arg_3 + %40 = OpConvertSToF %float %41 + %42 = OpCompositeConstruct %v3float %38 %39 %40 + %43 = OpLoad %float %arg_4 + %31 = OpImageSampleExplicitLod %v4float %35 %42 Lod|ConstOffset %43 %45 + OpStore %res %31 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %48 + %50 = OpLabel + %51 = OpFunctionCall %void %textureSampleLevel_b7c55c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %53 = OpLabel + %54 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %54 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %56 = OpLabel + %57 = OpFunctionCall %void %textureSampleLevel_b7c55c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %59 = OpLabel + %60 = OpFunctionCall %void %textureSampleLevel_b7c55c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleLevel/b7c55c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/b7c55c.wgsl.expected.wgsl new file mode 100644 index 0000000000..06098f1fb7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/b7c55c.wgsl.expected.wgsl @@ -0,0 +1,26 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleLevel_b7c55c() { + var arg_2 = vec2(); + var arg_3 = 1; + var arg_4 = 1.0; + var res : vec4 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3, arg_4, vec2()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_b7c55c(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleLevel_b7c55c(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleLevel_b7c55c(); +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/c32df7.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/c32df7.wgsl new file mode 100644 index 0000000000..17882a1658 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/c32df7.wgsl @@ -0,0 +1,49 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleLevel(texture: texture_cube, sampler: sampler, coords: vec3, level: f32) -> vec4 +fn textureSampleLevel_c32df7() { + var arg_2 = vec3(); + var arg_3 = 1.0; + var res: vec4 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_c32df7(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleLevel_c32df7(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleLevel_c32df7(); +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/c32df7.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleLevel/c32df7.wgsl.expected.glsl new file mode 100644 index 0000000000..91a2a08fdc --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/c32df7.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +uniform highp samplerCube arg_0_arg_1; + +void textureSampleLevel_c32df7() { + vec3 arg_2 = vec3(0.0f); + float arg_3 = 1.0f; + vec4 res = textureLod(arg_0_arg_1, arg_2, arg_3); +} + +vec4 vertex_main() { + textureSampleLevel_c32df7(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp samplerCube arg_0_arg_1; + +void textureSampleLevel_c32df7() { + vec3 arg_2 = vec3(0.0f); + float arg_3 = 1.0f; + vec4 res = textureLod(arg_0_arg_1, arg_2, arg_3); +} + +void fragment_main() { + textureSampleLevel_c32df7(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp samplerCube arg_0_arg_1; + +void textureSampleLevel_c32df7() { + vec3 arg_2 = vec3(0.0f); + float arg_3 = 1.0f; + vec4 res = textureLod(arg_0_arg_1, arg_2, arg_3); +} + +void compute_main() { + textureSampleLevel_c32df7(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/c32df7.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/c32df7.wgsl.expected.hlsl new file mode 100644 index 0000000000..e5a4de66d2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/c32df7.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +TextureCube arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_c32df7() { + float3 arg_2 = (0.0f).xxx; + float arg_3 = 1.0f; + float4 res = arg_0.SampleLevel(arg_1, arg_2, arg_3); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_c32df7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_c32df7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_c32df7(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/c32df7.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleLevel/c32df7.wgsl.expected.msl new file mode 100644 index 0000000000..aed75443b3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/c32df7.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureSampleLevel_c32df7(texturecube tint_symbol_1, sampler tint_symbol_2) { + float3 arg_2 = float3(0.0f); + float arg_3 = 1.0f; + float4 res = tint_symbol_1.sample(tint_symbol_2, arg_2, level(arg_3)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube tint_symbol_3, sampler tint_symbol_4) { + textureSampleLevel_c32df7(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleLevel_c32df7(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texturecube tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleLevel_c32df7(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleLevel/c32df7.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleLevel/c32df7.wgsl.expected.spvasm new file mode 100644 index 0000000000..a5cb38fd69 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/c32df7.wgsl.expected.spvasm @@ -0,0 +1,92 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 48 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleLevel_c32df7 "textureSampleLevel_c32df7" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float Cube 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %20 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %29 = OpTypeSampledImage %11 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %35 = OpTypeFunction %v4float +%textureSampleLevel_c32df7 = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v3float Function %20 + %arg_3 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_2 %20 + OpStore %arg_3 %float_1 + %27 = OpLoad %14 %arg_1 + %28 = OpLoad %11 %arg_0 + %30 = OpSampledImage %29 %28 %27 + %31 = OpLoad %v3float %arg_2 + %32 = OpLoad %float %arg_3 + %26 = OpImageSampleExplicitLod %v4float %30 %31 Lod %32 + OpStore %res %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %35 + %37 = OpLabel + %38 = OpFunctionCall %void %textureSampleLevel_c32df7 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %40 = OpLabel + %41 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %41 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %43 = OpLabel + %44 = OpFunctionCall %void %textureSampleLevel_c32df7 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %46 = OpLabel + %47 = OpFunctionCall %void %textureSampleLevel_c32df7 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleLevel/c32df7.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/c32df7.wgsl.expected.wgsl new file mode 100644 index 0000000000..4920ce1acc --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/c32df7.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +@group(1) @binding(0) var arg_0 : texture_cube; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleLevel_c32df7() { + var arg_2 = vec3(); + var arg_3 = 1.0; + var res : vec4 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_c32df7(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleLevel_c32df7(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleLevel_c32df7(); +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/c6aca6.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/c6aca6.wgsl new file mode 100644 index 0000000000..5a7d65ccc2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/c6aca6.wgsl @@ -0,0 +1,49 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleLevel(texture: texture_2d, sampler: sampler, coords: vec2, level: f32) -> vec4 +fn textureSampleLevel_c6aca6() { + var arg_2 = vec2(); + var arg_3 = 1.0; + var res: vec4 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_c6aca6(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleLevel_c6aca6(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleLevel_c6aca6(); +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/c6aca6.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleLevel/c6aca6.wgsl.expected.glsl new file mode 100644 index 0000000000..7784b1e309 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/c6aca6.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +uniform highp sampler2D arg_0_arg_1; + +void textureSampleLevel_c6aca6() { + vec2 arg_2 = vec2(0.0f); + float arg_3 = 1.0f; + vec4 res = textureLod(arg_0_arg_1, arg_2, arg_3); +} + +vec4 vertex_main() { + textureSampleLevel_c6aca6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2D arg_0_arg_1; + +void textureSampleLevel_c6aca6() { + vec2 arg_2 = vec2(0.0f); + float arg_3 = 1.0f; + vec4 res = textureLod(arg_0_arg_1, arg_2, arg_3); +} + +void fragment_main() { + textureSampleLevel_c6aca6(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2D arg_0_arg_1; + +void textureSampleLevel_c6aca6() { + vec2 arg_2 = vec2(0.0f); + float arg_3 = 1.0f; + vec4 res = textureLod(arg_0_arg_1, arg_2, arg_3); +} + +void compute_main() { + textureSampleLevel_c6aca6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/c6aca6.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/c6aca6.wgsl.expected.hlsl new file mode 100644 index 0000000000..812fee1354 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/c6aca6.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_c6aca6() { + float2 arg_2 = (0.0f).xx; + float arg_3 = 1.0f; + float4 res = arg_0.SampleLevel(arg_1, arg_2, arg_3); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_c6aca6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_c6aca6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_c6aca6(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/c6aca6.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleLevel/c6aca6.wgsl.expected.msl new file mode 100644 index 0000000000..1f0f432365 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/c6aca6.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureSampleLevel_c6aca6(texture2d tint_symbol_1, sampler tint_symbol_2) { + float2 arg_2 = float2(0.0f); + float arg_3 = 1.0f; + float4 res = tint_symbol_1.sample(tint_symbol_2, arg_2, level(arg_3)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_3, sampler tint_symbol_4) { + textureSampleLevel_c6aca6(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleLevel_c6aca6(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleLevel_c6aca6(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleLevel/c6aca6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleLevel/c6aca6.wgsl.expected.spvasm new file mode 100644 index 0000000000..f0f3069e9d --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/c6aca6.wgsl.expected.spvasm @@ -0,0 +1,92 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 48 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleLevel_c6aca6 "textureSampleLevel_c6aca6" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %20 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %29 = OpTypeSampledImage %11 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %35 = OpTypeFunction %v4float +%textureSampleLevel_c6aca6 = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %20 + %arg_3 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_2 %20 + OpStore %arg_3 %float_1 + %27 = OpLoad %14 %arg_1 + %28 = OpLoad %11 %arg_0 + %30 = OpSampledImage %29 %28 %27 + %31 = OpLoad %v2float %arg_2 + %32 = OpLoad %float %arg_3 + %26 = OpImageSampleExplicitLod %v4float %30 %31 Lod %32 + OpStore %res %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %35 + %37 = OpLabel + %38 = OpFunctionCall %void %textureSampleLevel_c6aca6 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %40 = OpLabel + %41 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %41 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %43 = OpLabel + %44 = OpFunctionCall %void %textureSampleLevel_c6aca6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %46 = OpLabel + %47 = OpFunctionCall %void %textureSampleLevel_c6aca6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleLevel/c6aca6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/c6aca6.wgsl.expected.wgsl new file mode 100644 index 0000000000..670b79f971 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/c6aca6.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +@group(1) @binding(0) var arg_0 : texture_2d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleLevel_c6aca6() { + var arg_2 = vec2(); + var arg_3 = 1.0; + var res : vec4 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_c6aca6(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleLevel_c6aca6(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleLevel_c6aca6(); +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/dcbecb.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/dcbecb.wgsl new file mode 100644 index 0000000000..944db01525 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/dcbecb.wgsl @@ -0,0 +1,49 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_3d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleLevel(texture: texture_3d, sampler: sampler, coords: vec3, level: f32, @const offset: vec3) -> vec4 +fn textureSampleLevel_dcbecb() { + var arg_2 = vec3(); + var arg_3 = 1.0; + var res: vec4 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3, vec3()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_dcbecb(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleLevel_dcbecb(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleLevel_dcbecb(); +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/dcbecb.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleLevel/dcbecb.wgsl.expected.glsl new file mode 100644 index 0000000000..3875ed6679 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/dcbecb.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +uniform highp sampler3D arg_0_arg_1; + +void textureSampleLevel_dcbecb() { + vec3 arg_2 = vec3(0.0f); + float arg_3 = 1.0f; + vec4 res = textureLodOffset(arg_0_arg_1, arg_2, arg_3, ivec3(0)); +} + +vec4 vertex_main() { + textureSampleLevel_dcbecb(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler3D arg_0_arg_1; + +void textureSampleLevel_dcbecb() { + vec3 arg_2 = vec3(0.0f); + float arg_3 = 1.0f; + vec4 res = textureLodOffset(arg_0_arg_1, arg_2, arg_3, ivec3(0)); +} + +void fragment_main() { + textureSampleLevel_dcbecb(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler3D arg_0_arg_1; + +void textureSampleLevel_dcbecb() { + vec3 arg_2 = vec3(0.0f); + float arg_3 = 1.0f; + vec4 res = textureLodOffset(arg_0_arg_1, arg_2, arg_3, ivec3(0)); +} + +void compute_main() { + textureSampleLevel_dcbecb(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/dcbecb.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/dcbecb.wgsl.expected.hlsl new file mode 100644 index 0000000000..1c3bad7651 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/dcbecb.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +Texture3D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_dcbecb() { + float3 arg_2 = (0.0f).xxx; + float arg_3 = 1.0f; + float4 res = arg_0.SampleLevel(arg_1, arg_2, arg_3, (0).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_dcbecb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_dcbecb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_dcbecb(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/dcbecb.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleLevel/dcbecb.wgsl.expected.msl new file mode 100644 index 0000000000..9068307c0c --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/dcbecb.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureSampleLevel_dcbecb(texture3d tint_symbol_1, sampler tint_symbol_2) { + float3 arg_2 = float3(0.0f); + float arg_3 = 1.0f; + float4 res = tint_symbol_1.sample(tint_symbol_2, arg_2, level(arg_3), int3(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_3, sampler tint_symbol_4) { + textureSampleLevel_dcbecb(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleLevel_dcbecb(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture3d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleLevel_dcbecb(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleLevel/dcbecb.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleLevel/dcbecb.wgsl.expected.spvasm new file mode 100644 index 0000000000..59538e76a6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/dcbecb.wgsl.expected.spvasm @@ -0,0 +1,95 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 51 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleLevel_dcbecb "textureSampleLevel_dcbecb" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 3D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %20 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %29 = OpTypeSampledImage %11 + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %35 = OpConstantNull %v3int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %38 = OpTypeFunction %v4float +%textureSampleLevel_dcbecb = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v3float Function %20 + %arg_3 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_2 %20 + OpStore %arg_3 %float_1 + %27 = OpLoad %14 %arg_1 + %28 = OpLoad %11 %arg_0 + %30 = OpSampledImage %29 %28 %27 + %31 = OpLoad %v3float %arg_2 + %32 = OpLoad %float %arg_3 + %26 = OpImageSampleExplicitLod %v4float %30 %31 Lod|ConstOffset %32 %35 + OpStore %res %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %38 + %40 = OpLabel + %41 = OpFunctionCall %void %textureSampleLevel_dcbecb + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %43 = OpLabel + %44 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %44 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %46 = OpLabel + %47 = OpFunctionCall %void %textureSampleLevel_dcbecb + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %49 = OpLabel + %50 = OpFunctionCall %void %textureSampleLevel_dcbecb + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleLevel/dcbecb.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/dcbecb.wgsl.expected.wgsl new file mode 100644 index 0000000000..d527e5e697 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/dcbecb.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +@group(1) @binding(0) var arg_0 : texture_3d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleLevel_dcbecb() { + var arg_2 = vec3(); + var arg_3 = 1.0; + var res : vec4 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3, vec3()); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_dcbecb(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureSampleLevel_dcbecb(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureSampleLevel_dcbecb(); +} diff --git a/test/tint/builtins/gen/var/textureStore/05ce15.wgsl b/test/tint/builtins/gen/var/textureStore/05ce15.wgsl new file mode 100644 index 0000000000..9b41c0c96f --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/05ce15.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureStore(texture: texture_storage_2d, coords: vec2, value: vec4) +fn textureStore_05ce15() { + var arg_1 = vec2(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_05ce15(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_05ce15(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_05ce15(); +} diff --git a/test/tint/builtins/gen/var/textureStore/05ce15.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/05ce15.wgsl.expected.glsl new file mode 100644 index 0000000000..5437eda3ca --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/05ce15.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +layout(rgba32f) uniform highp writeonly image2D arg_0; +void textureStore_05ce15() { + ivec2 arg_1 = ivec2(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_05ce15(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba32f) uniform highp writeonly image2D arg_0; +void textureStore_05ce15() { + ivec2 arg_1 = ivec2(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_05ce15(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba32f) uniform highp writeonly image2D arg_0; +void textureStore_05ce15() { + ivec2 arg_1 = ivec2(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_05ce15(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/05ce15.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/05ce15.wgsl.expected.hlsl new file mode 100644 index 0000000000..c83a95c0fd --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/05ce15.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_05ce15() { + int2 arg_1 = (0).xx; + float4 arg_2 = (0.0f).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_05ce15(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_05ce15(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_05ce15(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/05ce15.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/05ce15.wgsl.expected.msl new file mode 100644 index 0000000000..9eb8590790 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/05ce15.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_05ce15(texture2d tint_symbol_1) { + int2 arg_1 = int2(0); + float4 arg_2 = float4(0.0f); + tint_symbol_1.write(arg_2, uint2(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureStore_05ce15(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureStore_05ce15(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureStore_05ce15(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/05ce15.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/05ce15.wgsl.expected.spvasm new file mode 100644 index 0000000000..8120c433d5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/05ce15.wgsl.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_05ce15 "textureStore_05ce15" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 2 Rgba32f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %18 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_05ce15 = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %18 + %arg_2 = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_1 %18 + OpStore %arg_2 %5 + %24 = OpLoad %11 %arg_0 + %25 = OpLoad %v2int %arg_1 + %26 = OpLoad %v4float %arg_2 + OpImageWrite %24 %25 %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %textureStore_05ce15 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureStore_05ce15 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %39 = OpLabel + %40 = OpFunctionCall %void %textureStore_05ce15 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/05ce15.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/05ce15.wgsl.expected.wgsl new file mode 100644 index 0000000000..70fbb974aa --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/05ce15.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureStore_05ce15() { + var arg_1 = vec2(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_05ce15(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_05ce15(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_05ce15(); +} diff --git a/test/tint/builtins/gen/var/textureStore/064c7f.wgsl b/test/tint/builtins/gen/var/textureStore/064c7f.wgsl new file mode 100644 index 0000000000..3ec416ef32 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/064c7f.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureStore(texture: texture_storage_2d, coords: vec2, value: vec4) +fn textureStore_064c7f() { + var arg_1 = vec2(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_064c7f(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_064c7f(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_064c7f(); +} diff --git a/test/tint/builtins/gen/var/textureStore/064c7f.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/064c7f.wgsl.expected.glsl new file mode 100644 index 0000000000..b7cf6cd5b7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/064c7f.wgsl.expected.glsl @@ -0,0 +1,81 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32f) uniform highp writeonly image2D arg_0; +void textureStore_064c7f() { + ivec2 arg_1 = ivec2(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_064c7f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32f) uniform highp writeonly image2D arg_0; +void textureStore_064c7f() { + ivec2 arg_1 = ivec2(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_064c7f(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32f) uniform highp writeonly image2D arg_0; +void textureStore_064c7f() { + ivec2 arg_1 = ivec2(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_064c7f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureStore/064c7f.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/064c7f.wgsl.expected.hlsl new file mode 100644 index 0000000000..8adf145298 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/064c7f.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_064c7f() { + int2 arg_1 = (0).xx; + float4 arg_2 = (0.0f).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_064c7f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_064c7f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_064c7f(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/064c7f.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/064c7f.wgsl.expected.msl new file mode 100644 index 0000000000..00a4cf7bf7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/064c7f.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_064c7f(texture2d tint_symbol_1) { + int2 arg_1 = int2(0); + float4 arg_2 = float4(0.0f); + tint_symbol_1.write(arg_2, uint2(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureStore_064c7f(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureStore_064c7f(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureStore_064c7f(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/064c7f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/064c7f.wgsl.expected.spvasm new file mode 100644 index 0000000000..d6d60c0d1d --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/064c7f.wgsl.expected.spvasm @@ -0,0 +1,82 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpCapability StorageImageExtendedFormats + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_064c7f "textureStore_064c7f" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 2 Rg32f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %18 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_064c7f = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %18 + %arg_2 = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_1 %18 + OpStore %arg_2 %5 + %24 = OpLoad %11 %arg_0 + %25 = OpLoad %v2int %arg_1 + %26 = OpLoad %v4float %arg_2 + OpImageWrite %24 %25 %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %textureStore_064c7f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureStore_064c7f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %39 = OpLabel + %40 = OpFunctionCall %void %textureStore_064c7f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/064c7f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/064c7f.wgsl.expected.wgsl new file mode 100644 index 0000000000..c560892531 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/064c7f.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureStore_064c7f() { + var arg_1 = vec2(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_064c7f(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_064c7f(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_064c7f(); +} diff --git a/test/tint/builtins/gen/var/textureStore/068641.wgsl b/test/tint/builtins/gen/var/textureStore/068641.wgsl new file mode 100644 index 0000000000..70d00255f9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/068641.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureStore(texture: texture_storage_3d, coords: vec3, value: vec4) +fn textureStore_068641() { + var arg_1 = vec3(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_068641(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_068641(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_068641(); +} diff --git a/test/tint/builtins/gen/var/textureStore/068641.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/068641.wgsl.expected.glsl new file mode 100644 index 0000000000..f84a5f2ad5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/068641.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +layout(rgba16ui) uniform highp writeonly uimage3D arg_0; +void textureStore_068641() { + ivec3 arg_1 = ivec3(0); + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_068641(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba16ui) uniform highp writeonly uimage3D arg_0; +void textureStore_068641() { + ivec3 arg_1 = ivec3(0); + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_068641(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba16ui) uniform highp writeonly uimage3D arg_0; +void textureStore_068641() { + ivec3 arg_1 = ivec3(0); + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_068641(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/068641.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/068641.wgsl.expected.hlsl new file mode 100644 index 0000000000..092e801f92 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/068641.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_068641() { + int3 arg_1 = (0).xxx; + uint4 arg_2 = (0u).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_068641(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_068641(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_068641(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/068641.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/068641.wgsl.expected.msl new file mode 100644 index 0000000000..a35ed83af9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/068641.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_068641(texture3d tint_symbol_1) { + int3 arg_1 = int3(0); + uint4 arg_2 = uint4(0u); + tint_symbol_1.write(arg_2, uint3(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureStore_068641(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureStore_068641(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureStore_068641(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/068641.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/068641.wgsl.expected.spvasm new file mode 100644 index 0000000000..b77d315a09 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/068641.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_068641 "textureStore_068641" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 3D 0 0 0 2 Rgba16ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %19 = OpConstantNull %v3int +%_ptr_Function_v3int = OpTypePointer Function %v3int + %v4uint = OpTypeVector %uint 4 + %23 = OpConstantNull %v4uint +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %30 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_068641 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v3int Function %19 + %arg_2 = OpVariable %_ptr_Function_v4uint Function %23 + OpStore %arg_1 %19 + OpStore %arg_2 %23 + %27 = OpLoad %11 %arg_0 + %28 = OpLoad %v3int %arg_1 + %29 = OpLoad %v4uint %arg_2 + OpImageWrite %27 %28 %29 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %textureStore_068641 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %36 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %39 = OpLabel + %40 = OpFunctionCall %void %textureStore_068641 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %42 = OpLabel + %43 = OpFunctionCall %void %textureStore_068641 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/068641.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/068641.wgsl.expected.wgsl new file mode 100644 index 0000000000..606252b19e --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/068641.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureStore_068641() { + var arg_1 = vec3(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_068641(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_068641(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_068641(); +} diff --git a/test/tint/builtins/gen/var/textureStore/0af6b5.wgsl b/test/tint/builtins/gen/var/textureStore/0af6b5.wgsl new file mode 100644 index 0000000000..0ba9d0a54a --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/0af6b5.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureStore(texture: texture_storage_2d, coords: vec2, value: vec4) +fn textureStore_0af6b5() { + var arg_1 = vec2(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_0af6b5(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_0af6b5(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_0af6b5(); +} diff --git a/test/tint/builtins/gen/var/textureStore/0af6b5.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/0af6b5.wgsl.expected.glsl new file mode 100644 index 0000000000..1ae6b6b55d --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/0af6b5.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +layout(r32f) uniform highp writeonly image2D arg_0; +void textureStore_0af6b5() { + ivec2 arg_1 = ivec2(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_0af6b5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(r32f) uniform highp writeonly image2D arg_0; +void textureStore_0af6b5() { + ivec2 arg_1 = ivec2(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_0af6b5(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(r32f) uniform highp writeonly image2D arg_0; +void textureStore_0af6b5() { + ivec2 arg_1 = ivec2(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_0af6b5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/0af6b5.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/0af6b5.wgsl.expected.hlsl new file mode 100644 index 0000000000..a0e877b0d3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/0af6b5.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_0af6b5() { + int2 arg_1 = (0).xx; + float4 arg_2 = (0.0f).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_0af6b5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_0af6b5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_0af6b5(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/0af6b5.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/0af6b5.wgsl.expected.msl new file mode 100644 index 0000000000..cbf31010c7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/0af6b5.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_0af6b5(texture2d tint_symbol_1) { + int2 arg_1 = int2(0); + float4 arg_2 = float4(0.0f); + tint_symbol_1.write(arg_2, uint2(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureStore_0af6b5(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureStore_0af6b5(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureStore_0af6b5(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/0af6b5.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/0af6b5.wgsl.expected.spvasm new file mode 100644 index 0000000000..2c11b9d396 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/0af6b5.wgsl.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_0af6b5 "textureStore_0af6b5" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 2 R32f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %18 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_0af6b5 = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %18 + %arg_2 = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_1 %18 + OpStore %arg_2 %5 + %24 = OpLoad %11 %arg_0 + %25 = OpLoad %v2int %arg_1 + %26 = OpLoad %v4float %arg_2 + OpImageWrite %24 %25 %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %textureStore_0af6b5 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureStore_0af6b5 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %39 = OpLabel + %40 = OpFunctionCall %void %textureStore_0af6b5 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/0af6b5.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/0af6b5.wgsl.expected.wgsl new file mode 100644 index 0000000000..51ba1644bf --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/0af6b5.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureStore_0af6b5() { + var arg_1 = vec2(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_0af6b5(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_0af6b5(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_0af6b5(); +} diff --git a/test/tint/builtins/gen/var/textureStore/0c3dff.wgsl b/test/tint/builtins/gen/var/textureStore/0c3dff.wgsl new file mode 100644 index 0000000000..65800b7be7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/0c3dff.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureStore(texture: texture_storage_2d, coords: vec2, value: vec4) +fn textureStore_0c3dff() { + var arg_1 = vec2(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_0c3dff(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_0c3dff(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_0c3dff(); +} diff --git a/test/tint/builtins/gen/var/textureStore/0c3dff.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/0c3dff.wgsl.expected.glsl new file mode 100644 index 0000000000..216ba1ae82 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/0c3dff.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +layout(rgba16ui) uniform highp writeonly uimage2D arg_0; +void textureStore_0c3dff() { + ivec2 arg_1 = ivec2(0); + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_0c3dff(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba16ui) uniform highp writeonly uimage2D arg_0; +void textureStore_0c3dff() { + ivec2 arg_1 = ivec2(0); + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_0c3dff(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba16ui) uniform highp writeonly uimage2D arg_0; +void textureStore_0c3dff() { + ivec2 arg_1 = ivec2(0); + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_0c3dff(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/0c3dff.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/0c3dff.wgsl.expected.hlsl new file mode 100644 index 0000000000..2c960efa6f --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/0c3dff.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_0c3dff() { + int2 arg_1 = (0).xx; + uint4 arg_2 = (0u).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_0c3dff(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_0c3dff(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_0c3dff(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/0c3dff.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/0c3dff.wgsl.expected.msl new file mode 100644 index 0000000000..7778f10003 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/0c3dff.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_0c3dff(texture2d tint_symbol_1) { + int2 arg_1 = int2(0); + uint4 arg_2 = uint4(0u); + tint_symbol_1.write(arg_2, uint2(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureStore_0c3dff(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureStore_0c3dff(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureStore_0c3dff(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/0c3dff.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/0c3dff.wgsl.expected.spvasm new file mode 100644 index 0000000000..a5e6876376 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/0c3dff.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_0c3dff "textureStore_0c3dff" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 0 0 2 Rgba16ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %19 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %v4uint = OpTypeVector %uint 4 + %23 = OpConstantNull %v4uint +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %30 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_0c3dff = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %19 + %arg_2 = OpVariable %_ptr_Function_v4uint Function %23 + OpStore %arg_1 %19 + OpStore %arg_2 %23 + %27 = OpLoad %11 %arg_0 + %28 = OpLoad %v2int %arg_1 + %29 = OpLoad %v4uint %arg_2 + OpImageWrite %27 %28 %29 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %textureStore_0c3dff + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %36 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %39 = OpLabel + %40 = OpFunctionCall %void %textureStore_0c3dff + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %42 = OpLabel + %43 = OpFunctionCall %void %textureStore_0c3dff + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/0c3dff.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/0c3dff.wgsl.expected.wgsl new file mode 100644 index 0000000000..3ec0971f51 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/0c3dff.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureStore_0c3dff() { + var arg_1 = vec2(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_0c3dff(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_0c3dff(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_0c3dff(); +} diff --git a/test/tint/builtins/gen/var/textureStore/102722.wgsl b/test/tint/builtins/gen/var/textureStore/102722.wgsl new file mode 100644 index 0000000000..7399cd7873 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/102722.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureStore(texture: texture_storage_1d, coords: i32, value: vec4) +fn textureStore_102722() { + var arg_1 = 1; + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_102722(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_102722(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_102722(); +} diff --git a/test/tint/builtins/gen/var/textureStore/102722.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/102722.wgsl.expected.glsl new file mode 100644 index 0000000000..79c3f3a7d3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/102722.wgsl.expected.glsl @@ -0,0 +1,84 @@ +SKIP: FAILED + +#version 310 es + +layout(r32ui) uniform highp writeonly uimage1D arg_0; +void textureStore_102722() { + int arg_1 = 1; + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_102722(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'uimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(r32ui) uniform highp writeonly uimage1D arg_0; +void textureStore_102722() { + int arg_1 = 1; + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_102722(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'uimage1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(r32ui) uniform highp writeonly uimage1D arg_0; +void textureStore_102722() { + int arg_1 = 1; + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_102722(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'uimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureStore/102722.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/102722.wgsl.expected.hlsl new file mode 100644 index 0000000000..e256ac82da --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/102722.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_102722() { + int arg_1 = 1; + uint4 arg_2 = (0u).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_102722(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_102722(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_102722(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/102722.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/102722.wgsl.expected.msl new file mode 100644 index 0000000000..f197dcc1af --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/102722.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_102722(texture1d tint_symbol_1) { + int arg_1 = 1; + uint4 arg_2 = uint4(0u); + tint_symbol_1.write(arg_2, uint(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureStore_102722(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureStore_102722(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureStore_102722(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/102722.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/102722.wgsl.expected.spvasm new file mode 100644 index 0000000000..0311196930 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/102722.wgsl.expected.spvasm @@ -0,0 +1,85 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpCapability Image1D + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_102722 "textureStore_102722" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 1D 0 0 0 2 R32ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %v4uint = OpTypeVector %uint 4 + %23 = OpConstantNull %v4uint +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %30 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_102722 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %21 + %arg_2 = OpVariable %_ptr_Function_v4uint Function %23 + OpStore %arg_1 %int_1 + OpStore %arg_2 %23 + %27 = OpLoad %11 %arg_0 + %28 = OpLoad %int %arg_1 + %29 = OpLoad %v4uint %arg_2 + OpImageWrite %27 %28 %29 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %textureStore_102722 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %36 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %39 = OpLabel + %40 = OpFunctionCall %void %textureStore_102722 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %42 = OpLabel + %43 = OpFunctionCall %void %textureStore_102722 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/102722.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/102722.wgsl.expected.wgsl new file mode 100644 index 0000000000..6f998c286d --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/102722.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureStore_102722() { + var arg_1 = 1; + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_102722(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_102722(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_102722(); +} diff --git a/test/tint/builtins/gen/var/textureStore/1bbd08.wgsl b/test/tint/builtins/gen/var/textureStore/1bbd08.wgsl new file mode 100644 index 0000000000..4be5f7fefe --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/1bbd08.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureStore(texture: texture_storage_3d, coords: vec3, value: vec4) +fn textureStore_1bbd08() { + var arg_1 = vec3(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_1bbd08(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_1bbd08(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_1bbd08(); +} diff --git a/test/tint/builtins/gen/var/textureStore/1bbd08.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/1bbd08.wgsl.expected.glsl new file mode 100644 index 0000000000..8bbedc5a87 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/1bbd08.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +layout(rgba8) uniform highp writeonly image3D arg_0; +void textureStore_1bbd08() { + ivec3 arg_1 = ivec3(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_1bbd08(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8) uniform highp writeonly image3D arg_0; +void textureStore_1bbd08() { + ivec3 arg_1 = ivec3(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_1bbd08(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8) uniform highp writeonly image3D arg_0; +void textureStore_1bbd08() { + ivec3 arg_1 = ivec3(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_1bbd08(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/1bbd08.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/1bbd08.wgsl.expected.hlsl new file mode 100644 index 0000000000..9bbd9cf51d --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/1bbd08.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_1bbd08() { + int3 arg_1 = (0).xxx; + float4 arg_2 = (0.0f).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_1bbd08(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_1bbd08(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_1bbd08(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/1bbd08.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/1bbd08.wgsl.expected.msl new file mode 100644 index 0000000000..a09fc63482 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/1bbd08.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_1bbd08(texture3d tint_symbol_1) { + int3 arg_1 = int3(0); + float4 arg_2 = float4(0.0f); + tint_symbol_1.write(arg_2, uint3(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureStore_1bbd08(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureStore_1bbd08(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureStore_1bbd08(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/1bbd08.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/1bbd08.wgsl.expected.spvasm new file mode 100644 index 0000000000..e5356afe90 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/1bbd08.wgsl.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_1bbd08 "textureStore_1bbd08" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 3D 0 0 0 2 Rgba8 +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %18 = OpConstantNull %v3int +%_ptr_Function_v3int = OpTypePointer Function %v3int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_1bbd08 = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v3int Function %18 + %arg_2 = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_1 %18 + OpStore %arg_2 %5 + %24 = OpLoad %11 %arg_0 + %25 = OpLoad %v3int %arg_1 + %26 = OpLoad %v4float %arg_2 + OpImageWrite %24 %25 %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %textureStore_1bbd08 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureStore_1bbd08 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %39 = OpLabel + %40 = OpFunctionCall %void %textureStore_1bbd08 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/1bbd08.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/1bbd08.wgsl.expected.wgsl new file mode 100644 index 0000000000..dc34b23ba7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/1bbd08.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureStore_1bbd08() { + var arg_1 = vec3(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_1bbd08(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_1bbd08(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_1bbd08(); +} diff --git a/test/tint/builtins/gen/var/textureStore/1c02e7.wgsl b/test/tint/builtins/gen/var/textureStore/1c02e7.wgsl new file mode 100644 index 0000000000..7773d7c98e --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/1c02e7.wgsl @@ -0,0 +1,49 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureStore(texture: texture_storage_2d_array, coords: vec2, array_index: i32, value: vec4) +fn textureStore_1c02e7() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = vec4(); + textureStore(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_1c02e7(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_1c02e7(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_1c02e7(); +} diff --git a/test/tint/builtins/gen/var/textureStore/1c02e7.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/1c02e7.wgsl.expected.glsl new file mode 100644 index 0000000000..43e87d1e0a --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/1c02e7.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +layout(r32i) uniform highp writeonly iimage2DArray arg_0; +void textureStore_1c02e7() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + ivec4 arg_3 = ivec4(0); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +vec4 vertex_main() { + textureStore_1c02e7(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(r32i) uniform highp writeonly iimage2DArray arg_0; +void textureStore_1c02e7() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + ivec4 arg_3 = ivec4(0); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +void fragment_main() { + textureStore_1c02e7(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(r32i) uniform highp writeonly iimage2DArray arg_0; +void textureStore_1c02e7() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + ivec4 arg_3 = ivec4(0); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +void compute_main() { + textureStore_1c02e7(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/1c02e7.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/1c02e7.wgsl.expected.hlsl new file mode 100644 index 0000000000..4fe7a79eec --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/1c02e7.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_1c02e7() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + int4 arg_3 = (0).xxxx; + arg_0[int3(arg_1, arg_2)] = arg_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_1c02e7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_1c02e7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_1c02e7(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/1c02e7.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/1c02e7.wgsl.expected.msl new file mode 100644 index 0000000000..a2ef827b92 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/1c02e7.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureStore_1c02e7(texture2d_array tint_symbol_1) { + int2 arg_1 = int2(0); + int arg_2 = 1; + int4 arg_3 = int4(0); + tint_symbol_1.write(arg_3, uint2(arg_1), arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureStore_1c02e7(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureStore_1c02e7(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureStore_1c02e7(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/1c02e7.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/1c02e7.wgsl.expected.spvasm new file mode 100644 index 0000000000..8497c205e5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/1c02e7.wgsl.expected.spvasm @@ -0,0 +1,94 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 52 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_1c02e7 "textureStore_1c02e7" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 1 0 2 R32i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v2int = OpTypeVector %int 2 + %18 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int + %v4int = OpTypeVector %int 4 + %26 = OpConstantNull %v4int +%_ptr_Function_v4int = OpTypePointer Function %v4int + %v3int = OpTypeVector %int 3 + %38 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_1c02e7 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %18 + %arg_2 = OpVariable %_ptr_Function_int Function %24 + %arg_3 = OpVariable %_ptr_Function_v4int Function %26 + OpStore %arg_1 %18 + OpStore %arg_2 %int_1 + OpStore %arg_3 %26 + %30 = OpLoad %11 %arg_0 + %32 = OpLoad %v2int %arg_1 + %33 = OpCompositeExtract %int %32 0 + %34 = OpCompositeExtract %int %32 1 + %35 = OpLoad %int %arg_2 + %36 = OpCompositeConstruct %v3int %33 %34 %35 + %37 = OpLoad %v4int %arg_3 + OpImageWrite %30 %36 %37 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %38 + %40 = OpLabel + %41 = OpFunctionCall %void %textureStore_1c02e7 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %43 = OpLabel + %44 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %44 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %47 = OpLabel + %48 = OpFunctionCall %void %textureStore_1c02e7 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %50 = OpLabel + %51 = OpFunctionCall %void %textureStore_1c02e7 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/1c02e7.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/1c02e7.wgsl.expected.wgsl new file mode 100644 index 0000000000..2c24651548 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/1c02e7.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureStore_1c02e7() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = vec4(); + textureStore(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_1c02e7(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_1c02e7(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_1c02e7(); +} diff --git a/test/tint/builtins/gen/var/textureStore/22d955.wgsl b/test/tint/builtins/gen/var/textureStore/22d955.wgsl new file mode 100644 index 0000000000..09cc1000f6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/22d955.wgsl @@ -0,0 +1,49 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureStore(texture: texture_storage_2d_array, coords: vec2, array_index: i32, value: vec4) +fn textureStore_22d955() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = vec4(); + textureStore(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_22d955(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_22d955(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_22d955(); +} diff --git a/test/tint/builtins/gen/var/textureStore/22d955.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/22d955.wgsl.expected.glsl new file mode 100644 index 0000000000..d8279c2c8f --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/22d955.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +layout(rgba8ui) uniform highp writeonly uimage2DArray arg_0; +void textureStore_22d955() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + uvec4 arg_3 = uvec4(0u); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +vec4 vertex_main() { + textureStore_22d955(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8ui) uniform highp writeonly uimage2DArray arg_0; +void textureStore_22d955() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + uvec4 arg_3 = uvec4(0u); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +void fragment_main() { + textureStore_22d955(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8ui) uniform highp writeonly uimage2DArray arg_0; +void textureStore_22d955() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + uvec4 arg_3 = uvec4(0u); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +void compute_main() { + textureStore_22d955(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/22d955.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/22d955.wgsl.expected.hlsl new file mode 100644 index 0000000000..ac28249652 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/22d955.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_22d955() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + uint4 arg_3 = (0u).xxxx; + arg_0[int3(arg_1, arg_2)] = arg_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_22d955(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_22d955(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_22d955(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/22d955.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/22d955.wgsl.expected.msl new file mode 100644 index 0000000000..be88306d8c --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/22d955.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureStore_22d955(texture2d_array tint_symbol_1) { + int2 arg_1 = int2(0); + int arg_2 = 1; + uint4 arg_3 = uint4(0u); + tint_symbol_1.write(arg_3, uint2(arg_1), arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureStore_22d955(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureStore_22d955(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureStore_22d955(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/22d955.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/22d955.wgsl.expected.spvasm new file mode 100644 index 0000000000..dff6bf19ff --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/22d955.wgsl.expected.spvasm @@ -0,0 +1,95 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 53 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_22d955 "textureStore_22d955" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 1 0 2 Rgba8ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %19 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %25 = OpConstantNull %int + %v4uint = OpTypeVector %uint 4 + %27 = OpConstantNull %v4uint +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %v3int = OpTypeVector %int 3 + %39 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_22d955 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %19 + %arg_2 = OpVariable %_ptr_Function_int Function %25 + %arg_3 = OpVariable %_ptr_Function_v4uint Function %27 + OpStore %arg_1 %19 + OpStore %arg_2 %int_1 + OpStore %arg_3 %27 + %31 = OpLoad %11 %arg_0 + %33 = OpLoad %v2int %arg_1 + %34 = OpCompositeExtract %int %33 0 + %35 = OpCompositeExtract %int %33 1 + %36 = OpLoad %int %arg_2 + %37 = OpCompositeConstruct %v3int %34 %35 %36 + %38 = OpLoad %v4uint %arg_3 + OpImageWrite %31 %37 %38 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %39 + %41 = OpLabel + %42 = OpFunctionCall %void %textureStore_22d955 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %44 = OpLabel + %45 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %45 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %48 = OpLabel + %49 = OpFunctionCall %void %textureStore_22d955 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %51 = OpLabel + %52 = OpFunctionCall %void %textureStore_22d955 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/22d955.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/22d955.wgsl.expected.wgsl new file mode 100644 index 0000000000..ca3080a743 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/22d955.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureStore_22d955() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = vec4(); + textureStore(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_22d955(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_22d955(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_22d955(); +} diff --git a/test/tint/builtins/gen/var/textureStore/26bf70.wgsl b/test/tint/builtins/gen/var/textureStore/26bf70.wgsl new file mode 100644 index 0000000000..cc953f36a7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/26bf70.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureStore(texture: texture_storage_2d, coords: vec2, value: vec4) +fn textureStore_26bf70() { + var arg_1 = vec2(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_26bf70(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_26bf70(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_26bf70(); +} diff --git a/test/tint/builtins/gen/var/textureStore/26bf70.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/26bf70.wgsl.expected.glsl new file mode 100644 index 0000000000..048b5b4332 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/26bf70.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +layout(rgba32ui) uniform highp writeonly uimage2D arg_0; +void textureStore_26bf70() { + ivec2 arg_1 = ivec2(0); + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_26bf70(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba32ui) uniform highp writeonly uimage2D arg_0; +void textureStore_26bf70() { + ivec2 arg_1 = ivec2(0); + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_26bf70(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba32ui) uniform highp writeonly uimage2D arg_0; +void textureStore_26bf70() { + ivec2 arg_1 = ivec2(0); + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_26bf70(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/26bf70.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/26bf70.wgsl.expected.hlsl new file mode 100644 index 0000000000..57341d9428 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/26bf70.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_26bf70() { + int2 arg_1 = (0).xx; + uint4 arg_2 = (0u).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_26bf70(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_26bf70(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_26bf70(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/26bf70.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/26bf70.wgsl.expected.msl new file mode 100644 index 0000000000..73242ad956 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/26bf70.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_26bf70(texture2d tint_symbol_1) { + int2 arg_1 = int2(0); + uint4 arg_2 = uint4(0u); + tint_symbol_1.write(arg_2, uint2(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureStore_26bf70(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureStore_26bf70(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureStore_26bf70(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/26bf70.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/26bf70.wgsl.expected.spvasm new file mode 100644 index 0000000000..188aded061 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/26bf70.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_26bf70 "textureStore_26bf70" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 0 0 2 Rgba32ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %19 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %v4uint = OpTypeVector %uint 4 + %23 = OpConstantNull %v4uint +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %30 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_26bf70 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %19 + %arg_2 = OpVariable %_ptr_Function_v4uint Function %23 + OpStore %arg_1 %19 + OpStore %arg_2 %23 + %27 = OpLoad %11 %arg_0 + %28 = OpLoad %v2int %arg_1 + %29 = OpLoad %v4uint %arg_2 + OpImageWrite %27 %28 %29 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %textureStore_26bf70 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %36 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %39 = OpLabel + %40 = OpFunctionCall %void %textureStore_26bf70 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %42 = OpLabel + %43 = OpFunctionCall %void %textureStore_26bf70 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/26bf70.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/26bf70.wgsl.expected.wgsl new file mode 100644 index 0000000000..f2ef696ef6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/26bf70.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureStore_26bf70() { + var arg_1 = vec2(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_26bf70(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_26bf70(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_26bf70(); +} diff --git a/test/tint/builtins/gen/var/textureStore/2796b4.wgsl b/test/tint/builtins/gen/var/textureStore/2796b4.wgsl new file mode 100644 index 0000000000..43d4c05947 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/2796b4.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureStore(texture: texture_storage_3d, coords: vec3, value: vec4) +fn textureStore_2796b4() { + var arg_1 = vec3(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_2796b4(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_2796b4(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_2796b4(); +} diff --git a/test/tint/builtins/gen/var/textureStore/2796b4.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/2796b4.wgsl.expected.glsl new file mode 100644 index 0000000000..8b3dd99ab9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/2796b4.wgsl.expected.glsl @@ -0,0 +1,81 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32i) uniform highp writeonly iimage3D arg_0; +void textureStore_2796b4() { + ivec3 arg_1 = ivec3(0); + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_2796b4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32i) uniform highp writeonly iimage3D arg_0; +void textureStore_2796b4() { + ivec3 arg_1 = ivec3(0); + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_2796b4(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32i) uniform highp writeonly iimage3D arg_0; +void textureStore_2796b4() { + ivec3 arg_1 = ivec3(0); + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_2796b4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureStore/2796b4.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/2796b4.wgsl.expected.hlsl new file mode 100644 index 0000000000..63eefce1cc --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/2796b4.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_2796b4() { + int3 arg_1 = (0).xxx; + int4 arg_2 = (0).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_2796b4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_2796b4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_2796b4(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/2796b4.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/2796b4.wgsl.expected.msl new file mode 100644 index 0000000000..c2ebcd9a9f --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/2796b4.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_2796b4(texture3d tint_symbol_1) { + int3 arg_1 = int3(0); + int4 arg_2 = int4(0); + tint_symbol_1.write(arg_2, uint3(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureStore_2796b4(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureStore_2796b4(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureStore_2796b4(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/2796b4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/2796b4.wgsl.expected.spvasm new file mode 100644 index 0000000000..d79adda805 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/2796b4.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpCapability StorageImageExtendedFormats + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_2796b4 "textureStore_2796b4" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 3D 0 0 0 2 Rg32i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v3int = OpTypeVector %int 3 + %18 = OpConstantNull %v3int +%_ptr_Function_v3int = OpTypePointer Function %v3int + %v4int = OpTypeVector %int 4 + %22 = OpConstantNull %v4int +%_ptr_Function_v4int = OpTypePointer Function %v4int + %29 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_2796b4 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v3int Function %18 + %arg_2 = OpVariable %_ptr_Function_v4int Function %22 + OpStore %arg_1 %18 + OpStore %arg_2 %22 + %26 = OpLoad %11 %arg_0 + %27 = OpLoad %v3int %arg_1 + %28 = OpLoad %v4int %arg_2 + OpImageWrite %26 %27 %28 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %29 + %31 = OpLabel + %32 = OpFunctionCall %void %textureStore_2796b4 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %35 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %38 = OpLabel + %39 = OpFunctionCall %void %textureStore_2796b4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %41 = OpLabel + %42 = OpFunctionCall %void %textureStore_2796b4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/2796b4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/2796b4.wgsl.expected.wgsl new file mode 100644 index 0000000000..73dfab1ccf --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/2796b4.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureStore_2796b4() { + var arg_1 = vec3(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_2796b4(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_2796b4(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_2796b4(); +} diff --git a/test/tint/builtins/gen/var/textureStore/2ac6c7.wgsl b/test/tint/builtins/gen/var/textureStore/2ac6c7.wgsl new file mode 100644 index 0000000000..bd92a3dff2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/2ac6c7.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureStore(texture: texture_storage_1d, coords: i32, value: vec4) +fn textureStore_2ac6c7() { + var arg_1 = 1; + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_2ac6c7(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_2ac6c7(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_2ac6c7(); +} diff --git a/test/tint/builtins/gen/var/textureStore/2ac6c7.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/2ac6c7.wgsl.expected.glsl new file mode 100644 index 0000000000..199d3fd88d --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/2ac6c7.wgsl.expected.glsl @@ -0,0 +1,84 @@ +SKIP: FAILED + +#version 310 es + +layout(r32f) uniform highp writeonly image1D arg_0; +void textureStore_2ac6c7() { + int arg_1 = 1; + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_2ac6c7(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(r32f) uniform highp writeonly image1D arg_0; +void textureStore_2ac6c7() { + int arg_1 = 1; + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_2ac6c7(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(r32f) uniform highp writeonly image1D arg_0; +void textureStore_2ac6c7() { + int arg_1 = 1; + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_2ac6c7(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureStore/2ac6c7.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/2ac6c7.wgsl.expected.hlsl new file mode 100644 index 0000000000..299e980785 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/2ac6c7.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_2ac6c7() { + int arg_1 = 1; + float4 arg_2 = (0.0f).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_2ac6c7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_2ac6c7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_2ac6c7(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/2ac6c7.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/2ac6c7.wgsl.expected.msl new file mode 100644 index 0000000000..da12ebc7d2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/2ac6c7.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_2ac6c7(texture1d tint_symbol_1) { + int arg_1 = 1; + float4 arg_2 = float4(0.0f); + tint_symbol_1.write(arg_2, uint(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureStore_2ac6c7(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureStore_2ac6c7(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureStore_2ac6c7(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/2ac6c7.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/2ac6c7.wgsl.expected.spvasm new file mode 100644 index 0000000000..f15467a58d --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/2ac6c7.wgsl.expected.spvasm @@ -0,0 +1,82 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpCapability Image1D + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_2ac6c7 "textureStore_2ac6c7" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 1D 0 0 0 2 R32f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %20 = OpConstantNull %int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_2ac6c7 = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %20 + %arg_2 = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_1 %int_1 + OpStore %arg_2 %5 + %24 = OpLoad %11 %arg_0 + %25 = OpLoad %int %arg_1 + %26 = OpLoad %v4float %arg_2 + OpImageWrite %24 %25 %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %textureStore_2ac6c7 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureStore_2ac6c7 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %39 = OpLabel + %40 = OpFunctionCall %void %textureStore_2ac6c7 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/2ac6c7.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/2ac6c7.wgsl.expected.wgsl new file mode 100644 index 0000000000..07686ddb36 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/2ac6c7.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureStore_2ac6c7() { + var arg_1 = 1; + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_2ac6c7(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_2ac6c7(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_2ac6c7(); +} diff --git a/test/tint/builtins/gen/var/textureStore/2eb2a4.wgsl b/test/tint/builtins/gen/var/textureStore/2eb2a4.wgsl new file mode 100644 index 0000000000..6896dde1ab --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/2eb2a4.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureStore(texture: texture_storage_1d, coords: i32, value: vec4) +fn textureStore_2eb2a4() { + var arg_1 = 1; + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_2eb2a4(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_2eb2a4(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_2eb2a4(); +} diff --git a/test/tint/builtins/gen/var/textureStore/2eb2a4.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/2eb2a4.wgsl.expected.glsl new file mode 100644 index 0000000000..3d85eaf4f5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/2eb2a4.wgsl.expected.glsl @@ -0,0 +1,84 @@ +SKIP: FAILED + +#version 310 es + +layout(rgba16ui) uniform highp writeonly uimage1D arg_0; +void textureStore_2eb2a4() { + int arg_1 = 1; + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_2eb2a4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'uimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rgba16ui) uniform highp writeonly uimage1D arg_0; +void textureStore_2eb2a4() { + int arg_1 = 1; + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_2eb2a4(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'uimage1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rgba16ui) uniform highp writeonly uimage1D arg_0; +void textureStore_2eb2a4() { + int arg_1 = 1; + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_2eb2a4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'uimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureStore/2eb2a4.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/2eb2a4.wgsl.expected.hlsl new file mode 100644 index 0000000000..36b1326f29 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/2eb2a4.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_2eb2a4() { + int arg_1 = 1; + uint4 arg_2 = (0u).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_2eb2a4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_2eb2a4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_2eb2a4(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/2eb2a4.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/2eb2a4.wgsl.expected.msl new file mode 100644 index 0000000000..07e1c2a3b4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/2eb2a4.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_2eb2a4(texture1d tint_symbol_1) { + int arg_1 = 1; + uint4 arg_2 = uint4(0u); + tint_symbol_1.write(arg_2, uint(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureStore_2eb2a4(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureStore_2eb2a4(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureStore_2eb2a4(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/2eb2a4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/2eb2a4.wgsl.expected.spvasm new file mode 100644 index 0000000000..c00ec81f1d --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/2eb2a4.wgsl.expected.spvasm @@ -0,0 +1,85 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpCapability Image1D + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_2eb2a4 "textureStore_2eb2a4" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 1D 0 0 0 2 Rgba16ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %v4uint = OpTypeVector %uint 4 + %23 = OpConstantNull %v4uint +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %30 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_2eb2a4 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %21 + %arg_2 = OpVariable %_ptr_Function_v4uint Function %23 + OpStore %arg_1 %int_1 + OpStore %arg_2 %23 + %27 = OpLoad %11 %arg_0 + %28 = OpLoad %int %arg_1 + %29 = OpLoad %v4uint %arg_2 + OpImageWrite %27 %28 %29 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %textureStore_2eb2a4 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %36 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %39 = OpLabel + %40 = OpFunctionCall %void %textureStore_2eb2a4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %42 = OpLabel + %43 = OpFunctionCall %void %textureStore_2eb2a4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/2eb2a4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/2eb2a4.wgsl.expected.wgsl new file mode 100644 index 0000000000..fd737252c8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/2eb2a4.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureStore_2eb2a4() { + var arg_1 = 1; + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_2eb2a4(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_2eb2a4(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_2eb2a4(); +} diff --git a/test/tint/builtins/gen/var/textureStore/2ed2a3.wgsl b/test/tint/builtins/gen/var/textureStore/2ed2a3.wgsl new file mode 100644 index 0000000000..f1e001e7c7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/2ed2a3.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureStore(texture: texture_storage_1d, coords: i32, value: vec4) +fn textureStore_2ed2a3() { + var arg_1 = 1; + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_2ed2a3(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_2ed2a3(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_2ed2a3(); +} diff --git a/test/tint/builtins/gen/var/textureStore/2ed2a3.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/2ed2a3.wgsl.expected.glsl new file mode 100644 index 0000000000..90689a7c8e --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/2ed2a3.wgsl.expected.glsl @@ -0,0 +1,84 @@ +SKIP: FAILED + +#version 310 es + +layout(rgba8_snorm) uniform highp writeonly image1D arg_0; +void textureStore_2ed2a3() { + int arg_1 = 1; + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_2ed2a3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rgba8_snorm) uniform highp writeonly image1D arg_0; +void textureStore_2ed2a3() { + int arg_1 = 1; + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_2ed2a3(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rgba8_snorm) uniform highp writeonly image1D arg_0; +void textureStore_2ed2a3() { + int arg_1 = 1; + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_2ed2a3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureStore/2ed2a3.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/2ed2a3.wgsl.expected.hlsl new file mode 100644 index 0000000000..5d63a7b6ae --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/2ed2a3.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_2ed2a3() { + int arg_1 = 1; + float4 arg_2 = (0.0f).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_2ed2a3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_2ed2a3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_2ed2a3(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/2ed2a3.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/2ed2a3.wgsl.expected.msl new file mode 100644 index 0000000000..e3b850b99d --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/2ed2a3.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_2ed2a3(texture1d tint_symbol_1) { + int arg_1 = 1; + float4 arg_2 = float4(0.0f); + tint_symbol_1.write(arg_2, uint(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureStore_2ed2a3(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureStore_2ed2a3(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureStore_2ed2a3(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/2ed2a3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/2ed2a3.wgsl.expected.spvasm new file mode 100644 index 0000000000..c692c2f9a2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/2ed2a3.wgsl.expected.spvasm @@ -0,0 +1,82 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpCapability Image1D + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_2ed2a3 "textureStore_2ed2a3" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 1D 0 0 0 2 Rgba8Snorm +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %20 = OpConstantNull %int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_2ed2a3 = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %20 + %arg_2 = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_1 %int_1 + OpStore %arg_2 %5 + %24 = OpLoad %11 %arg_0 + %25 = OpLoad %int %arg_1 + %26 = OpLoad %v4float %arg_2 + OpImageWrite %24 %25 %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %textureStore_2ed2a3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureStore_2ed2a3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %39 = OpLabel + %40 = OpFunctionCall %void %textureStore_2ed2a3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/2ed2a3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/2ed2a3.wgsl.expected.wgsl new file mode 100644 index 0000000000..db9ce1b901 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/2ed2a3.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureStore_2ed2a3() { + var arg_1 = 1; + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_2ed2a3(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_2ed2a3(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_2ed2a3(); +} diff --git a/test/tint/builtins/gen/var/textureStore/31745b.wgsl b/test/tint/builtins/gen/var/textureStore/31745b.wgsl new file mode 100644 index 0000000000..7a0e83a2d0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/31745b.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureStore(texture: texture_storage_2d, coords: vec2, value: vec4) +fn textureStore_31745b() { + var arg_1 = vec2(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_31745b(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_31745b(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_31745b(); +} diff --git a/test/tint/builtins/gen/var/textureStore/31745b.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/31745b.wgsl.expected.glsl new file mode 100644 index 0000000000..e5e4f60990 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/31745b.wgsl.expected.glsl @@ -0,0 +1,81 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32i) uniform highp writeonly iimage2D arg_0; +void textureStore_31745b() { + ivec2 arg_1 = ivec2(0); + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_31745b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32i) uniform highp writeonly iimage2D arg_0; +void textureStore_31745b() { + ivec2 arg_1 = ivec2(0); + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_31745b(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32i) uniform highp writeonly iimage2D arg_0; +void textureStore_31745b() { + ivec2 arg_1 = ivec2(0); + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_31745b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureStore/31745b.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/31745b.wgsl.expected.hlsl new file mode 100644 index 0000000000..33865302fc --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/31745b.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_31745b() { + int2 arg_1 = (0).xx; + int4 arg_2 = (0).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_31745b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_31745b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_31745b(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/31745b.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/31745b.wgsl.expected.msl new file mode 100644 index 0000000000..bde273accd --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/31745b.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_31745b(texture2d tint_symbol_1) { + int2 arg_1 = int2(0); + int4 arg_2 = int4(0); + tint_symbol_1.write(arg_2, uint2(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureStore_31745b(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureStore_31745b(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureStore_31745b(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/31745b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/31745b.wgsl.expected.spvasm new file mode 100644 index 0000000000..016eb27321 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/31745b.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpCapability StorageImageExtendedFormats + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_31745b "textureStore_31745b" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 0 0 2 Rg32i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v2int = OpTypeVector %int 2 + %18 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %v4int = OpTypeVector %int 4 + %22 = OpConstantNull %v4int +%_ptr_Function_v4int = OpTypePointer Function %v4int + %29 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_31745b = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %18 + %arg_2 = OpVariable %_ptr_Function_v4int Function %22 + OpStore %arg_1 %18 + OpStore %arg_2 %22 + %26 = OpLoad %11 %arg_0 + %27 = OpLoad %v2int %arg_1 + %28 = OpLoad %v4int %arg_2 + OpImageWrite %26 %27 %28 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %29 + %31 = OpLabel + %32 = OpFunctionCall %void %textureStore_31745b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %35 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %38 = OpLabel + %39 = OpFunctionCall %void %textureStore_31745b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %41 = OpLabel + %42 = OpFunctionCall %void %textureStore_31745b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/31745b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/31745b.wgsl.expected.wgsl new file mode 100644 index 0000000000..2cbbb067cf --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/31745b.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureStore_31745b() { + var arg_1 = vec2(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_31745b(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_31745b(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_31745b(); +} diff --git a/test/tint/builtins/gen/var/textureStore/32f368.wgsl b/test/tint/builtins/gen/var/textureStore/32f368.wgsl new file mode 100644 index 0000000000..769031f3ca --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/32f368.wgsl @@ -0,0 +1,49 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureStore(texture: texture_storage_2d_array, coords: vec2, array_index: i32, value: vec4) +fn textureStore_32f368() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = vec4(); + textureStore(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_32f368(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_32f368(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_32f368(); +} diff --git a/test/tint/builtins/gen/var/textureStore/32f368.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/32f368.wgsl.expected.glsl new file mode 100644 index 0000000000..b86d5eb850 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/32f368.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +layout(rgba16f) uniform highp writeonly image2DArray arg_0; +void textureStore_32f368() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + vec4 arg_3 = vec4(0.0f); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +vec4 vertex_main() { + textureStore_32f368(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba16f) uniform highp writeonly image2DArray arg_0; +void textureStore_32f368() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + vec4 arg_3 = vec4(0.0f); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +void fragment_main() { + textureStore_32f368(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba16f) uniform highp writeonly image2DArray arg_0; +void textureStore_32f368() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + vec4 arg_3 = vec4(0.0f); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +void compute_main() { + textureStore_32f368(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/32f368.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/32f368.wgsl.expected.hlsl new file mode 100644 index 0000000000..1c217b20a2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/32f368.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_32f368() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + float4 arg_3 = (0.0f).xxxx; + arg_0[int3(arg_1, arg_2)] = arg_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_32f368(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_32f368(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_32f368(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/32f368.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/32f368.wgsl.expected.msl new file mode 100644 index 0000000000..3daf6cbadb --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/32f368.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureStore_32f368(texture2d_array tint_symbol_1) { + int2 arg_1 = int2(0); + int arg_2 = 1; + float4 arg_3 = float4(0.0f); + tint_symbol_1.write(arg_3, uint2(arg_1), arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureStore_32f368(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureStore_32f368(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureStore_32f368(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/32f368.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/32f368.wgsl.expected.spvasm new file mode 100644 index 0000000000..a154105c0f --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/32f368.wgsl.expected.spvasm @@ -0,0 +1,92 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 50 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_32f368 "textureStore_32f368" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 2 Rgba16f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %18 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %v3int = OpTypeVector %int 3 + %36 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_32f368 = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %18 + %arg_2 = OpVariable %_ptr_Function_int Function %24 + %arg_3 = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_1 %18 + OpStore %arg_2 %int_1 + OpStore %arg_3 %5 + %28 = OpLoad %11 %arg_0 + %30 = OpLoad %v2int %arg_1 + %31 = OpCompositeExtract %int %30 0 + %32 = OpCompositeExtract %int %30 1 + %33 = OpLoad %int %arg_2 + %34 = OpCompositeConstruct %v3int %31 %32 %33 + %35 = OpLoad %v4float %arg_3 + OpImageWrite %28 %34 %35 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %36 + %38 = OpLabel + %39 = OpFunctionCall %void %textureStore_32f368 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %41 = OpLabel + %42 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %42 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %45 = OpLabel + %46 = OpFunctionCall %void %textureStore_32f368 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %48 = OpLabel + %49 = OpFunctionCall %void %textureStore_32f368 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/32f368.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/32f368.wgsl.expected.wgsl new file mode 100644 index 0000000000..7cf40ced55 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/32f368.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureStore_32f368() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = vec4(); + textureStore(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_32f368(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_32f368(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_32f368(); +} diff --git a/test/tint/builtins/gen/var/textureStore/331aee.wgsl b/test/tint/builtins/gen/var/textureStore/331aee.wgsl new file mode 100644 index 0000000000..f317f4d8aa --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/331aee.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureStore(texture: texture_storage_3d, coords: vec3, value: vec4) +fn textureStore_331aee() { + var arg_1 = vec3(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_331aee(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_331aee(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_331aee(); +} diff --git a/test/tint/builtins/gen/var/textureStore/331aee.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/331aee.wgsl.expected.glsl new file mode 100644 index 0000000000..6d0ade0e9f --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/331aee.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +layout(rgba32f) uniform highp writeonly image3D arg_0; +void textureStore_331aee() { + ivec3 arg_1 = ivec3(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_331aee(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba32f) uniform highp writeonly image3D arg_0; +void textureStore_331aee() { + ivec3 arg_1 = ivec3(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_331aee(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba32f) uniform highp writeonly image3D arg_0; +void textureStore_331aee() { + ivec3 arg_1 = ivec3(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_331aee(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/331aee.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/331aee.wgsl.expected.hlsl new file mode 100644 index 0000000000..1070c26429 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/331aee.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_331aee() { + int3 arg_1 = (0).xxx; + float4 arg_2 = (0.0f).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_331aee(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_331aee(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_331aee(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/331aee.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/331aee.wgsl.expected.msl new file mode 100644 index 0000000000..94c0dee52b --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/331aee.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_331aee(texture3d tint_symbol_1) { + int3 arg_1 = int3(0); + float4 arg_2 = float4(0.0f); + tint_symbol_1.write(arg_2, uint3(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureStore_331aee(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureStore_331aee(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureStore_331aee(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/331aee.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/331aee.wgsl.expected.spvasm new file mode 100644 index 0000000000..df8cccf6e2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/331aee.wgsl.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_331aee "textureStore_331aee" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 3D 0 0 0 2 Rgba32f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %18 = OpConstantNull %v3int +%_ptr_Function_v3int = OpTypePointer Function %v3int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_331aee = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v3int Function %18 + %arg_2 = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_1 %18 + OpStore %arg_2 %5 + %24 = OpLoad %11 %arg_0 + %25 = OpLoad %v3int %arg_1 + %26 = OpLoad %v4float %arg_2 + OpImageWrite %24 %25 %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %textureStore_331aee + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureStore_331aee + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %39 = OpLabel + %40 = OpFunctionCall %void %textureStore_331aee + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/331aee.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/331aee.wgsl.expected.wgsl new file mode 100644 index 0000000000..af9f52bbd5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/331aee.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureStore_331aee() { + var arg_1 = vec3(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_331aee(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_331aee(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_331aee(); +} diff --git a/test/tint/builtins/gen/var/textureStore/38e8d7.wgsl b/test/tint/builtins/gen/var/textureStore/38e8d7.wgsl new file mode 100644 index 0000000000..7309e183b7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/38e8d7.wgsl @@ -0,0 +1,49 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureStore(texture: texture_storage_2d_array, coords: vec2, array_index: i32, value: vec4) +fn textureStore_38e8d7() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = vec4(); + textureStore(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_38e8d7(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_38e8d7(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_38e8d7(); +} diff --git a/test/tint/builtins/gen/var/textureStore/38e8d7.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/38e8d7.wgsl.expected.glsl new file mode 100644 index 0000000000..7a6850e040 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/38e8d7.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +layout(r32ui) uniform highp writeonly uimage2DArray arg_0; +void textureStore_38e8d7() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + uvec4 arg_3 = uvec4(0u); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +vec4 vertex_main() { + textureStore_38e8d7(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(r32ui) uniform highp writeonly uimage2DArray arg_0; +void textureStore_38e8d7() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + uvec4 arg_3 = uvec4(0u); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +void fragment_main() { + textureStore_38e8d7(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(r32ui) uniform highp writeonly uimage2DArray arg_0; +void textureStore_38e8d7() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + uvec4 arg_3 = uvec4(0u); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +void compute_main() { + textureStore_38e8d7(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/38e8d7.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/38e8d7.wgsl.expected.hlsl new file mode 100644 index 0000000000..6e867ecc1c --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/38e8d7.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_38e8d7() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + uint4 arg_3 = (0u).xxxx; + arg_0[int3(arg_1, arg_2)] = arg_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_38e8d7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_38e8d7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_38e8d7(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/38e8d7.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/38e8d7.wgsl.expected.msl new file mode 100644 index 0000000000..c22bedbdef --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/38e8d7.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureStore_38e8d7(texture2d_array tint_symbol_1) { + int2 arg_1 = int2(0); + int arg_2 = 1; + uint4 arg_3 = uint4(0u); + tint_symbol_1.write(arg_3, uint2(arg_1), arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureStore_38e8d7(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureStore_38e8d7(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureStore_38e8d7(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/38e8d7.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/38e8d7.wgsl.expected.spvasm new file mode 100644 index 0000000000..623d520d43 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/38e8d7.wgsl.expected.spvasm @@ -0,0 +1,95 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 53 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_38e8d7 "textureStore_38e8d7" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 1 0 2 R32ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %19 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %25 = OpConstantNull %int + %v4uint = OpTypeVector %uint 4 + %27 = OpConstantNull %v4uint +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %v3int = OpTypeVector %int 3 + %39 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_38e8d7 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %19 + %arg_2 = OpVariable %_ptr_Function_int Function %25 + %arg_3 = OpVariable %_ptr_Function_v4uint Function %27 + OpStore %arg_1 %19 + OpStore %arg_2 %int_1 + OpStore %arg_3 %27 + %31 = OpLoad %11 %arg_0 + %33 = OpLoad %v2int %arg_1 + %34 = OpCompositeExtract %int %33 0 + %35 = OpCompositeExtract %int %33 1 + %36 = OpLoad %int %arg_2 + %37 = OpCompositeConstruct %v3int %34 %35 %36 + %38 = OpLoad %v4uint %arg_3 + OpImageWrite %31 %37 %38 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %39 + %41 = OpLabel + %42 = OpFunctionCall %void %textureStore_38e8d7 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %44 = OpLabel + %45 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %45 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %48 = OpLabel + %49 = OpFunctionCall %void %textureStore_38e8d7 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %51 = OpLabel + %52 = OpFunctionCall %void %textureStore_38e8d7 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/38e8d7.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/38e8d7.wgsl.expected.wgsl new file mode 100644 index 0000000000..650afb8455 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/38e8d7.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureStore_38e8d7() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = vec4(); + textureStore(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_38e8d7(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_38e8d7(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_38e8d7(); +} diff --git a/test/tint/builtins/gen/var/textureStore/3a52ac.wgsl b/test/tint/builtins/gen/var/textureStore/3a52ac.wgsl new file mode 100644 index 0000000000..022d92b142 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/3a52ac.wgsl @@ -0,0 +1,49 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureStore(texture: texture_storage_2d_array, coords: vec2, array_index: i32, value: vec4) +fn textureStore_3a52ac() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = vec4(); + textureStore(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_3a52ac(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_3a52ac(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_3a52ac(); +} diff --git a/test/tint/builtins/gen/var/textureStore/3a52ac.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/3a52ac.wgsl.expected.glsl new file mode 100644 index 0000000000..4ae9505508 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/3a52ac.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +layout(rgba16i) uniform highp writeonly iimage2DArray arg_0; +void textureStore_3a52ac() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + ivec4 arg_3 = ivec4(0); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +vec4 vertex_main() { + textureStore_3a52ac(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba16i) uniform highp writeonly iimage2DArray arg_0; +void textureStore_3a52ac() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + ivec4 arg_3 = ivec4(0); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +void fragment_main() { + textureStore_3a52ac(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba16i) uniform highp writeonly iimage2DArray arg_0; +void textureStore_3a52ac() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + ivec4 arg_3 = ivec4(0); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +void compute_main() { + textureStore_3a52ac(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/3a52ac.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/3a52ac.wgsl.expected.hlsl new file mode 100644 index 0000000000..f682606ef8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/3a52ac.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_3a52ac() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + int4 arg_3 = (0).xxxx; + arg_0[int3(arg_1, arg_2)] = arg_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_3a52ac(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_3a52ac(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_3a52ac(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/3a52ac.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/3a52ac.wgsl.expected.msl new file mode 100644 index 0000000000..e243637964 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/3a52ac.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureStore_3a52ac(texture2d_array tint_symbol_1) { + int2 arg_1 = int2(0); + int arg_2 = 1; + int4 arg_3 = int4(0); + tint_symbol_1.write(arg_3, uint2(arg_1), arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureStore_3a52ac(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureStore_3a52ac(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureStore_3a52ac(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/3a52ac.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/3a52ac.wgsl.expected.spvasm new file mode 100644 index 0000000000..ef89e77746 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/3a52ac.wgsl.expected.spvasm @@ -0,0 +1,94 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 52 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_3a52ac "textureStore_3a52ac" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 1 0 2 Rgba16i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v2int = OpTypeVector %int 2 + %18 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int + %v4int = OpTypeVector %int 4 + %26 = OpConstantNull %v4int +%_ptr_Function_v4int = OpTypePointer Function %v4int + %v3int = OpTypeVector %int 3 + %38 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_3a52ac = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %18 + %arg_2 = OpVariable %_ptr_Function_int Function %24 + %arg_3 = OpVariable %_ptr_Function_v4int Function %26 + OpStore %arg_1 %18 + OpStore %arg_2 %int_1 + OpStore %arg_3 %26 + %30 = OpLoad %11 %arg_0 + %32 = OpLoad %v2int %arg_1 + %33 = OpCompositeExtract %int %32 0 + %34 = OpCompositeExtract %int %32 1 + %35 = OpLoad %int %arg_2 + %36 = OpCompositeConstruct %v3int %33 %34 %35 + %37 = OpLoad %v4int %arg_3 + OpImageWrite %30 %36 %37 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %38 + %40 = OpLabel + %41 = OpFunctionCall %void %textureStore_3a52ac + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %43 = OpLabel + %44 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %44 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %47 = OpLabel + %48 = OpFunctionCall %void %textureStore_3a52ac + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %50 = OpLabel + %51 = OpFunctionCall %void %textureStore_3a52ac + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/3a52ac.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/3a52ac.wgsl.expected.wgsl new file mode 100644 index 0000000000..ec27918ce7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/3a52ac.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureStore_3a52ac() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = vec4(); + textureStore(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_3a52ac(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_3a52ac(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_3a52ac(); +} diff --git a/test/tint/builtins/gen/var/textureStore/3bb7a1.wgsl b/test/tint/builtins/gen/var/textureStore/3bb7a1.wgsl new file mode 100644 index 0000000000..959aa09956 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/3bb7a1.wgsl @@ -0,0 +1,49 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureStore(texture: texture_storage_2d_array, coords: vec2, array_index: i32, value: vec4) +fn textureStore_3bb7a1() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = vec4(); + textureStore(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_3bb7a1(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_3bb7a1(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_3bb7a1(); +} diff --git a/test/tint/builtins/gen/var/textureStore/3bb7a1.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/3bb7a1.wgsl.expected.glsl new file mode 100644 index 0000000000..a46b20beaa --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/3bb7a1.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +layout(r32f) uniform highp writeonly image2DArray arg_0; +void textureStore_3bb7a1() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + vec4 arg_3 = vec4(0.0f); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +vec4 vertex_main() { + textureStore_3bb7a1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(r32f) uniform highp writeonly image2DArray arg_0; +void textureStore_3bb7a1() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + vec4 arg_3 = vec4(0.0f); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +void fragment_main() { + textureStore_3bb7a1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(r32f) uniform highp writeonly image2DArray arg_0; +void textureStore_3bb7a1() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + vec4 arg_3 = vec4(0.0f); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +void compute_main() { + textureStore_3bb7a1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/3bb7a1.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/3bb7a1.wgsl.expected.hlsl new file mode 100644 index 0000000000..e18ed4d8d4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/3bb7a1.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_3bb7a1() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + float4 arg_3 = (0.0f).xxxx; + arg_0[int3(arg_1, arg_2)] = arg_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_3bb7a1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_3bb7a1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_3bb7a1(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/3bb7a1.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/3bb7a1.wgsl.expected.msl new file mode 100644 index 0000000000..70c180e005 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/3bb7a1.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureStore_3bb7a1(texture2d_array tint_symbol_1) { + int2 arg_1 = int2(0); + int arg_2 = 1; + float4 arg_3 = float4(0.0f); + tint_symbol_1.write(arg_3, uint2(arg_1), arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureStore_3bb7a1(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureStore_3bb7a1(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureStore_3bb7a1(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/3bb7a1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/3bb7a1.wgsl.expected.spvasm new file mode 100644 index 0000000000..f7e7b38d38 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/3bb7a1.wgsl.expected.spvasm @@ -0,0 +1,92 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 50 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_3bb7a1 "textureStore_3bb7a1" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 2 R32f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %18 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %v3int = OpTypeVector %int 3 + %36 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_3bb7a1 = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %18 + %arg_2 = OpVariable %_ptr_Function_int Function %24 + %arg_3 = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_1 %18 + OpStore %arg_2 %int_1 + OpStore %arg_3 %5 + %28 = OpLoad %11 %arg_0 + %30 = OpLoad %v2int %arg_1 + %31 = OpCompositeExtract %int %30 0 + %32 = OpCompositeExtract %int %30 1 + %33 = OpLoad %int %arg_2 + %34 = OpCompositeConstruct %v3int %31 %32 %33 + %35 = OpLoad %v4float %arg_3 + OpImageWrite %28 %34 %35 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %36 + %38 = OpLabel + %39 = OpFunctionCall %void %textureStore_3bb7a1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %41 = OpLabel + %42 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %42 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %45 = OpLabel + %46 = OpFunctionCall %void %textureStore_3bb7a1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %48 = OpLabel + %49 = OpFunctionCall %void %textureStore_3bb7a1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/3bb7a1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/3bb7a1.wgsl.expected.wgsl new file mode 100644 index 0000000000..d79be5d1c5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/3bb7a1.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureStore_3bb7a1() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = vec4(); + textureStore(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_3bb7a1(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_3bb7a1(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_3bb7a1(); +} diff --git a/test/tint/builtins/gen/var/textureStore/3bec15.wgsl b/test/tint/builtins/gen/var/textureStore/3bec15.wgsl new file mode 100644 index 0000000000..b271e2cb15 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/3bec15.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureStore(texture: texture_storage_1d, coords: i32, value: vec4) +fn textureStore_3bec15() { + var arg_1 = 1; + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_3bec15(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_3bec15(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_3bec15(); +} diff --git a/test/tint/builtins/gen/var/textureStore/3bec15.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/3bec15.wgsl.expected.glsl new file mode 100644 index 0000000000..99b7eef8e6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/3bec15.wgsl.expected.glsl @@ -0,0 +1,84 @@ +SKIP: FAILED + +#version 310 es + +layout(rgba8ui) uniform highp writeonly uimage1D arg_0; +void textureStore_3bec15() { + int arg_1 = 1; + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_3bec15(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'uimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rgba8ui) uniform highp writeonly uimage1D arg_0; +void textureStore_3bec15() { + int arg_1 = 1; + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_3bec15(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'uimage1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rgba8ui) uniform highp writeonly uimage1D arg_0; +void textureStore_3bec15() { + int arg_1 = 1; + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_3bec15(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'uimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureStore/3bec15.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/3bec15.wgsl.expected.hlsl new file mode 100644 index 0000000000..7092f585ae --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/3bec15.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_3bec15() { + int arg_1 = 1; + uint4 arg_2 = (0u).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_3bec15(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_3bec15(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_3bec15(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/3bec15.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/3bec15.wgsl.expected.msl new file mode 100644 index 0000000000..75e47f1ba6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/3bec15.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_3bec15(texture1d tint_symbol_1) { + int arg_1 = 1; + uint4 arg_2 = uint4(0u); + tint_symbol_1.write(arg_2, uint(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureStore_3bec15(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureStore_3bec15(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureStore_3bec15(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/3bec15.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/3bec15.wgsl.expected.spvasm new file mode 100644 index 0000000000..4688a0fe23 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/3bec15.wgsl.expected.spvasm @@ -0,0 +1,85 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpCapability Image1D + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_3bec15 "textureStore_3bec15" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 1D 0 0 0 2 Rgba8ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %v4uint = OpTypeVector %uint 4 + %23 = OpConstantNull %v4uint +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %30 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_3bec15 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %21 + %arg_2 = OpVariable %_ptr_Function_v4uint Function %23 + OpStore %arg_1 %int_1 + OpStore %arg_2 %23 + %27 = OpLoad %11 %arg_0 + %28 = OpLoad %int %arg_1 + %29 = OpLoad %v4uint %arg_2 + OpImageWrite %27 %28 %29 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %textureStore_3bec15 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %36 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %39 = OpLabel + %40 = OpFunctionCall %void %textureStore_3bec15 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %42 = OpLabel + %43 = OpFunctionCall %void %textureStore_3bec15 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/3bec15.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/3bec15.wgsl.expected.wgsl new file mode 100644 index 0000000000..63f1025196 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/3bec15.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureStore_3bec15() { + var arg_1 = 1; + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_3bec15(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_3bec15(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_3bec15(); +} diff --git a/test/tint/builtins/gen/var/textureStore/441ba8.wgsl b/test/tint/builtins/gen/var/textureStore/441ba8.wgsl new file mode 100644 index 0000000000..73f8b3b924 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/441ba8.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureStore(texture: texture_storage_3d, coords: vec3, value: vec4) +fn textureStore_441ba8() { + var arg_1 = vec3(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_441ba8(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_441ba8(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_441ba8(); +} diff --git a/test/tint/builtins/gen/var/textureStore/441ba8.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/441ba8.wgsl.expected.glsl new file mode 100644 index 0000000000..ef4af5194c --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/441ba8.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +layout(rgba32ui) uniform highp writeonly uimage3D arg_0; +void textureStore_441ba8() { + ivec3 arg_1 = ivec3(0); + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_441ba8(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba32ui) uniform highp writeonly uimage3D arg_0; +void textureStore_441ba8() { + ivec3 arg_1 = ivec3(0); + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_441ba8(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba32ui) uniform highp writeonly uimage3D arg_0; +void textureStore_441ba8() { + ivec3 arg_1 = ivec3(0); + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_441ba8(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/441ba8.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/441ba8.wgsl.expected.hlsl new file mode 100644 index 0000000000..3af481a9be --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/441ba8.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_441ba8() { + int3 arg_1 = (0).xxx; + uint4 arg_2 = (0u).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_441ba8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_441ba8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_441ba8(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/441ba8.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/441ba8.wgsl.expected.msl new file mode 100644 index 0000000000..1464ab71ad --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/441ba8.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_441ba8(texture3d tint_symbol_1) { + int3 arg_1 = int3(0); + uint4 arg_2 = uint4(0u); + tint_symbol_1.write(arg_2, uint3(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureStore_441ba8(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureStore_441ba8(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureStore_441ba8(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/441ba8.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/441ba8.wgsl.expected.spvasm new file mode 100644 index 0000000000..b6748801df --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/441ba8.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_441ba8 "textureStore_441ba8" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 3D 0 0 0 2 Rgba32ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %19 = OpConstantNull %v3int +%_ptr_Function_v3int = OpTypePointer Function %v3int + %v4uint = OpTypeVector %uint 4 + %23 = OpConstantNull %v4uint +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %30 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_441ba8 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v3int Function %19 + %arg_2 = OpVariable %_ptr_Function_v4uint Function %23 + OpStore %arg_1 %19 + OpStore %arg_2 %23 + %27 = OpLoad %11 %arg_0 + %28 = OpLoad %v3int %arg_1 + %29 = OpLoad %v4uint %arg_2 + OpImageWrite %27 %28 %29 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %textureStore_441ba8 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %36 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %39 = OpLabel + %40 = OpFunctionCall %void %textureStore_441ba8 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %42 = OpLabel + %43 = OpFunctionCall %void %textureStore_441ba8 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/441ba8.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/441ba8.wgsl.expected.wgsl new file mode 100644 index 0000000000..77c1fef041 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/441ba8.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureStore_441ba8() { + var arg_1 = vec3(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_441ba8(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_441ba8(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_441ba8(); +} diff --git a/test/tint/builtins/gen/var/textureStore/4fc057.wgsl b/test/tint/builtins/gen/var/textureStore/4fc057.wgsl new file mode 100644 index 0000000000..b1433f55fa --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/4fc057.wgsl @@ -0,0 +1,49 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureStore(texture: texture_storage_2d_array, coords: vec2, array_index: i32, value: vec4) +fn textureStore_4fc057() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = vec4(); + textureStore(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_4fc057(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_4fc057(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_4fc057(); +} diff --git a/test/tint/builtins/gen/var/textureStore/4fc057.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/4fc057.wgsl.expected.glsl new file mode 100644 index 0000000000..039e0bb9d9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/4fc057.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +layout(rgba8_snorm) uniform highp writeonly image2DArray arg_0; +void textureStore_4fc057() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + vec4 arg_3 = vec4(0.0f); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +vec4 vertex_main() { + textureStore_4fc057(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8_snorm) uniform highp writeonly image2DArray arg_0; +void textureStore_4fc057() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + vec4 arg_3 = vec4(0.0f); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +void fragment_main() { + textureStore_4fc057(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8_snorm) uniform highp writeonly image2DArray arg_0; +void textureStore_4fc057() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + vec4 arg_3 = vec4(0.0f); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +void compute_main() { + textureStore_4fc057(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/4fc057.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/4fc057.wgsl.expected.hlsl new file mode 100644 index 0000000000..ee4b614355 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/4fc057.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_4fc057() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + float4 arg_3 = (0.0f).xxxx; + arg_0[int3(arg_1, arg_2)] = arg_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_4fc057(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_4fc057(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_4fc057(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/4fc057.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/4fc057.wgsl.expected.msl new file mode 100644 index 0000000000..c7d5dbbda7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/4fc057.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureStore_4fc057(texture2d_array tint_symbol_1) { + int2 arg_1 = int2(0); + int arg_2 = 1; + float4 arg_3 = float4(0.0f); + tint_symbol_1.write(arg_3, uint2(arg_1), arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureStore_4fc057(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureStore_4fc057(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureStore_4fc057(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/4fc057.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/4fc057.wgsl.expected.spvasm new file mode 100644 index 0000000000..710a585b1b --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/4fc057.wgsl.expected.spvasm @@ -0,0 +1,92 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 50 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_4fc057 "textureStore_4fc057" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 2 Rgba8Snorm +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %18 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %v3int = OpTypeVector %int 3 + %36 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_4fc057 = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %18 + %arg_2 = OpVariable %_ptr_Function_int Function %24 + %arg_3 = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_1 %18 + OpStore %arg_2 %int_1 + OpStore %arg_3 %5 + %28 = OpLoad %11 %arg_0 + %30 = OpLoad %v2int %arg_1 + %31 = OpCompositeExtract %int %30 0 + %32 = OpCompositeExtract %int %30 1 + %33 = OpLoad %int %arg_2 + %34 = OpCompositeConstruct %v3int %31 %32 %33 + %35 = OpLoad %v4float %arg_3 + OpImageWrite %28 %34 %35 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %36 + %38 = OpLabel + %39 = OpFunctionCall %void %textureStore_4fc057 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %41 = OpLabel + %42 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %42 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %45 = OpLabel + %46 = OpFunctionCall %void %textureStore_4fc057 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %48 = OpLabel + %49 = OpFunctionCall %void %textureStore_4fc057 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/4fc057.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/4fc057.wgsl.expected.wgsl new file mode 100644 index 0000000000..5721e0306c --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/4fc057.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureStore_4fc057() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = vec4(); + textureStore(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_4fc057(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_4fc057(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_4fc057(); +} diff --git a/test/tint/builtins/gen/var/textureStore/5a2f8f.wgsl b/test/tint/builtins/gen/var/textureStore/5a2f8f.wgsl new file mode 100644 index 0000000000..90117ce765 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/5a2f8f.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureStore(texture: texture_storage_1d, coords: i32, value: vec4) +fn textureStore_5a2f8f() { + var arg_1 = 1; + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_5a2f8f(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_5a2f8f(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_5a2f8f(); +} diff --git a/test/tint/builtins/gen/var/textureStore/5a2f8f.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/5a2f8f.wgsl.expected.glsl new file mode 100644 index 0000000000..00c217817c --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/5a2f8f.wgsl.expected.glsl @@ -0,0 +1,84 @@ +SKIP: FAILED + +#version 310 es + +layout(rgba16i) uniform highp writeonly iimage1D arg_0; +void textureStore_5a2f8f() { + int arg_1 = 1; + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_5a2f8f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'iimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rgba16i) uniform highp writeonly iimage1D arg_0; +void textureStore_5a2f8f() { + int arg_1 = 1; + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_5a2f8f(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'iimage1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rgba16i) uniform highp writeonly iimage1D arg_0; +void textureStore_5a2f8f() { + int arg_1 = 1; + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_5a2f8f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'iimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureStore/5a2f8f.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/5a2f8f.wgsl.expected.hlsl new file mode 100644 index 0000000000..f6002770bf --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/5a2f8f.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_5a2f8f() { + int arg_1 = 1; + int4 arg_2 = (0).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_5a2f8f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_5a2f8f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_5a2f8f(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/5a2f8f.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/5a2f8f.wgsl.expected.msl new file mode 100644 index 0000000000..7ffe1a41c7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/5a2f8f.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_5a2f8f(texture1d tint_symbol_1) { + int arg_1 = 1; + int4 arg_2 = int4(0); + tint_symbol_1.write(arg_2, uint(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureStore_5a2f8f(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureStore_5a2f8f(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureStore_5a2f8f(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/5a2f8f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/5a2f8f.wgsl.expected.spvasm new file mode 100644 index 0000000000..8fd643704e --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/5a2f8f.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpCapability Image1D + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_5a2f8f "textureStore_5a2f8f" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 1D 0 0 0 2 Rgba16i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %20 = OpConstantNull %int + %v4int = OpTypeVector %int 4 + %22 = OpConstantNull %v4int +%_ptr_Function_v4int = OpTypePointer Function %v4int + %29 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_5a2f8f = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %20 + %arg_2 = OpVariable %_ptr_Function_v4int Function %22 + OpStore %arg_1 %int_1 + OpStore %arg_2 %22 + %26 = OpLoad %11 %arg_0 + %27 = OpLoad %int %arg_1 + %28 = OpLoad %v4int %arg_2 + OpImageWrite %26 %27 %28 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %29 + %31 = OpLabel + %32 = OpFunctionCall %void %textureStore_5a2f8f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %35 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %38 = OpLabel + %39 = OpFunctionCall %void %textureStore_5a2f8f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %41 = OpLabel + %42 = OpFunctionCall %void %textureStore_5a2f8f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/5a2f8f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/5a2f8f.wgsl.expected.wgsl new file mode 100644 index 0000000000..b2470f5ad6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/5a2f8f.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureStore_5a2f8f() { + var arg_1 = 1; + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_5a2f8f(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_5a2f8f(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_5a2f8f(); +} diff --git a/test/tint/builtins/gen/var/textureStore/60975f.wgsl b/test/tint/builtins/gen/var/textureStore/60975f.wgsl new file mode 100644 index 0000000000..c4a94b6524 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/60975f.wgsl @@ -0,0 +1,49 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureStore(texture: texture_storage_2d_array, coords: vec2, array_index: i32, value: vec4) +fn textureStore_60975f() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = vec4(); + textureStore(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_60975f(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_60975f(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_60975f(); +} diff --git a/test/tint/builtins/gen/var/textureStore/60975f.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/60975f.wgsl.expected.glsl new file mode 100644 index 0000000000..0a167a8d5d --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/60975f.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +layout(rgba8) uniform highp writeonly image2DArray arg_0; +void textureStore_60975f() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + vec4 arg_3 = vec4(0.0f); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +vec4 vertex_main() { + textureStore_60975f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8) uniform highp writeonly image2DArray arg_0; +void textureStore_60975f() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + vec4 arg_3 = vec4(0.0f); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +void fragment_main() { + textureStore_60975f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8) uniform highp writeonly image2DArray arg_0; +void textureStore_60975f() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + vec4 arg_3 = vec4(0.0f); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +void compute_main() { + textureStore_60975f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/60975f.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/60975f.wgsl.expected.hlsl new file mode 100644 index 0000000000..15c91c67eb --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/60975f.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_60975f() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + float4 arg_3 = (0.0f).xxxx; + arg_0[int3(arg_1, arg_2)] = arg_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_60975f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_60975f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_60975f(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/60975f.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/60975f.wgsl.expected.msl new file mode 100644 index 0000000000..e70fe51588 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/60975f.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureStore_60975f(texture2d_array tint_symbol_1) { + int2 arg_1 = int2(0); + int arg_2 = 1; + float4 arg_3 = float4(0.0f); + tint_symbol_1.write(arg_3, uint2(arg_1), arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureStore_60975f(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureStore_60975f(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureStore_60975f(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/60975f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/60975f.wgsl.expected.spvasm new file mode 100644 index 0000000000..7807d15407 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/60975f.wgsl.expected.spvasm @@ -0,0 +1,92 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 50 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_60975f "textureStore_60975f" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 2 Rgba8 +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %18 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %v3int = OpTypeVector %int 3 + %36 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_60975f = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %18 + %arg_2 = OpVariable %_ptr_Function_int Function %24 + %arg_3 = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_1 %18 + OpStore %arg_2 %int_1 + OpStore %arg_3 %5 + %28 = OpLoad %11 %arg_0 + %30 = OpLoad %v2int %arg_1 + %31 = OpCompositeExtract %int %30 0 + %32 = OpCompositeExtract %int %30 1 + %33 = OpLoad %int %arg_2 + %34 = OpCompositeConstruct %v3int %31 %32 %33 + %35 = OpLoad %v4float %arg_3 + OpImageWrite %28 %34 %35 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %36 + %38 = OpLabel + %39 = OpFunctionCall %void %textureStore_60975f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %41 = OpLabel + %42 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %42 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %45 = OpLabel + %46 = OpFunctionCall %void %textureStore_60975f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %48 = OpLabel + %49 = OpFunctionCall %void %textureStore_60975f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/60975f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/60975f.wgsl.expected.wgsl new file mode 100644 index 0000000000..78911cc18b --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/60975f.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureStore_60975f() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = vec4(); + textureStore(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_60975f(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_60975f(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_60975f(); +} diff --git a/test/tint/builtins/gen/var/textureStore/682fd6.wgsl b/test/tint/builtins/gen/var/textureStore/682fd6.wgsl new file mode 100644 index 0000000000..5be4263777 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/682fd6.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureStore(texture: texture_storage_2d, coords: vec2, value: vec4) +fn textureStore_682fd6() { + var arg_1 = vec2(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_682fd6(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_682fd6(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_682fd6(); +} diff --git a/test/tint/builtins/gen/var/textureStore/682fd6.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/682fd6.wgsl.expected.glsl new file mode 100644 index 0000000000..02980deab8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/682fd6.wgsl.expected.glsl @@ -0,0 +1,81 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32ui) uniform highp writeonly uimage2D arg_0; +void textureStore_682fd6() { + ivec2 arg_1 = ivec2(0); + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_682fd6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32ui) uniform highp writeonly uimage2D arg_0; +void textureStore_682fd6() { + ivec2 arg_1 = ivec2(0); + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_682fd6(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32ui) uniform highp writeonly uimage2D arg_0; +void textureStore_682fd6() { + ivec2 arg_1 = ivec2(0); + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_682fd6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureStore/682fd6.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/682fd6.wgsl.expected.hlsl new file mode 100644 index 0000000000..613ddb2446 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/682fd6.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_682fd6() { + int2 arg_1 = (0).xx; + uint4 arg_2 = (0u).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_682fd6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_682fd6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_682fd6(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/682fd6.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/682fd6.wgsl.expected.msl new file mode 100644 index 0000000000..8ef52b03f9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/682fd6.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_682fd6(texture2d tint_symbol_1) { + int2 arg_1 = int2(0); + uint4 arg_2 = uint4(0u); + tint_symbol_1.write(arg_2, uint2(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureStore_682fd6(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureStore_682fd6(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureStore_682fd6(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/682fd6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/682fd6.wgsl.expected.spvasm new file mode 100644 index 0000000000..e7ffff92e8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/682fd6.wgsl.expected.spvasm @@ -0,0 +1,85 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpCapability StorageImageExtendedFormats + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_682fd6 "textureStore_682fd6" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 0 0 2 Rg32ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %19 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %v4uint = OpTypeVector %uint 4 + %23 = OpConstantNull %v4uint +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %30 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_682fd6 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %19 + %arg_2 = OpVariable %_ptr_Function_v4uint Function %23 + OpStore %arg_1 %19 + OpStore %arg_2 %23 + %27 = OpLoad %11 %arg_0 + %28 = OpLoad %v2int %arg_1 + %29 = OpLoad %v4uint %arg_2 + OpImageWrite %27 %28 %29 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %textureStore_682fd6 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %36 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %39 = OpLabel + %40 = OpFunctionCall %void %textureStore_682fd6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %42 = OpLabel + %43 = OpFunctionCall %void %textureStore_682fd6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/682fd6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/682fd6.wgsl.expected.wgsl new file mode 100644 index 0000000000..8539d14d09 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/682fd6.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureStore_682fd6() { + var arg_1 = vec2(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_682fd6(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_682fd6(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_682fd6(); +} diff --git a/test/tint/builtins/gen/var/textureStore/6b75c3.wgsl b/test/tint/builtins/gen/var/textureStore/6b75c3.wgsl new file mode 100644 index 0000000000..aac4b66cdc --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/6b75c3.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureStore(texture: texture_storage_1d, coords: i32, value: vec4) +fn textureStore_6b75c3() { + var arg_1 = 1; + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_6b75c3(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_6b75c3(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_6b75c3(); +} diff --git a/test/tint/builtins/gen/var/textureStore/6b75c3.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/6b75c3.wgsl.expected.glsl new file mode 100644 index 0000000000..851f0cb487 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/6b75c3.wgsl.expected.glsl @@ -0,0 +1,84 @@ +SKIP: FAILED + +#version 310 es + +layout(rgba32f) uniform highp writeonly image1D arg_0; +void textureStore_6b75c3() { + int arg_1 = 1; + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_6b75c3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rgba32f) uniform highp writeonly image1D arg_0; +void textureStore_6b75c3() { + int arg_1 = 1; + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_6b75c3(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rgba32f) uniform highp writeonly image1D arg_0; +void textureStore_6b75c3() { + int arg_1 = 1; + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_6b75c3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureStore/6b75c3.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/6b75c3.wgsl.expected.hlsl new file mode 100644 index 0000000000..d1842f9a0f --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/6b75c3.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_6b75c3() { + int arg_1 = 1; + float4 arg_2 = (0.0f).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_6b75c3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_6b75c3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_6b75c3(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/6b75c3.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/6b75c3.wgsl.expected.msl new file mode 100644 index 0000000000..525cdb8cf8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/6b75c3.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_6b75c3(texture1d tint_symbol_1) { + int arg_1 = 1; + float4 arg_2 = float4(0.0f); + tint_symbol_1.write(arg_2, uint(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureStore_6b75c3(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureStore_6b75c3(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureStore_6b75c3(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/6b75c3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/6b75c3.wgsl.expected.spvasm new file mode 100644 index 0000000000..436599f7ec --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/6b75c3.wgsl.expected.spvasm @@ -0,0 +1,82 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpCapability Image1D + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_6b75c3 "textureStore_6b75c3" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 1D 0 0 0 2 Rgba32f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %20 = OpConstantNull %int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_6b75c3 = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %20 + %arg_2 = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_1 %int_1 + OpStore %arg_2 %5 + %24 = OpLoad %11 %arg_0 + %25 = OpLoad %int %arg_1 + %26 = OpLoad %v4float %arg_2 + OpImageWrite %24 %25 %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %textureStore_6b75c3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureStore_6b75c3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %39 = OpLabel + %40 = OpFunctionCall %void %textureStore_6b75c3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/6b75c3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/6b75c3.wgsl.expected.wgsl new file mode 100644 index 0000000000..8cc3cbd919 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/6b75c3.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureStore_6b75c3() { + var arg_1 = 1; + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_6b75c3(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_6b75c3(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_6b75c3(); +} diff --git a/test/tint/builtins/gen/var/textureStore/6b80d2.wgsl b/test/tint/builtins/gen/var/textureStore/6b80d2.wgsl new file mode 100644 index 0000000000..6579162a9d --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/6b80d2.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureStore(texture: texture_storage_1d, coords: i32, value: vec4) +fn textureStore_6b80d2() { + var arg_1 = 1; + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_6b80d2(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_6b80d2(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_6b80d2(); +} diff --git a/test/tint/builtins/gen/var/textureStore/6b80d2.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/6b80d2.wgsl.expected.glsl new file mode 100644 index 0000000000..2fd85dc9f8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/6b80d2.wgsl.expected.glsl @@ -0,0 +1,84 @@ +SKIP: FAILED + +#version 310 es + +layout(r32i) uniform highp writeonly iimage1D arg_0; +void textureStore_6b80d2() { + int arg_1 = 1; + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_6b80d2(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'iimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(r32i) uniform highp writeonly iimage1D arg_0; +void textureStore_6b80d2() { + int arg_1 = 1; + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_6b80d2(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'iimage1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(r32i) uniform highp writeonly iimage1D arg_0; +void textureStore_6b80d2() { + int arg_1 = 1; + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_6b80d2(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'iimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureStore/6b80d2.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/6b80d2.wgsl.expected.hlsl new file mode 100644 index 0000000000..dc45c996a0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/6b80d2.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_6b80d2() { + int arg_1 = 1; + int4 arg_2 = (0).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_6b80d2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_6b80d2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_6b80d2(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/6b80d2.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/6b80d2.wgsl.expected.msl new file mode 100644 index 0000000000..4ec6f6e3c5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/6b80d2.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_6b80d2(texture1d tint_symbol_1) { + int arg_1 = 1; + int4 arg_2 = int4(0); + tint_symbol_1.write(arg_2, uint(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureStore_6b80d2(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureStore_6b80d2(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureStore_6b80d2(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/6b80d2.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/6b80d2.wgsl.expected.spvasm new file mode 100644 index 0000000000..cc127a7c30 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/6b80d2.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpCapability Image1D + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_6b80d2 "textureStore_6b80d2" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 1D 0 0 0 2 R32i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %20 = OpConstantNull %int + %v4int = OpTypeVector %int 4 + %22 = OpConstantNull %v4int +%_ptr_Function_v4int = OpTypePointer Function %v4int + %29 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_6b80d2 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %20 + %arg_2 = OpVariable %_ptr_Function_v4int Function %22 + OpStore %arg_1 %int_1 + OpStore %arg_2 %22 + %26 = OpLoad %11 %arg_0 + %27 = OpLoad %int %arg_1 + %28 = OpLoad %v4int %arg_2 + OpImageWrite %26 %27 %28 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %29 + %31 = OpLabel + %32 = OpFunctionCall %void %textureStore_6b80d2 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %35 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %38 = OpLabel + %39 = OpFunctionCall %void %textureStore_6b80d2 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %41 = OpLabel + %42 = OpFunctionCall %void %textureStore_6b80d2 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/6b80d2.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/6b80d2.wgsl.expected.wgsl new file mode 100644 index 0000000000..857f14248d --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/6b80d2.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureStore_6b80d2() { + var arg_1 = 1; + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_6b80d2(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_6b80d2(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_6b80d2(); +} diff --git a/test/tint/builtins/gen/var/textureStore/6cff2e.wgsl b/test/tint/builtins/gen/var/textureStore/6cff2e.wgsl new file mode 100644 index 0000000000..b675a270dc --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/6cff2e.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureStore(texture: texture_storage_2d, coords: vec2, value: vec4) +fn textureStore_6cff2e() { + var arg_1 = vec2(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_6cff2e(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_6cff2e(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_6cff2e(); +} diff --git a/test/tint/builtins/gen/var/textureStore/6cff2e.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/6cff2e.wgsl.expected.glsl new file mode 100644 index 0000000000..31dca2829c --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/6cff2e.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +layout(r32ui) uniform highp writeonly uimage2D arg_0; +void textureStore_6cff2e() { + ivec2 arg_1 = ivec2(0); + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_6cff2e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(r32ui) uniform highp writeonly uimage2D arg_0; +void textureStore_6cff2e() { + ivec2 arg_1 = ivec2(0); + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_6cff2e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(r32ui) uniform highp writeonly uimage2D arg_0; +void textureStore_6cff2e() { + ivec2 arg_1 = ivec2(0); + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_6cff2e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/6cff2e.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/6cff2e.wgsl.expected.hlsl new file mode 100644 index 0000000000..030b9a173c --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/6cff2e.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_6cff2e() { + int2 arg_1 = (0).xx; + uint4 arg_2 = (0u).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_6cff2e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_6cff2e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_6cff2e(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/6cff2e.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/6cff2e.wgsl.expected.msl new file mode 100644 index 0000000000..47ac09aac6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/6cff2e.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_6cff2e(texture2d tint_symbol_1) { + int2 arg_1 = int2(0); + uint4 arg_2 = uint4(0u); + tint_symbol_1.write(arg_2, uint2(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureStore_6cff2e(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureStore_6cff2e(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureStore_6cff2e(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/6cff2e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/6cff2e.wgsl.expected.spvasm new file mode 100644 index 0000000000..7907a0009e --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/6cff2e.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_6cff2e "textureStore_6cff2e" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 0 0 2 R32ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %19 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %v4uint = OpTypeVector %uint 4 + %23 = OpConstantNull %v4uint +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %30 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_6cff2e = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %19 + %arg_2 = OpVariable %_ptr_Function_v4uint Function %23 + OpStore %arg_1 %19 + OpStore %arg_2 %23 + %27 = OpLoad %11 %arg_0 + %28 = OpLoad %v2int %arg_1 + %29 = OpLoad %v4uint %arg_2 + OpImageWrite %27 %28 %29 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %textureStore_6cff2e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %36 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %39 = OpLabel + %40 = OpFunctionCall %void %textureStore_6cff2e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %42 = OpLabel + %43 = OpFunctionCall %void %textureStore_6cff2e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/6cff2e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/6cff2e.wgsl.expected.wgsl new file mode 100644 index 0000000000..2278e2ca7f --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/6cff2e.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureStore_6cff2e() { + var arg_1 = vec2(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_6cff2e(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_6cff2e(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_6cff2e(); +} diff --git a/test/tint/builtins/gen/var/textureStore/6da692.wgsl b/test/tint/builtins/gen/var/textureStore/6da692.wgsl new file mode 100644 index 0000000000..a2738e3be5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/6da692.wgsl @@ -0,0 +1,49 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureStore(texture: texture_storage_2d_array, coords: vec2, array_index: i32, value: vec4) +fn textureStore_6da692() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = vec4(); + textureStore(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_6da692(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_6da692(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_6da692(); +} diff --git a/test/tint/builtins/gen/var/textureStore/6da692.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/6da692.wgsl.expected.glsl new file mode 100644 index 0000000000..c7bc567f98 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/6da692.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +layout(rgba16ui) uniform highp writeonly uimage2DArray arg_0; +void textureStore_6da692() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + uvec4 arg_3 = uvec4(0u); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +vec4 vertex_main() { + textureStore_6da692(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba16ui) uniform highp writeonly uimage2DArray arg_0; +void textureStore_6da692() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + uvec4 arg_3 = uvec4(0u); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +void fragment_main() { + textureStore_6da692(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba16ui) uniform highp writeonly uimage2DArray arg_0; +void textureStore_6da692() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + uvec4 arg_3 = uvec4(0u); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +void compute_main() { + textureStore_6da692(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/6da692.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/6da692.wgsl.expected.hlsl new file mode 100644 index 0000000000..2188ce1d44 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/6da692.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_6da692() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + uint4 arg_3 = (0u).xxxx; + arg_0[int3(arg_1, arg_2)] = arg_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_6da692(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_6da692(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_6da692(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/6da692.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/6da692.wgsl.expected.msl new file mode 100644 index 0000000000..305d2bdb7c --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/6da692.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureStore_6da692(texture2d_array tint_symbol_1) { + int2 arg_1 = int2(0); + int arg_2 = 1; + uint4 arg_3 = uint4(0u); + tint_symbol_1.write(arg_3, uint2(arg_1), arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureStore_6da692(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureStore_6da692(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureStore_6da692(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/6da692.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/6da692.wgsl.expected.spvasm new file mode 100644 index 0000000000..4296871beb --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/6da692.wgsl.expected.spvasm @@ -0,0 +1,95 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 53 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_6da692 "textureStore_6da692" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 1 0 2 Rgba16ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %19 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %25 = OpConstantNull %int + %v4uint = OpTypeVector %uint 4 + %27 = OpConstantNull %v4uint +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %v3int = OpTypeVector %int 3 + %39 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_6da692 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %19 + %arg_2 = OpVariable %_ptr_Function_int Function %25 + %arg_3 = OpVariable %_ptr_Function_v4uint Function %27 + OpStore %arg_1 %19 + OpStore %arg_2 %int_1 + OpStore %arg_3 %27 + %31 = OpLoad %11 %arg_0 + %33 = OpLoad %v2int %arg_1 + %34 = OpCompositeExtract %int %33 0 + %35 = OpCompositeExtract %int %33 1 + %36 = OpLoad %int %arg_2 + %37 = OpCompositeConstruct %v3int %34 %35 %36 + %38 = OpLoad %v4uint %arg_3 + OpImageWrite %31 %37 %38 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %39 + %41 = OpLabel + %42 = OpFunctionCall %void %textureStore_6da692 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %44 = OpLabel + %45 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %45 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %48 = OpLabel + %49 = OpFunctionCall %void %textureStore_6da692 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %51 = OpLabel + %52 = OpFunctionCall %void %textureStore_6da692 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/6da692.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/6da692.wgsl.expected.wgsl new file mode 100644 index 0000000000..9c99fa7865 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/6da692.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureStore_6da692() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = vec4(); + textureStore(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_6da692(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_6da692(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_6da692(); +} diff --git a/test/tint/builtins/gen/var/textureStore/731349.wgsl b/test/tint/builtins/gen/var/textureStore/731349.wgsl new file mode 100644 index 0000000000..513104fc22 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/731349.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureStore(texture: texture_storage_2d, coords: vec2, value: vec4) +fn textureStore_731349() { + var arg_1 = vec2(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_731349(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_731349(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_731349(); +} diff --git a/test/tint/builtins/gen/var/textureStore/731349.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/731349.wgsl.expected.glsl new file mode 100644 index 0000000000..2fc13d7a11 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/731349.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +layout(rgba8) uniform highp writeonly image2D arg_0; +void textureStore_731349() { + ivec2 arg_1 = ivec2(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_731349(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8) uniform highp writeonly image2D arg_0; +void textureStore_731349() { + ivec2 arg_1 = ivec2(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_731349(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8) uniform highp writeonly image2D arg_0; +void textureStore_731349() { + ivec2 arg_1 = ivec2(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_731349(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/731349.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/731349.wgsl.expected.hlsl new file mode 100644 index 0000000000..96475461bf --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/731349.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_731349() { + int2 arg_1 = (0).xx; + float4 arg_2 = (0.0f).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_731349(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_731349(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_731349(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/731349.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/731349.wgsl.expected.msl new file mode 100644 index 0000000000..f7898d74ca --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/731349.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_731349(texture2d tint_symbol_1) { + int2 arg_1 = int2(0); + float4 arg_2 = float4(0.0f); + tint_symbol_1.write(arg_2, uint2(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureStore_731349(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureStore_731349(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureStore_731349(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/731349.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/731349.wgsl.expected.spvasm new file mode 100644 index 0000000000..0d4982f853 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/731349.wgsl.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_731349 "textureStore_731349" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 2 Rgba8 +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %18 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_731349 = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %18 + %arg_2 = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_1 %18 + OpStore %arg_2 %5 + %24 = OpLoad %11 %arg_0 + %25 = OpLoad %v2int %arg_1 + %26 = OpLoad %v4float %arg_2 + OpImageWrite %24 %25 %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %textureStore_731349 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureStore_731349 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %39 = OpLabel + %40 = OpFunctionCall %void %textureStore_731349 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/731349.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/731349.wgsl.expected.wgsl new file mode 100644 index 0000000000..6e8011a4a9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/731349.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureStore_731349() { + var arg_1 = vec2(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_731349(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_731349(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_731349(); +} diff --git a/test/tint/builtins/gen/var/textureStore/752da6.wgsl b/test/tint/builtins/gen/var/textureStore/752da6.wgsl new file mode 100644 index 0000000000..7d568bef02 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/752da6.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureStore(texture: texture_storage_2d, coords: vec2, value: vec4) +fn textureStore_752da6() { + var arg_1 = vec2(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_752da6(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_752da6(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_752da6(); +} diff --git a/test/tint/builtins/gen/var/textureStore/752da6.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/752da6.wgsl.expected.glsl new file mode 100644 index 0000000000..4c49f79992 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/752da6.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +layout(rgba32i) uniform highp writeonly iimage2D arg_0; +void textureStore_752da6() { + ivec2 arg_1 = ivec2(0); + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_752da6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba32i) uniform highp writeonly iimage2D arg_0; +void textureStore_752da6() { + ivec2 arg_1 = ivec2(0); + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_752da6(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba32i) uniform highp writeonly iimage2D arg_0; +void textureStore_752da6() { + ivec2 arg_1 = ivec2(0); + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_752da6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/752da6.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/752da6.wgsl.expected.hlsl new file mode 100644 index 0000000000..74afe66697 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/752da6.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_752da6() { + int2 arg_1 = (0).xx; + int4 arg_2 = (0).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_752da6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_752da6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_752da6(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/752da6.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/752da6.wgsl.expected.msl new file mode 100644 index 0000000000..14805dc55f --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/752da6.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_752da6(texture2d tint_symbol_1) { + int2 arg_1 = int2(0); + int4 arg_2 = int4(0); + tint_symbol_1.write(arg_2, uint2(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureStore_752da6(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureStore_752da6(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureStore_752da6(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/752da6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/752da6.wgsl.expected.spvasm new file mode 100644 index 0000000000..4b831a25d5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/752da6.wgsl.expected.spvasm @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_752da6 "textureStore_752da6" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 0 0 2 Rgba32i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v2int = OpTypeVector %int 2 + %18 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %v4int = OpTypeVector %int 4 + %22 = OpConstantNull %v4int +%_ptr_Function_v4int = OpTypePointer Function %v4int + %29 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_752da6 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %18 + %arg_2 = OpVariable %_ptr_Function_v4int Function %22 + OpStore %arg_1 %18 + OpStore %arg_2 %22 + %26 = OpLoad %11 %arg_0 + %27 = OpLoad %v2int %arg_1 + %28 = OpLoad %v4int %arg_2 + OpImageWrite %26 %27 %28 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %29 + %31 = OpLabel + %32 = OpFunctionCall %void %textureStore_752da6 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %35 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %38 = OpLabel + %39 = OpFunctionCall %void %textureStore_752da6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %41 = OpLabel + %42 = OpFunctionCall %void %textureStore_752da6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/752da6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/752da6.wgsl.expected.wgsl new file mode 100644 index 0000000000..7a2a16b73c --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/752da6.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureStore_752da6() { + var arg_1 = vec2(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_752da6(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_752da6(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_752da6(); +} diff --git a/test/tint/builtins/gen/var/textureStore/77c0ae.wgsl b/test/tint/builtins/gen/var/textureStore/77c0ae.wgsl new file mode 100644 index 0000000000..b68362e760 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/77c0ae.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureStore(texture: texture_storage_2d, coords: vec2, value: vec4) +fn textureStore_77c0ae() { + var arg_1 = vec2(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_77c0ae(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_77c0ae(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_77c0ae(); +} diff --git a/test/tint/builtins/gen/var/textureStore/77c0ae.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/77c0ae.wgsl.expected.glsl new file mode 100644 index 0000000000..ebdb9079da --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/77c0ae.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +layout(rgba8ui) uniform highp writeonly uimage2D arg_0; +void textureStore_77c0ae() { + ivec2 arg_1 = ivec2(0); + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_77c0ae(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8ui) uniform highp writeonly uimage2D arg_0; +void textureStore_77c0ae() { + ivec2 arg_1 = ivec2(0); + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_77c0ae(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8ui) uniform highp writeonly uimage2D arg_0; +void textureStore_77c0ae() { + ivec2 arg_1 = ivec2(0); + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_77c0ae(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/77c0ae.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/77c0ae.wgsl.expected.hlsl new file mode 100644 index 0000000000..04dafb025f --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/77c0ae.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_77c0ae() { + int2 arg_1 = (0).xx; + uint4 arg_2 = (0u).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_77c0ae(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_77c0ae(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_77c0ae(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/77c0ae.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/77c0ae.wgsl.expected.msl new file mode 100644 index 0000000000..d7d84576de --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/77c0ae.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_77c0ae(texture2d tint_symbol_1) { + int2 arg_1 = int2(0); + uint4 arg_2 = uint4(0u); + tint_symbol_1.write(arg_2, uint2(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureStore_77c0ae(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureStore_77c0ae(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureStore_77c0ae(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/77c0ae.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/77c0ae.wgsl.expected.spvasm new file mode 100644 index 0000000000..6bacd0e827 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/77c0ae.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_77c0ae "textureStore_77c0ae" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 0 0 2 Rgba8ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %19 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %v4uint = OpTypeVector %uint 4 + %23 = OpConstantNull %v4uint +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %30 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_77c0ae = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %19 + %arg_2 = OpVariable %_ptr_Function_v4uint Function %23 + OpStore %arg_1 %19 + OpStore %arg_2 %23 + %27 = OpLoad %11 %arg_0 + %28 = OpLoad %v2int %arg_1 + %29 = OpLoad %v4uint %arg_2 + OpImageWrite %27 %28 %29 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %textureStore_77c0ae + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %36 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %39 = OpLabel + %40 = OpFunctionCall %void %textureStore_77c0ae + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %42 = OpLabel + %43 = OpFunctionCall %void %textureStore_77c0ae + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/77c0ae.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/77c0ae.wgsl.expected.wgsl new file mode 100644 index 0000000000..6be0361cce --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/77c0ae.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureStore_77c0ae() { + var arg_1 = vec2(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_77c0ae(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_77c0ae(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_77c0ae(); +} diff --git a/test/tint/builtins/gen/var/textureStore/7cec8d.wgsl b/test/tint/builtins/gen/var/textureStore/7cec8d.wgsl new file mode 100644 index 0000000000..8dd0b94893 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/7cec8d.wgsl @@ -0,0 +1,49 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureStore(texture: texture_storage_2d_array, coords: vec2, array_index: i32, value: vec4) +fn textureStore_7cec8d() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = vec4(); + textureStore(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_7cec8d(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_7cec8d(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_7cec8d(); +} diff --git a/test/tint/builtins/gen/var/textureStore/7cec8d.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/7cec8d.wgsl.expected.glsl new file mode 100644 index 0000000000..05b54d94dc --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/7cec8d.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +layout(rgba32i) uniform highp writeonly iimage2DArray arg_0; +void textureStore_7cec8d() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + ivec4 arg_3 = ivec4(0); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +vec4 vertex_main() { + textureStore_7cec8d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba32i) uniform highp writeonly iimage2DArray arg_0; +void textureStore_7cec8d() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + ivec4 arg_3 = ivec4(0); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +void fragment_main() { + textureStore_7cec8d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba32i) uniform highp writeonly iimage2DArray arg_0; +void textureStore_7cec8d() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + ivec4 arg_3 = ivec4(0); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +void compute_main() { + textureStore_7cec8d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/7cec8d.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/7cec8d.wgsl.expected.hlsl new file mode 100644 index 0000000000..d31432b373 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/7cec8d.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_7cec8d() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + int4 arg_3 = (0).xxxx; + arg_0[int3(arg_1, arg_2)] = arg_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_7cec8d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_7cec8d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_7cec8d(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/7cec8d.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/7cec8d.wgsl.expected.msl new file mode 100644 index 0000000000..bc6820285a --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/7cec8d.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureStore_7cec8d(texture2d_array tint_symbol_1) { + int2 arg_1 = int2(0); + int arg_2 = 1; + int4 arg_3 = int4(0); + tint_symbol_1.write(arg_3, uint2(arg_1), arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureStore_7cec8d(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureStore_7cec8d(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureStore_7cec8d(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/7cec8d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/7cec8d.wgsl.expected.spvasm new file mode 100644 index 0000000000..b36ee5ff45 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/7cec8d.wgsl.expected.spvasm @@ -0,0 +1,94 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 52 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_7cec8d "textureStore_7cec8d" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 1 0 2 Rgba32i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v2int = OpTypeVector %int 2 + %18 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int + %v4int = OpTypeVector %int 4 + %26 = OpConstantNull %v4int +%_ptr_Function_v4int = OpTypePointer Function %v4int + %v3int = OpTypeVector %int 3 + %38 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_7cec8d = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %18 + %arg_2 = OpVariable %_ptr_Function_int Function %24 + %arg_3 = OpVariable %_ptr_Function_v4int Function %26 + OpStore %arg_1 %18 + OpStore %arg_2 %int_1 + OpStore %arg_3 %26 + %30 = OpLoad %11 %arg_0 + %32 = OpLoad %v2int %arg_1 + %33 = OpCompositeExtract %int %32 0 + %34 = OpCompositeExtract %int %32 1 + %35 = OpLoad %int %arg_2 + %36 = OpCompositeConstruct %v3int %33 %34 %35 + %37 = OpLoad %v4int %arg_3 + OpImageWrite %30 %36 %37 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %38 + %40 = OpLabel + %41 = OpFunctionCall %void %textureStore_7cec8d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %43 = OpLabel + %44 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %44 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %47 = OpLabel + %48 = OpFunctionCall %void %textureStore_7cec8d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %50 = OpLabel + %51 = OpFunctionCall %void %textureStore_7cec8d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/7cec8d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/7cec8d.wgsl.expected.wgsl new file mode 100644 index 0000000000..56e1988bf5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/7cec8d.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureStore_7cec8d() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = vec4(); + textureStore(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_7cec8d(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_7cec8d(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_7cec8d(); +} diff --git a/test/tint/builtins/gen/var/textureStore/7f7fae.wgsl b/test/tint/builtins/gen/var/textureStore/7f7fae.wgsl new file mode 100644 index 0000000000..e1ac747c4e --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/7f7fae.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureStore(texture: texture_storage_1d, coords: i32, value: vec4) +fn textureStore_7f7fae() { + var arg_1 = 1; + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_7f7fae(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_7f7fae(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_7f7fae(); +} diff --git a/test/tint/builtins/gen/var/textureStore/7f7fae.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/7f7fae.wgsl.expected.glsl new file mode 100644 index 0000000000..1658f25e1a --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/7f7fae.wgsl.expected.glsl @@ -0,0 +1,84 @@ +SKIP: FAILED + +#version 310 es + +layout(rgba8) uniform highp writeonly image1D arg_0; +void textureStore_7f7fae() { + int arg_1 = 1; + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_7f7fae(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rgba8) uniform highp writeonly image1D arg_0; +void textureStore_7f7fae() { + int arg_1 = 1; + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_7f7fae(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rgba8) uniform highp writeonly image1D arg_0; +void textureStore_7f7fae() { + int arg_1 = 1; + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_7f7fae(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureStore/7f7fae.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/7f7fae.wgsl.expected.hlsl new file mode 100644 index 0000000000..6d80e547de --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/7f7fae.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_7f7fae() { + int arg_1 = 1; + float4 arg_2 = (0.0f).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_7f7fae(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_7f7fae(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_7f7fae(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/7f7fae.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/7f7fae.wgsl.expected.msl new file mode 100644 index 0000000000..a991af17f1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/7f7fae.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_7f7fae(texture1d tint_symbol_1) { + int arg_1 = 1; + float4 arg_2 = float4(0.0f); + tint_symbol_1.write(arg_2, uint(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureStore_7f7fae(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureStore_7f7fae(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureStore_7f7fae(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/7f7fae.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/7f7fae.wgsl.expected.spvasm new file mode 100644 index 0000000000..aace840d49 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/7f7fae.wgsl.expected.spvasm @@ -0,0 +1,82 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpCapability Image1D + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_7f7fae "textureStore_7f7fae" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 1D 0 0 0 2 Rgba8 +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %20 = OpConstantNull %int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_7f7fae = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %20 + %arg_2 = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_1 %int_1 + OpStore %arg_2 %5 + %24 = OpLoad %11 %arg_0 + %25 = OpLoad %int %arg_1 + %26 = OpLoad %v4float %arg_2 + OpImageWrite %24 %25 %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %textureStore_7f7fae + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureStore_7f7fae + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %39 = OpLabel + %40 = OpFunctionCall %void %textureStore_7f7fae + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/7f7fae.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/7f7fae.wgsl.expected.wgsl new file mode 100644 index 0000000000..0c41e78672 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/7f7fae.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureStore_7f7fae() { + var arg_1 = 1; + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_7f7fae(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_7f7fae(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_7f7fae(); +} diff --git a/test/tint/builtins/gen/var/textureStore/804942.wgsl b/test/tint/builtins/gen/var/textureStore/804942.wgsl new file mode 100644 index 0000000000..47d4ac7ceb --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/804942.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureStore(texture: texture_storage_2d, coords: vec2, value: vec4) +fn textureStore_804942() { + var arg_1 = vec2(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_804942(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_804942(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_804942(); +} diff --git a/test/tint/builtins/gen/var/textureStore/804942.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/804942.wgsl.expected.glsl new file mode 100644 index 0000000000..e99ccc58e4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/804942.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +layout(r32i) uniform highp writeonly iimage2D arg_0; +void textureStore_804942() { + ivec2 arg_1 = ivec2(0); + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_804942(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(r32i) uniform highp writeonly iimage2D arg_0; +void textureStore_804942() { + ivec2 arg_1 = ivec2(0); + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_804942(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(r32i) uniform highp writeonly iimage2D arg_0; +void textureStore_804942() { + ivec2 arg_1 = ivec2(0); + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_804942(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/804942.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/804942.wgsl.expected.hlsl new file mode 100644 index 0000000000..f2f0dd3b7d --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/804942.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_804942() { + int2 arg_1 = (0).xx; + int4 arg_2 = (0).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_804942(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_804942(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_804942(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/804942.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/804942.wgsl.expected.msl new file mode 100644 index 0000000000..d2e755d720 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/804942.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_804942(texture2d tint_symbol_1) { + int2 arg_1 = int2(0); + int4 arg_2 = int4(0); + tint_symbol_1.write(arg_2, uint2(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureStore_804942(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureStore_804942(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureStore_804942(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/804942.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/804942.wgsl.expected.spvasm new file mode 100644 index 0000000000..b6cc2c9c14 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/804942.wgsl.expected.spvasm @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_804942 "textureStore_804942" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 0 0 2 R32i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v2int = OpTypeVector %int 2 + %18 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %v4int = OpTypeVector %int 4 + %22 = OpConstantNull %v4int +%_ptr_Function_v4int = OpTypePointer Function %v4int + %29 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_804942 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %18 + %arg_2 = OpVariable %_ptr_Function_v4int Function %22 + OpStore %arg_1 %18 + OpStore %arg_2 %22 + %26 = OpLoad %11 %arg_0 + %27 = OpLoad %v2int %arg_1 + %28 = OpLoad %v4int %arg_2 + OpImageWrite %26 %27 %28 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %29 + %31 = OpLabel + %32 = OpFunctionCall %void %textureStore_804942 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %35 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %38 = OpLabel + %39 = OpFunctionCall %void %textureStore_804942 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %41 = OpLabel + %42 = OpFunctionCall %void %textureStore_804942 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/804942.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/804942.wgsl.expected.wgsl new file mode 100644 index 0000000000..12e178d4a1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/804942.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureStore_804942() { + var arg_1 = vec2(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_804942(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_804942(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_804942(); +} diff --git a/test/tint/builtins/gen/var/textureStore/805dae.wgsl b/test/tint/builtins/gen/var/textureStore/805dae.wgsl new file mode 100644 index 0000000000..edab8e5319 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/805dae.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureStore(texture: texture_storage_2d, coords: vec2, value: vec4) +fn textureStore_805dae() { + var arg_1 = vec2(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_805dae(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_805dae(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_805dae(); +} diff --git a/test/tint/builtins/gen/var/textureStore/805dae.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/805dae.wgsl.expected.glsl new file mode 100644 index 0000000000..77e3041e20 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/805dae.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +layout(rgba8_snorm) uniform highp writeonly image2D arg_0; +void textureStore_805dae() { + ivec2 arg_1 = ivec2(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_805dae(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8_snorm) uniform highp writeonly image2D arg_0; +void textureStore_805dae() { + ivec2 arg_1 = ivec2(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_805dae(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8_snorm) uniform highp writeonly image2D arg_0; +void textureStore_805dae() { + ivec2 arg_1 = ivec2(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_805dae(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/805dae.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/805dae.wgsl.expected.hlsl new file mode 100644 index 0000000000..b251d9f807 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/805dae.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_805dae() { + int2 arg_1 = (0).xx; + float4 arg_2 = (0.0f).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_805dae(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_805dae(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_805dae(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/805dae.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/805dae.wgsl.expected.msl new file mode 100644 index 0000000000..8ba8e4802e --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/805dae.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_805dae(texture2d tint_symbol_1) { + int2 arg_1 = int2(0); + float4 arg_2 = float4(0.0f); + tint_symbol_1.write(arg_2, uint2(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureStore_805dae(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureStore_805dae(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureStore_805dae(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/805dae.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/805dae.wgsl.expected.spvasm new file mode 100644 index 0000000000..0bcb46d765 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/805dae.wgsl.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_805dae "textureStore_805dae" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 2 Rgba8Snorm +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %18 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_805dae = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %18 + %arg_2 = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_1 %18 + OpStore %arg_2 %5 + %24 = OpLoad %11 %arg_0 + %25 = OpLoad %v2int %arg_1 + %26 = OpLoad %v4float %arg_2 + OpImageWrite %24 %25 %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %textureStore_805dae + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureStore_805dae + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %39 = OpLabel + %40 = OpFunctionCall %void %textureStore_805dae + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/805dae.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/805dae.wgsl.expected.wgsl new file mode 100644 index 0000000000..d2ce87cbca --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/805dae.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureStore_805dae() { + var arg_1 = vec2(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_805dae(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_805dae(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_805dae(); +} diff --git a/test/tint/builtins/gen/var/textureStore/83bcc1.wgsl b/test/tint/builtins/gen/var/textureStore/83bcc1.wgsl new file mode 100644 index 0000000000..d44459af5e --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/83bcc1.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureStore(texture: texture_storage_1d, coords: i32, value: vec4) +fn textureStore_83bcc1() { + var arg_1 = 1; + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_83bcc1(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_83bcc1(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_83bcc1(); +} diff --git a/test/tint/builtins/gen/var/textureStore/83bcc1.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/83bcc1.wgsl.expected.glsl new file mode 100644 index 0000000000..d44613f744 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/83bcc1.wgsl.expected.glsl @@ -0,0 +1,81 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32ui) uniform highp writeonly uimage1D arg_0; +void textureStore_83bcc1() { + int arg_1 = 1; + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_83bcc1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32ui) uniform highp writeonly uimage1D arg_0; +void textureStore_83bcc1() { + int arg_1 = 1; + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_83bcc1(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32ui) uniform highp writeonly uimage1D arg_0; +void textureStore_83bcc1() { + int arg_1 = 1; + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_83bcc1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureStore/83bcc1.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/83bcc1.wgsl.expected.hlsl new file mode 100644 index 0000000000..b606a3a1ab --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/83bcc1.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_83bcc1() { + int arg_1 = 1; + uint4 arg_2 = (0u).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_83bcc1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_83bcc1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_83bcc1(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/83bcc1.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/83bcc1.wgsl.expected.msl new file mode 100644 index 0000000000..bf59f21af9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/83bcc1.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_83bcc1(texture1d tint_symbol_1) { + int arg_1 = 1; + uint4 arg_2 = uint4(0u); + tint_symbol_1.write(arg_2, uint(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureStore_83bcc1(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureStore_83bcc1(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureStore_83bcc1(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/83bcc1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/83bcc1.wgsl.expected.spvasm new file mode 100644 index 0000000000..da8b6bf230 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/83bcc1.wgsl.expected.spvasm @@ -0,0 +1,86 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpCapability Image1D + OpCapability StorageImageExtendedFormats + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_83bcc1 "textureStore_83bcc1" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 1D 0 0 0 2 Rg32ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %v4uint = OpTypeVector %uint 4 + %23 = OpConstantNull %v4uint +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %30 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_83bcc1 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %21 + %arg_2 = OpVariable %_ptr_Function_v4uint Function %23 + OpStore %arg_1 %int_1 + OpStore %arg_2 %23 + %27 = OpLoad %11 %arg_0 + %28 = OpLoad %int %arg_1 + %29 = OpLoad %v4uint %arg_2 + OpImageWrite %27 %28 %29 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %textureStore_83bcc1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %36 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %39 = OpLabel + %40 = OpFunctionCall %void %textureStore_83bcc1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %42 = OpLabel + %43 = OpFunctionCall %void %textureStore_83bcc1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/83bcc1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/83bcc1.wgsl.expected.wgsl new file mode 100644 index 0000000000..ba0a1d8289 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/83bcc1.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureStore_83bcc1() { + var arg_1 = 1; + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_83bcc1(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_83bcc1(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_83bcc1(); +} diff --git a/test/tint/builtins/gen/var/textureStore/872747.wgsl b/test/tint/builtins/gen/var/textureStore/872747.wgsl new file mode 100644 index 0000000000..67d6535709 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/872747.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureStore(texture: texture_storage_1d, coords: i32, value: vec4) +fn textureStore_872747() { + var arg_1 = 1; + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_872747(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_872747(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_872747(); +} diff --git a/test/tint/builtins/gen/var/textureStore/872747.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/872747.wgsl.expected.glsl new file mode 100644 index 0000000000..c07a4da762 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/872747.wgsl.expected.glsl @@ -0,0 +1,81 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32f) uniform highp writeonly image1D arg_0; +void textureStore_872747() { + int arg_1 = 1; + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_872747(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32f) uniform highp writeonly image1D arg_0; +void textureStore_872747() { + int arg_1 = 1; + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_872747(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32f) uniform highp writeonly image1D arg_0; +void textureStore_872747() { + int arg_1 = 1; + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_872747(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureStore/872747.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/872747.wgsl.expected.hlsl new file mode 100644 index 0000000000..9c937a509e --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/872747.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_872747() { + int arg_1 = 1; + float4 arg_2 = (0.0f).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_872747(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_872747(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_872747(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/872747.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/872747.wgsl.expected.msl new file mode 100644 index 0000000000..fcb5caa91f --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/872747.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_872747(texture1d tint_symbol_1) { + int arg_1 = 1; + float4 arg_2 = float4(0.0f); + tint_symbol_1.write(arg_2, uint(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureStore_872747(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureStore_872747(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureStore_872747(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/872747.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/872747.wgsl.expected.spvasm new file mode 100644 index 0000000000..a197ec4bcc --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/872747.wgsl.expected.spvasm @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpCapability Image1D + OpCapability StorageImageExtendedFormats + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_872747 "textureStore_872747" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 1D 0 0 0 2 Rg32f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %20 = OpConstantNull %int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_872747 = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %20 + %arg_2 = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_1 %int_1 + OpStore %arg_2 %5 + %24 = OpLoad %11 %arg_0 + %25 = OpLoad %int %arg_1 + %26 = OpLoad %v4float %arg_2 + OpImageWrite %24 %25 %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %textureStore_872747 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureStore_872747 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %39 = OpLabel + %40 = OpFunctionCall %void %textureStore_872747 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/872747.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/872747.wgsl.expected.wgsl new file mode 100644 index 0000000000..a3090874f8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/872747.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureStore_872747() { + var arg_1 = 1; + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_872747(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_872747(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_872747(); +} diff --git a/test/tint/builtins/gen/var/textureStore/8e0479.wgsl b/test/tint/builtins/gen/var/textureStore/8e0479.wgsl new file mode 100644 index 0000000000..857a68801f --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/8e0479.wgsl @@ -0,0 +1,49 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureStore(texture: texture_storage_2d_array, coords: vec2, array_index: i32, value: vec4) +fn textureStore_8e0479() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = vec4(); + textureStore(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_8e0479(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_8e0479(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_8e0479(); +} diff --git a/test/tint/builtins/gen/var/textureStore/8e0479.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/8e0479.wgsl.expected.glsl new file mode 100644 index 0000000000..0a78791db4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/8e0479.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +layout(rgba32ui) uniform highp writeonly uimage2DArray arg_0; +void textureStore_8e0479() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + uvec4 arg_3 = uvec4(0u); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +vec4 vertex_main() { + textureStore_8e0479(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba32ui) uniform highp writeonly uimage2DArray arg_0; +void textureStore_8e0479() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + uvec4 arg_3 = uvec4(0u); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +void fragment_main() { + textureStore_8e0479(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba32ui) uniform highp writeonly uimage2DArray arg_0; +void textureStore_8e0479() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + uvec4 arg_3 = uvec4(0u); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +void compute_main() { + textureStore_8e0479(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/8e0479.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/8e0479.wgsl.expected.hlsl new file mode 100644 index 0000000000..24d93ef7cf --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/8e0479.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_8e0479() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + uint4 arg_3 = (0u).xxxx; + arg_0[int3(arg_1, arg_2)] = arg_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_8e0479(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_8e0479(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_8e0479(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/8e0479.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/8e0479.wgsl.expected.msl new file mode 100644 index 0000000000..6ad4aba381 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/8e0479.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureStore_8e0479(texture2d_array tint_symbol_1) { + int2 arg_1 = int2(0); + int arg_2 = 1; + uint4 arg_3 = uint4(0u); + tint_symbol_1.write(arg_3, uint2(arg_1), arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureStore_8e0479(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureStore_8e0479(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureStore_8e0479(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/8e0479.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/8e0479.wgsl.expected.spvasm new file mode 100644 index 0000000000..baca5da445 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/8e0479.wgsl.expected.spvasm @@ -0,0 +1,95 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 53 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_8e0479 "textureStore_8e0479" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 1 0 2 Rgba32ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %19 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %25 = OpConstantNull %int + %v4uint = OpTypeVector %uint 4 + %27 = OpConstantNull %v4uint +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %v3int = OpTypeVector %int 3 + %39 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_8e0479 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %19 + %arg_2 = OpVariable %_ptr_Function_int Function %25 + %arg_3 = OpVariable %_ptr_Function_v4uint Function %27 + OpStore %arg_1 %19 + OpStore %arg_2 %int_1 + OpStore %arg_3 %27 + %31 = OpLoad %11 %arg_0 + %33 = OpLoad %v2int %arg_1 + %34 = OpCompositeExtract %int %33 0 + %35 = OpCompositeExtract %int %33 1 + %36 = OpLoad %int %arg_2 + %37 = OpCompositeConstruct %v3int %34 %35 %36 + %38 = OpLoad %v4uint %arg_3 + OpImageWrite %31 %37 %38 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %39 + %41 = OpLabel + %42 = OpFunctionCall %void %textureStore_8e0479 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %44 = OpLabel + %45 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %45 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %48 = OpLabel + %49 = OpFunctionCall %void %textureStore_8e0479 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %51 = OpLabel + %52 = OpFunctionCall %void %textureStore_8e0479 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/8e0479.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/8e0479.wgsl.expected.wgsl new file mode 100644 index 0000000000..7a726a22da --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/8e0479.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureStore_8e0479() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = vec4(); + textureStore(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_8e0479(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_8e0479(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_8e0479(); +} diff --git a/test/tint/builtins/gen/var/textureStore/8f71a1.wgsl b/test/tint/builtins/gen/var/textureStore/8f71a1.wgsl new file mode 100644 index 0000000000..8d2c6b9418 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/8f71a1.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureStore(texture: texture_storage_3d, coords: vec3, value: vec4) +fn textureStore_8f71a1() { + var arg_1 = vec3(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_8f71a1(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_8f71a1(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_8f71a1(); +} diff --git a/test/tint/builtins/gen/var/textureStore/8f71a1.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/8f71a1.wgsl.expected.glsl new file mode 100644 index 0000000000..ebb51a8ba0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/8f71a1.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +layout(rgba16i) uniform highp writeonly iimage3D arg_0; +void textureStore_8f71a1() { + ivec3 arg_1 = ivec3(0); + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_8f71a1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba16i) uniform highp writeonly iimage3D arg_0; +void textureStore_8f71a1() { + ivec3 arg_1 = ivec3(0); + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_8f71a1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba16i) uniform highp writeonly iimage3D arg_0; +void textureStore_8f71a1() { + ivec3 arg_1 = ivec3(0); + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_8f71a1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/8f71a1.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/8f71a1.wgsl.expected.hlsl new file mode 100644 index 0000000000..513e3775f0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/8f71a1.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_8f71a1() { + int3 arg_1 = (0).xxx; + int4 arg_2 = (0).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_8f71a1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_8f71a1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_8f71a1(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/8f71a1.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/8f71a1.wgsl.expected.msl new file mode 100644 index 0000000000..bf5a54ee48 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/8f71a1.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_8f71a1(texture3d tint_symbol_1) { + int3 arg_1 = int3(0); + int4 arg_2 = int4(0); + tint_symbol_1.write(arg_2, uint3(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureStore_8f71a1(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureStore_8f71a1(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureStore_8f71a1(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/8f71a1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/8f71a1.wgsl.expected.spvasm new file mode 100644 index 0000000000..14926980e7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/8f71a1.wgsl.expected.spvasm @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_8f71a1 "textureStore_8f71a1" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 3D 0 0 0 2 Rgba16i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v3int = OpTypeVector %int 3 + %18 = OpConstantNull %v3int +%_ptr_Function_v3int = OpTypePointer Function %v3int + %v4int = OpTypeVector %int 4 + %22 = OpConstantNull %v4int +%_ptr_Function_v4int = OpTypePointer Function %v4int + %29 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_8f71a1 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v3int Function %18 + %arg_2 = OpVariable %_ptr_Function_v4int Function %22 + OpStore %arg_1 %18 + OpStore %arg_2 %22 + %26 = OpLoad %11 %arg_0 + %27 = OpLoad %v3int %arg_1 + %28 = OpLoad %v4int %arg_2 + OpImageWrite %26 %27 %28 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %29 + %31 = OpLabel + %32 = OpFunctionCall %void %textureStore_8f71a1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %35 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %38 = OpLabel + %39 = OpFunctionCall %void %textureStore_8f71a1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %41 = OpLabel + %42 = OpFunctionCall %void %textureStore_8f71a1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/8f71a1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/8f71a1.wgsl.expected.wgsl new file mode 100644 index 0000000000..c031e90f5b --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/8f71a1.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureStore_8f71a1() { + var arg_1 = vec3(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_8f71a1(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_8f71a1(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_8f71a1(); +} diff --git a/test/tint/builtins/gen/var/textureStore/969534.wgsl b/test/tint/builtins/gen/var/textureStore/969534.wgsl new file mode 100644 index 0000000000..a37d5b8ce0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/969534.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureStore(texture: texture_storage_1d, coords: i32, value: vec4) +fn textureStore_969534() { + var arg_1 = 1; + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_969534(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_969534(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_969534(); +} diff --git a/test/tint/builtins/gen/var/textureStore/969534.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/969534.wgsl.expected.glsl new file mode 100644 index 0000000000..488d24e1cc --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/969534.wgsl.expected.glsl @@ -0,0 +1,84 @@ +SKIP: FAILED + +#version 310 es + +layout(rgba32i) uniform highp writeonly iimage1D arg_0; +void textureStore_969534() { + int arg_1 = 1; + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_969534(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'iimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rgba32i) uniform highp writeonly iimage1D arg_0; +void textureStore_969534() { + int arg_1 = 1; + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_969534(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'iimage1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rgba32i) uniform highp writeonly iimage1D arg_0; +void textureStore_969534() { + int arg_1 = 1; + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_969534(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'iimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureStore/969534.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/969534.wgsl.expected.hlsl new file mode 100644 index 0000000000..abe1eac2a2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/969534.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_969534() { + int arg_1 = 1; + int4 arg_2 = (0).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_969534(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_969534(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_969534(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/969534.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/969534.wgsl.expected.msl new file mode 100644 index 0000000000..aed04dd167 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/969534.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_969534(texture1d tint_symbol_1) { + int arg_1 = 1; + int4 arg_2 = int4(0); + tint_symbol_1.write(arg_2, uint(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureStore_969534(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureStore_969534(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureStore_969534(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/969534.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/969534.wgsl.expected.spvasm new file mode 100644 index 0000000000..74def9c76e --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/969534.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpCapability Image1D + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_969534 "textureStore_969534" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 1D 0 0 0 2 Rgba32i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %20 = OpConstantNull %int + %v4int = OpTypeVector %int 4 + %22 = OpConstantNull %v4int +%_ptr_Function_v4int = OpTypePointer Function %v4int + %29 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_969534 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %20 + %arg_2 = OpVariable %_ptr_Function_v4int Function %22 + OpStore %arg_1 %int_1 + OpStore %arg_2 %22 + %26 = OpLoad %11 %arg_0 + %27 = OpLoad %int %arg_1 + %28 = OpLoad %v4int %arg_2 + OpImageWrite %26 %27 %28 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %29 + %31 = OpLabel + %32 = OpFunctionCall %void %textureStore_969534 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %35 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %38 = OpLabel + %39 = OpFunctionCall %void %textureStore_969534 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %41 = OpLabel + %42 = OpFunctionCall %void %textureStore_969534 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/969534.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/969534.wgsl.expected.wgsl new file mode 100644 index 0000000000..0b2dbba4bb --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/969534.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureStore_969534() { + var arg_1 = 1; + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_969534(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_969534(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_969534(); +} diff --git a/test/tint/builtins/gen/var/textureStore/9a3ecc.wgsl b/test/tint/builtins/gen/var/textureStore/9a3ecc.wgsl new file mode 100644 index 0000000000..57062ce348 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/9a3ecc.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureStore(texture: texture_storage_3d, coords: vec3, value: vec4) +fn textureStore_9a3ecc() { + var arg_1 = vec3(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_9a3ecc(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_9a3ecc(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_9a3ecc(); +} diff --git a/test/tint/builtins/gen/var/textureStore/9a3ecc.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/9a3ecc.wgsl.expected.glsl new file mode 100644 index 0000000000..9beb825420 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/9a3ecc.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +layout(rgba32i) uniform highp writeonly iimage3D arg_0; +void textureStore_9a3ecc() { + ivec3 arg_1 = ivec3(0); + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_9a3ecc(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba32i) uniform highp writeonly iimage3D arg_0; +void textureStore_9a3ecc() { + ivec3 arg_1 = ivec3(0); + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_9a3ecc(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba32i) uniform highp writeonly iimage3D arg_0; +void textureStore_9a3ecc() { + ivec3 arg_1 = ivec3(0); + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_9a3ecc(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/9a3ecc.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/9a3ecc.wgsl.expected.hlsl new file mode 100644 index 0000000000..f6dae1cba2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/9a3ecc.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_9a3ecc() { + int3 arg_1 = (0).xxx; + int4 arg_2 = (0).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_9a3ecc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_9a3ecc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_9a3ecc(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/9a3ecc.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/9a3ecc.wgsl.expected.msl new file mode 100644 index 0000000000..44b8e33d0c --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/9a3ecc.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_9a3ecc(texture3d tint_symbol_1) { + int3 arg_1 = int3(0); + int4 arg_2 = int4(0); + tint_symbol_1.write(arg_2, uint3(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureStore_9a3ecc(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureStore_9a3ecc(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureStore_9a3ecc(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/9a3ecc.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/9a3ecc.wgsl.expected.spvasm new file mode 100644 index 0000000000..7b6db7c21b --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/9a3ecc.wgsl.expected.spvasm @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_9a3ecc "textureStore_9a3ecc" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 3D 0 0 0 2 Rgba32i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v3int = OpTypeVector %int 3 + %18 = OpConstantNull %v3int +%_ptr_Function_v3int = OpTypePointer Function %v3int + %v4int = OpTypeVector %int 4 + %22 = OpConstantNull %v4int +%_ptr_Function_v4int = OpTypePointer Function %v4int + %29 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_9a3ecc = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v3int Function %18 + %arg_2 = OpVariable %_ptr_Function_v4int Function %22 + OpStore %arg_1 %18 + OpStore %arg_2 %22 + %26 = OpLoad %11 %arg_0 + %27 = OpLoad %v3int %arg_1 + %28 = OpLoad %v4int %arg_2 + OpImageWrite %26 %27 %28 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %29 + %31 = OpLabel + %32 = OpFunctionCall %void %textureStore_9a3ecc + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %35 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %38 = OpLabel + %39 = OpFunctionCall %void %textureStore_9a3ecc + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %41 = OpLabel + %42 = OpFunctionCall %void %textureStore_9a3ecc + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/9a3ecc.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/9a3ecc.wgsl.expected.wgsl new file mode 100644 index 0000000000..2c723c016c --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/9a3ecc.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureStore_9a3ecc() { + var arg_1 = vec3(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_9a3ecc(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_9a3ecc(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_9a3ecc(); +} diff --git a/test/tint/builtins/gen/var/textureStore/9d9cd5.wgsl b/test/tint/builtins/gen/var/textureStore/9d9cd5.wgsl new file mode 100644 index 0000000000..6e7832e87d --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/9d9cd5.wgsl @@ -0,0 +1,49 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureStore(texture: texture_storage_2d_array, coords: vec2, array_index: i32, value: vec4) +fn textureStore_9d9cd5() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = vec4(); + textureStore(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_9d9cd5(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_9d9cd5(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_9d9cd5(); +} diff --git a/test/tint/builtins/gen/var/textureStore/9d9cd5.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/9d9cd5.wgsl.expected.glsl new file mode 100644 index 0000000000..05a0d53f2d --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/9d9cd5.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +layout(rgba32f) uniform highp writeonly image2DArray arg_0; +void textureStore_9d9cd5() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + vec4 arg_3 = vec4(0.0f); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +vec4 vertex_main() { + textureStore_9d9cd5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba32f) uniform highp writeonly image2DArray arg_0; +void textureStore_9d9cd5() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + vec4 arg_3 = vec4(0.0f); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +void fragment_main() { + textureStore_9d9cd5(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba32f) uniform highp writeonly image2DArray arg_0; +void textureStore_9d9cd5() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + vec4 arg_3 = vec4(0.0f); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +void compute_main() { + textureStore_9d9cd5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/9d9cd5.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/9d9cd5.wgsl.expected.hlsl new file mode 100644 index 0000000000..63531a6046 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/9d9cd5.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_9d9cd5() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + float4 arg_3 = (0.0f).xxxx; + arg_0[int3(arg_1, arg_2)] = arg_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_9d9cd5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_9d9cd5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_9d9cd5(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/9d9cd5.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/9d9cd5.wgsl.expected.msl new file mode 100644 index 0000000000..48036cda82 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/9d9cd5.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureStore_9d9cd5(texture2d_array tint_symbol_1) { + int2 arg_1 = int2(0); + int arg_2 = 1; + float4 arg_3 = float4(0.0f); + tint_symbol_1.write(arg_3, uint2(arg_1), arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureStore_9d9cd5(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureStore_9d9cd5(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureStore_9d9cd5(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/9d9cd5.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/9d9cd5.wgsl.expected.spvasm new file mode 100644 index 0000000000..9e3237055b --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/9d9cd5.wgsl.expected.spvasm @@ -0,0 +1,92 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 50 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_9d9cd5 "textureStore_9d9cd5" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 2 Rgba32f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %18 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %v3int = OpTypeVector %int 3 + %36 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_9d9cd5 = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %18 + %arg_2 = OpVariable %_ptr_Function_int Function %24 + %arg_3 = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_1 %18 + OpStore %arg_2 %int_1 + OpStore %arg_3 %5 + %28 = OpLoad %11 %arg_0 + %30 = OpLoad %v2int %arg_1 + %31 = OpCompositeExtract %int %30 0 + %32 = OpCompositeExtract %int %30 1 + %33 = OpLoad %int %arg_2 + %34 = OpCompositeConstruct %v3int %31 %32 %33 + %35 = OpLoad %v4float %arg_3 + OpImageWrite %28 %34 %35 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %36 + %38 = OpLabel + %39 = OpFunctionCall %void %textureStore_9d9cd5 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %41 = OpLabel + %42 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %42 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %45 = OpLabel + %46 = OpFunctionCall %void %textureStore_9d9cd5 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %48 = OpLabel + %49 = OpFunctionCall %void %textureStore_9d9cd5 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/9d9cd5.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/9d9cd5.wgsl.expected.wgsl new file mode 100644 index 0000000000..b2a600b0e8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/9d9cd5.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureStore_9d9cd5() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = vec4(); + textureStore(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_9d9cd5(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_9d9cd5(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_9d9cd5(); +} diff --git a/test/tint/builtins/gen/var/textureStore/9e3ec5.wgsl b/test/tint/builtins/gen/var/textureStore/9e3ec5.wgsl new file mode 100644 index 0000000000..7e1d29aa7f --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/9e3ec5.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureStore(texture: texture_storage_2d, coords: vec2, value: vec4) +fn textureStore_9e3ec5() { + var arg_1 = vec2(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_9e3ec5(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_9e3ec5(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_9e3ec5(); +} diff --git a/test/tint/builtins/gen/var/textureStore/9e3ec5.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/9e3ec5.wgsl.expected.glsl new file mode 100644 index 0000000000..19ace0b4cb --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/9e3ec5.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +layout(rgba16i) uniform highp writeonly iimage2D arg_0; +void textureStore_9e3ec5() { + ivec2 arg_1 = ivec2(0); + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_9e3ec5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba16i) uniform highp writeonly iimage2D arg_0; +void textureStore_9e3ec5() { + ivec2 arg_1 = ivec2(0); + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_9e3ec5(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba16i) uniform highp writeonly iimage2D arg_0; +void textureStore_9e3ec5() { + ivec2 arg_1 = ivec2(0); + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_9e3ec5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/9e3ec5.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/9e3ec5.wgsl.expected.hlsl new file mode 100644 index 0000000000..0c02acb52b --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/9e3ec5.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_9e3ec5() { + int2 arg_1 = (0).xx; + int4 arg_2 = (0).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_9e3ec5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_9e3ec5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_9e3ec5(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/9e3ec5.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/9e3ec5.wgsl.expected.msl new file mode 100644 index 0000000000..942418d022 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/9e3ec5.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_9e3ec5(texture2d tint_symbol_1) { + int2 arg_1 = int2(0); + int4 arg_2 = int4(0); + tint_symbol_1.write(arg_2, uint2(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureStore_9e3ec5(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureStore_9e3ec5(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureStore_9e3ec5(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/9e3ec5.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/9e3ec5.wgsl.expected.spvasm new file mode 100644 index 0000000000..4ce3d9ee19 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/9e3ec5.wgsl.expected.spvasm @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_9e3ec5 "textureStore_9e3ec5" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 0 0 2 Rgba16i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v2int = OpTypeVector %int 2 + %18 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %v4int = OpTypeVector %int 4 + %22 = OpConstantNull %v4int +%_ptr_Function_v4int = OpTypePointer Function %v4int + %29 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_9e3ec5 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %18 + %arg_2 = OpVariable %_ptr_Function_v4int Function %22 + OpStore %arg_1 %18 + OpStore %arg_2 %22 + %26 = OpLoad %11 %arg_0 + %27 = OpLoad %v2int %arg_1 + %28 = OpLoad %v4int %arg_2 + OpImageWrite %26 %27 %28 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %29 + %31 = OpLabel + %32 = OpFunctionCall %void %textureStore_9e3ec5 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %35 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %38 = OpLabel + %39 = OpFunctionCall %void %textureStore_9e3ec5 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %41 = OpLabel + %42 = OpFunctionCall %void %textureStore_9e3ec5 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/9e3ec5.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/9e3ec5.wgsl.expected.wgsl new file mode 100644 index 0000000000..d024cb7e06 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/9e3ec5.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureStore_9e3ec5() { + var arg_1 = vec2(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_9e3ec5(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_9e3ec5(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_9e3ec5(); +} diff --git a/test/tint/builtins/gen/var/textureStore/ac67aa.wgsl b/test/tint/builtins/gen/var/textureStore/ac67aa.wgsl new file mode 100644 index 0000000000..0ecf9586f9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/ac67aa.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureStore(texture: texture_storage_3d, coords: vec3, value: vec4) +fn textureStore_ac67aa() { + var arg_1 = vec3(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_ac67aa(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_ac67aa(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_ac67aa(); +} diff --git a/test/tint/builtins/gen/var/textureStore/ac67aa.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/ac67aa.wgsl.expected.glsl new file mode 100644 index 0000000000..95a8c41a1b --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/ac67aa.wgsl.expected.glsl @@ -0,0 +1,81 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32ui) uniform highp writeonly uimage3D arg_0; +void textureStore_ac67aa() { + ivec3 arg_1 = ivec3(0); + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_ac67aa(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32ui) uniform highp writeonly uimage3D arg_0; +void textureStore_ac67aa() { + ivec3 arg_1 = ivec3(0); + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_ac67aa(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32ui) uniform highp writeonly uimage3D arg_0; +void textureStore_ac67aa() { + ivec3 arg_1 = ivec3(0); + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_ac67aa(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureStore/ac67aa.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/ac67aa.wgsl.expected.hlsl new file mode 100644 index 0000000000..b36799d5e1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/ac67aa.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_ac67aa() { + int3 arg_1 = (0).xxx; + uint4 arg_2 = (0u).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_ac67aa(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_ac67aa(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_ac67aa(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/ac67aa.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/ac67aa.wgsl.expected.msl new file mode 100644 index 0000000000..bff5a97664 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/ac67aa.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_ac67aa(texture3d tint_symbol_1) { + int3 arg_1 = int3(0); + uint4 arg_2 = uint4(0u); + tint_symbol_1.write(arg_2, uint3(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureStore_ac67aa(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureStore_ac67aa(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureStore_ac67aa(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/ac67aa.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/ac67aa.wgsl.expected.spvasm new file mode 100644 index 0000000000..df550ab8db --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/ac67aa.wgsl.expected.spvasm @@ -0,0 +1,85 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpCapability StorageImageExtendedFormats + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_ac67aa "textureStore_ac67aa" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 3D 0 0 0 2 Rg32ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %19 = OpConstantNull %v3int +%_ptr_Function_v3int = OpTypePointer Function %v3int + %v4uint = OpTypeVector %uint 4 + %23 = OpConstantNull %v4uint +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %30 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_ac67aa = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v3int Function %19 + %arg_2 = OpVariable %_ptr_Function_v4uint Function %23 + OpStore %arg_1 %19 + OpStore %arg_2 %23 + %27 = OpLoad %11 %arg_0 + %28 = OpLoad %v3int %arg_1 + %29 = OpLoad %v4uint %arg_2 + OpImageWrite %27 %28 %29 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %textureStore_ac67aa + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %36 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %39 = OpLabel + %40 = OpFunctionCall %void %textureStore_ac67aa + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %42 = OpLabel + %43 = OpFunctionCall %void %textureStore_ac67aa + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/ac67aa.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/ac67aa.wgsl.expected.wgsl new file mode 100644 index 0000000000..9dd770c619 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/ac67aa.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureStore_ac67aa() { + var arg_1 = vec3(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_ac67aa(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_ac67aa(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_ac67aa(); +} diff --git a/test/tint/builtins/gen/var/textureStore/b706b1.wgsl b/test/tint/builtins/gen/var/textureStore/b706b1.wgsl new file mode 100644 index 0000000000..200a8315d8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/b706b1.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureStore(texture: texture_storage_3d, coords: vec3, value: vec4) +fn textureStore_b706b1() { + var arg_1 = vec3(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_b706b1(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_b706b1(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_b706b1(); +} diff --git a/test/tint/builtins/gen/var/textureStore/b706b1.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/b706b1.wgsl.expected.glsl new file mode 100644 index 0000000000..72e03e7354 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/b706b1.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +layout(rgba8i) uniform highp writeonly iimage3D arg_0; +void textureStore_b706b1() { + ivec3 arg_1 = ivec3(0); + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_b706b1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8i) uniform highp writeonly iimage3D arg_0; +void textureStore_b706b1() { + ivec3 arg_1 = ivec3(0); + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_b706b1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8i) uniform highp writeonly iimage3D arg_0; +void textureStore_b706b1() { + ivec3 arg_1 = ivec3(0); + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_b706b1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/b706b1.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/b706b1.wgsl.expected.hlsl new file mode 100644 index 0000000000..4e961147c9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/b706b1.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_b706b1() { + int3 arg_1 = (0).xxx; + int4 arg_2 = (0).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_b706b1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_b706b1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_b706b1(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/b706b1.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/b706b1.wgsl.expected.msl new file mode 100644 index 0000000000..635cb6c0f1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/b706b1.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_b706b1(texture3d tint_symbol_1) { + int3 arg_1 = int3(0); + int4 arg_2 = int4(0); + tint_symbol_1.write(arg_2, uint3(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureStore_b706b1(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureStore_b706b1(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureStore_b706b1(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/b706b1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/b706b1.wgsl.expected.spvasm new file mode 100644 index 0000000000..32c2bcb935 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/b706b1.wgsl.expected.spvasm @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_b706b1 "textureStore_b706b1" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 3D 0 0 0 2 Rgba8i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v3int = OpTypeVector %int 3 + %18 = OpConstantNull %v3int +%_ptr_Function_v3int = OpTypePointer Function %v3int + %v4int = OpTypeVector %int 4 + %22 = OpConstantNull %v4int +%_ptr_Function_v4int = OpTypePointer Function %v4int + %29 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_b706b1 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v3int Function %18 + %arg_2 = OpVariable %_ptr_Function_v4int Function %22 + OpStore %arg_1 %18 + OpStore %arg_2 %22 + %26 = OpLoad %11 %arg_0 + %27 = OpLoad %v3int %arg_1 + %28 = OpLoad %v4int %arg_2 + OpImageWrite %26 %27 %28 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %29 + %31 = OpLabel + %32 = OpFunctionCall %void %textureStore_b706b1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %35 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %38 = OpLabel + %39 = OpFunctionCall %void %textureStore_b706b1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %41 = OpLabel + %42 = OpFunctionCall %void %textureStore_b706b1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/b706b1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/b706b1.wgsl.expected.wgsl new file mode 100644 index 0000000000..4e5ab39c45 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/b706b1.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureStore_b706b1() { + var arg_1 = vec3(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_b706b1(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_b706b1(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_b706b1(); +} diff --git a/test/tint/builtins/gen/var/textureStore/bbcb7f.wgsl b/test/tint/builtins/gen/var/textureStore/bbcb7f.wgsl new file mode 100644 index 0000000000..58d83e457f --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/bbcb7f.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureStore(texture: texture_storage_2d, coords: vec2, value: vec4) +fn textureStore_bbcb7f() { + var arg_1 = vec2(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_bbcb7f(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_bbcb7f(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_bbcb7f(); +} diff --git a/test/tint/builtins/gen/var/textureStore/bbcb7f.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/bbcb7f.wgsl.expected.glsl new file mode 100644 index 0000000000..2b486d8fb8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/bbcb7f.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +layout(rgba8i) uniform highp writeonly iimage2D arg_0; +void textureStore_bbcb7f() { + ivec2 arg_1 = ivec2(0); + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_bbcb7f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8i) uniform highp writeonly iimage2D arg_0; +void textureStore_bbcb7f() { + ivec2 arg_1 = ivec2(0); + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_bbcb7f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8i) uniform highp writeonly iimage2D arg_0; +void textureStore_bbcb7f() { + ivec2 arg_1 = ivec2(0); + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_bbcb7f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/bbcb7f.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/bbcb7f.wgsl.expected.hlsl new file mode 100644 index 0000000000..366a2e7824 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/bbcb7f.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_bbcb7f() { + int2 arg_1 = (0).xx; + int4 arg_2 = (0).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_bbcb7f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_bbcb7f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_bbcb7f(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/bbcb7f.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/bbcb7f.wgsl.expected.msl new file mode 100644 index 0000000000..0a942853e1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/bbcb7f.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_bbcb7f(texture2d tint_symbol_1) { + int2 arg_1 = int2(0); + int4 arg_2 = int4(0); + tint_symbol_1.write(arg_2, uint2(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureStore_bbcb7f(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureStore_bbcb7f(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureStore_bbcb7f(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/bbcb7f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/bbcb7f.wgsl.expected.spvasm new file mode 100644 index 0000000000..59e7b74967 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/bbcb7f.wgsl.expected.spvasm @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_bbcb7f "textureStore_bbcb7f" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 0 0 2 Rgba8i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v2int = OpTypeVector %int 2 + %18 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %v4int = OpTypeVector %int 4 + %22 = OpConstantNull %v4int +%_ptr_Function_v4int = OpTypePointer Function %v4int + %29 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_bbcb7f = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %18 + %arg_2 = OpVariable %_ptr_Function_v4int Function %22 + OpStore %arg_1 %18 + OpStore %arg_2 %22 + %26 = OpLoad %11 %arg_0 + %27 = OpLoad %v2int %arg_1 + %28 = OpLoad %v4int %arg_2 + OpImageWrite %26 %27 %28 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %29 + %31 = OpLabel + %32 = OpFunctionCall %void %textureStore_bbcb7f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %35 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %38 = OpLabel + %39 = OpFunctionCall %void %textureStore_bbcb7f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %41 = OpLabel + %42 = OpFunctionCall %void %textureStore_bbcb7f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/bbcb7f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/bbcb7f.wgsl.expected.wgsl new file mode 100644 index 0000000000..87d0a02ffd --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/bbcb7f.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureStore_bbcb7f() { + var arg_1 = vec2(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_bbcb7f(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_bbcb7f(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_bbcb7f(); +} diff --git a/test/tint/builtins/gen/var/textureStore/be6e30.wgsl b/test/tint/builtins/gen/var/textureStore/be6e30.wgsl new file mode 100644 index 0000000000..e0293cc995 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/be6e30.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureStore(texture: texture_storage_2d, coords: vec2, value: vec4) +fn textureStore_be6e30() { + var arg_1 = vec2(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_be6e30(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_be6e30(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_be6e30(); +} diff --git a/test/tint/builtins/gen/var/textureStore/be6e30.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/be6e30.wgsl.expected.glsl new file mode 100644 index 0000000000..95fa82c8a4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/be6e30.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +layout(rgba16f) uniform highp writeonly image2D arg_0; +void textureStore_be6e30() { + ivec2 arg_1 = ivec2(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_be6e30(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba16f) uniform highp writeonly image2D arg_0; +void textureStore_be6e30() { + ivec2 arg_1 = ivec2(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_be6e30(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba16f) uniform highp writeonly image2D arg_0; +void textureStore_be6e30() { + ivec2 arg_1 = ivec2(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_be6e30(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/be6e30.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/be6e30.wgsl.expected.hlsl new file mode 100644 index 0000000000..67ff8b2119 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/be6e30.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_be6e30() { + int2 arg_1 = (0).xx; + float4 arg_2 = (0.0f).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_be6e30(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_be6e30(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_be6e30(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/be6e30.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/be6e30.wgsl.expected.msl new file mode 100644 index 0000000000..ad189e0815 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/be6e30.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_be6e30(texture2d tint_symbol_1) { + int2 arg_1 = int2(0); + float4 arg_2 = float4(0.0f); + tint_symbol_1.write(arg_2, uint2(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureStore_be6e30(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureStore_be6e30(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureStore_be6e30(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/be6e30.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/be6e30.wgsl.expected.spvasm new file mode 100644 index 0000000000..57d0a8caaa --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/be6e30.wgsl.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_be6e30 "textureStore_be6e30" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 2 Rgba16f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %18 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_be6e30 = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %18 + %arg_2 = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_1 %18 + OpStore %arg_2 %5 + %24 = OpLoad %11 %arg_0 + %25 = OpLoad %v2int %arg_1 + %26 = OpLoad %v4float %arg_2 + OpImageWrite %24 %25 %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %textureStore_be6e30 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureStore_be6e30 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %39 = OpLabel + %40 = OpFunctionCall %void %textureStore_be6e30 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/be6e30.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/be6e30.wgsl.expected.wgsl new file mode 100644 index 0000000000..259fa2bd98 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/be6e30.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureStore_be6e30() { + var arg_1 = vec2(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_be6e30(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_be6e30(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_be6e30(); +} diff --git a/test/tint/builtins/gen/var/textureStore/bf775c.wgsl b/test/tint/builtins/gen/var/textureStore/bf775c.wgsl new file mode 100644 index 0000000000..f6147df0d3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/bf775c.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureStore(texture: texture_storage_1d, coords: i32, value: vec4) +fn textureStore_bf775c() { + var arg_1 = 1; + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_bf775c(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_bf775c(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_bf775c(); +} diff --git a/test/tint/builtins/gen/var/textureStore/bf775c.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/bf775c.wgsl.expected.glsl new file mode 100644 index 0000000000..276322e6f1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/bf775c.wgsl.expected.glsl @@ -0,0 +1,84 @@ +SKIP: FAILED + +#version 310 es + +layout(rgba8i) uniform highp writeonly iimage1D arg_0; +void textureStore_bf775c() { + int arg_1 = 1; + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_bf775c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'iimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rgba8i) uniform highp writeonly iimage1D arg_0; +void textureStore_bf775c() { + int arg_1 = 1; + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_bf775c(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'iimage1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rgba8i) uniform highp writeonly iimage1D arg_0; +void textureStore_bf775c() { + int arg_1 = 1; + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_bf775c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'iimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureStore/bf775c.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/bf775c.wgsl.expected.hlsl new file mode 100644 index 0000000000..c75cb0ba5b --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/bf775c.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_bf775c() { + int arg_1 = 1; + int4 arg_2 = (0).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_bf775c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_bf775c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_bf775c(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/bf775c.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/bf775c.wgsl.expected.msl new file mode 100644 index 0000000000..24079fd3d6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/bf775c.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_bf775c(texture1d tint_symbol_1) { + int arg_1 = 1; + int4 arg_2 = int4(0); + tint_symbol_1.write(arg_2, uint(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureStore_bf775c(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureStore_bf775c(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureStore_bf775c(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/bf775c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/bf775c.wgsl.expected.spvasm new file mode 100644 index 0000000000..c699fc002a --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/bf775c.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpCapability Image1D + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_bf775c "textureStore_bf775c" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 1D 0 0 0 2 Rgba8i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %20 = OpConstantNull %int + %v4int = OpTypeVector %int 4 + %22 = OpConstantNull %v4int +%_ptr_Function_v4int = OpTypePointer Function %v4int + %29 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_bf775c = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %20 + %arg_2 = OpVariable %_ptr_Function_v4int Function %22 + OpStore %arg_1 %int_1 + OpStore %arg_2 %22 + %26 = OpLoad %11 %arg_0 + %27 = OpLoad %int %arg_1 + %28 = OpLoad %v4int %arg_2 + OpImageWrite %26 %27 %28 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %29 + %31 = OpLabel + %32 = OpFunctionCall %void %textureStore_bf775c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %35 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %38 = OpLabel + %39 = OpFunctionCall %void %textureStore_bf775c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %41 = OpLabel + %42 = OpFunctionCall %void %textureStore_bf775c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/bf775c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/bf775c.wgsl.expected.wgsl new file mode 100644 index 0000000000..cdf9966845 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/bf775c.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureStore_bf775c() { + var arg_1 = 1; + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_bf775c(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_bf775c(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_bf775c(); +} diff --git a/test/tint/builtins/gen/var/textureStore/c5af1e.wgsl b/test/tint/builtins/gen/var/textureStore/c5af1e.wgsl new file mode 100644 index 0000000000..db992bcd5d --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/c5af1e.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureStore(texture: texture_storage_3d, coords: vec3, value: vec4) +fn textureStore_c5af1e() { + var arg_1 = vec3(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_c5af1e(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_c5af1e(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_c5af1e(); +} diff --git a/test/tint/builtins/gen/var/textureStore/c5af1e.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/c5af1e.wgsl.expected.glsl new file mode 100644 index 0000000000..d75b39b00c --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/c5af1e.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +layout(rgba16f) uniform highp writeonly image3D arg_0; +void textureStore_c5af1e() { + ivec3 arg_1 = ivec3(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_c5af1e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba16f) uniform highp writeonly image3D arg_0; +void textureStore_c5af1e() { + ivec3 arg_1 = ivec3(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_c5af1e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba16f) uniform highp writeonly image3D arg_0; +void textureStore_c5af1e() { + ivec3 arg_1 = ivec3(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_c5af1e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/c5af1e.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/c5af1e.wgsl.expected.hlsl new file mode 100644 index 0000000000..c52db8f8be --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/c5af1e.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_c5af1e() { + int3 arg_1 = (0).xxx; + float4 arg_2 = (0.0f).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_c5af1e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_c5af1e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_c5af1e(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/c5af1e.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/c5af1e.wgsl.expected.msl new file mode 100644 index 0000000000..6e9206f482 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/c5af1e.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_c5af1e(texture3d tint_symbol_1) { + int3 arg_1 = int3(0); + float4 arg_2 = float4(0.0f); + tint_symbol_1.write(arg_2, uint3(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureStore_c5af1e(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureStore_c5af1e(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureStore_c5af1e(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/c5af1e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/c5af1e.wgsl.expected.spvasm new file mode 100644 index 0000000000..0a7e6556eb --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/c5af1e.wgsl.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_c5af1e "textureStore_c5af1e" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 3D 0 0 0 2 Rgba16f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %18 = OpConstantNull %v3int +%_ptr_Function_v3int = OpTypePointer Function %v3int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_c5af1e = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v3int Function %18 + %arg_2 = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_1 %18 + OpStore %arg_2 %5 + %24 = OpLoad %11 %arg_0 + %25 = OpLoad %v3int %arg_1 + %26 = OpLoad %v4float %arg_2 + OpImageWrite %24 %25 %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %textureStore_c5af1e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureStore_c5af1e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %39 = OpLabel + %40 = OpFunctionCall %void %textureStore_c5af1e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/c5af1e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/c5af1e.wgsl.expected.wgsl new file mode 100644 index 0000000000..1054a7700e --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/c5af1e.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureStore_c5af1e() { + var arg_1 = vec3(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_c5af1e(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_c5af1e(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_c5af1e(); +} diff --git a/test/tint/builtins/gen/var/textureStore/c863be.wgsl b/test/tint/builtins/gen/var/textureStore/c863be.wgsl new file mode 100644 index 0000000000..dead2acbee --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/c863be.wgsl @@ -0,0 +1,49 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureStore(texture: texture_storage_2d_array, coords: vec2, array_index: i32, value: vec4) +fn textureStore_c863be() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = vec4(); + textureStore(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_c863be(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_c863be(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_c863be(); +} diff --git a/test/tint/builtins/gen/var/textureStore/c863be.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/c863be.wgsl.expected.glsl new file mode 100644 index 0000000000..964605ed97 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/c863be.wgsl.expected.glsl @@ -0,0 +1,84 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32f) uniform highp writeonly image2DArray arg_0; +void textureStore_c863be() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + vec4 arg_3 = vec4(0.0f); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +vec4 vertex_main() { + textureStore_c863be(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32f) uniform highp writeonly image2DArray arg_0; +void textureStore_c863be() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + vec4 arg_3 = vec4(0.0f); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +void fragment_main() { + textureStore_c863be(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32f) uniform highp writeonly image2DArray arg_0; +void textureStore_c863be() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + vec4 arg_3 = vec4(0.0f); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +void compute_main() { + textureStore_c863be(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureStore/c863be.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/c863be.wgsl.expected.hlsl new file mode 100644 index 0000000000..bf1dd2cb3c --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/c863be.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_c863be() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + float4 arg_3 = (0.0f).xxxx; + arg_0[int3(arg_1, arg_2)] = arg_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_c863be(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_c863be(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_c863be(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/c863be.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/c863be.wgsl.expected.msl new file mode 100644 index 0000000000..3b4ee66666 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/c863be.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureStore_c863be(texture2d_array tint_symbol_1) { + int2 arg_1 = int2(0); + int arg_2 = 1; + float4 arg_3 = float4(0.0f); + tint_symbol_1.write(arg_3, uint2(arg_1), arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureStore_c863be(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureStore_c863be(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureStore_c863be(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/c863be.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/c863be.wgsl.expected.spvasm new file mode 100644 index 0000000000..49ae3b6aa5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/c863be.wgsl.expected.spvasm @@ -0,0 +1,93 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 50 +; Schema: 0 + OpCapability Shader + OpCapability StorageImageExtendedFormats + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_c863be "textureStore_c863be" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 2 Rg32f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %18 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %v3int = OpTypeVector %int 3 + %36 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_c863be = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %18 + %arg_2 = OpVariable %_ptr_Function_int Function %24 + %arg_3 = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_1 %18 + OpStore %arg_2 %int_1 + OpStore %arg_3 %5 + %28 = OpLoad %11 %arg_0 + %30 = OpLoad %v2int %arg_1 + %31 = OpCompositeExtract %int %30 0 + %32 = OpCompositeExtract %int %30 1 + %33 = OpLoad %int %arg_2 + %34 = OpCompositeConstruct %v3int %31 %32 %33 + %35 = OpLoad %v4float %arg_3 + OpImageWrite %28 %34 %35 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %36 + %38 = OpLabel + %39 = OpFunctionCall %void %textureStore_c863be + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %41 = OpLabel + %42 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %42 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %45 = OpLabel + %46 = OpFunctionCall %void %textureStore_c863be + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %48 = OpLabel + %49 = OpFunctionCall %void %textureStore_c863be + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/c863be.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/c863be.wgsl.expected.wgsl new file mode 100644 index 0000000000..a6ba2427d2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/c863be.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureStore_c863be() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = vec4(); + textureStore(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_c863be(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_c863be(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_c863be(); +} diff --git a/test/tint/builtins/gen/var/textureStore/d73b5c.wgsl b/test/tint/builtins/gen/var/textureStore/d73b5c.wgsl new file mode 100644 index 0000000000..1b25bc437c --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/d73b5c.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureStore(texture: texture_storage_1d, coords: i32, value: vec4) +fn textureStore_d73b5c() { + var arg_1 = 1; + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_d73b5c(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_d73b5c(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_d73b5c(); +} diff --git a/test/tint/builtins/gen/var/textureStore/d73b5c.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/d73b5c.wgsl.expected.glsl new file mode 100644 index 0000000000..ca21e8d934 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/d73b5c.wgsl.expected.glsl @@ -0,0 +1,81 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32i) uniform highp writeonly iimage1D arg_0; +void textureStore_d73b5c() { + int arg_1 = 1; + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_d73b5c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32i) uniform highp writeonly iimage1D arg_0; +void textureStore_d73b5c() { + int arg_1 = 1; + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_d73b5c(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32i) uniform highp writeonly iimage1D arg_0; +void textureStore_d73b5c() { + int arg_1 = 1; + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_d73b5c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureStore/d73b5c.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/d73b5c.wgsl.expected.hlsl new file mode 100644 index 0000000000..e4f893ab01 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/d73b5c.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_d73b5c() { + int arg_1 = 1; + int4 arg_2 = (0).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_d73b5c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_d73b5c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_d73b5c(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/d73b5c.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/d73b5c.wgsl.expected.msl new file mode 100644 index 0000000000..0fe1471f72 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/d73b5c.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_d73b5c(texture1d tint_symbol_1) { + int arg_1 = 1; + int4 arg_2 = int4(0); + tint_symbol_1.write(arg_2, uint(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureStore_d73b5c(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureStore_d73b5c(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureStore_d73b5c(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/d73b5c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/d73b5c.wgsl.expected.spvasm new file mode 100644 index 0000000000..b558399701 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/d73b5c.wgsl.expected.spvasm @@ -0,0 +1,85 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpCapability Image1D + OpCapability StorageImageExtendedFormats + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_d73b5c "textureStore_d73b5c" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 1D 0 0 0 2 Rg32i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %20 = OpConstantNull %int + %v4int = OpTypeVector %int 4 + %22 = OpConstantNull %v4int +%_ptr_Function_v4int = OpTypePointer Function %v4int + %29 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_d73b5c = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %20 + %arg_2 = OpVariable %_ptr_Function_v4int Function %22 + OpStore %arg_1 %int_1 + OpStore %arg_2 %22 + %26 = OpLoad %11 %arg_0 + %27 = OpLoad %int %arg_1 + %28 = OpLoad %v4int %arg_2 + OpImageWrite %26 %27 %28 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %29 + %31 = OpLabel + %32 = OpFunctionCall %void %textureStore_d73b5c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %35 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %38 = OpLabel + %39 = OpFunctionCall %void %textureStore_d73b5c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %41 = OpLabel + %42 = OpFunctionCall %void %textureStore_d73b5c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/d73b5c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/d73b5c.wgsl.expected.wgsl new file mode 100644 index 0000000000..6c5f4cb090 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/d73b5c.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureStore_d73b5c() { + var arg_1 = 1; + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_d73b5c(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_d73b5c(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_d73b5c(); +} diff --git a/test/tint/builtins/gen/var/textureStore/dd7d81.wgsl b/test/tint/builtins/gen/var/textureStore/dd7d81.wgsl new file mode 100644 index 0000000000..3c44ab4d9f --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/dd7d81.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureStore(texture: texture_storage_3d, coords: vec3, value: vec4) +fn textureStore_dd7d81() { + var arg_1 = vec3(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_dd7d81(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_dd7d81(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_dd7d81(); +} diff --git a/test/tint/builtins/gen/var/textureStore/dd7d81.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/dd7d81.wgsl.expected.glsl new file mode 100644 index 0000000000..2a86984a65 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/dd7d81.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +layout(rgba8_snorm) uniform highp writeonly image3D arg_0; +void textureStore_dd7d81() { + ivec3 arg_1 = ivec3(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_dd7d81(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8_snorm) uniform highp writeonly image3D arg_0; +void textureStore_dd7d81() { + ivec3 arg_1 = ivec3(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_dd7d81(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8_snorm) uniform highp writeonly image3D arg_0; +void textureStore_dd7d81() { + ivec3 arg_1 = ivec3(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_dd7d81(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/dd7d81.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/dd7d81.wgsl.expected.hlsl new file mode 100644 index 0000000000..303f614926 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/dd7d81.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_dd7d81() { + int3 arg_1 = (0).xxx; + float4 arg_2 = (0.0f).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_dd7d81(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_dd7d81(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_dd7d81(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/dd7d81.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/dd7d81.wgsl.expected.msl new file mode 100644 index 0000000000..e87f2ed170 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/dd7d81.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_dd7d81(texture3d tint_symbol_1) { + int3 arg_1 = int3(0); + float4 arg_2 = float4(0.0f); + tint_symbol_1.write(arg_2, uint3(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureStore_dd7d81(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureStore_dd7d81(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureStore_dd7d81(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/dd7d81.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/dd7d81.wgsl.expected.spvasm new file mode 100644 index 0000000000..8e21c4c58a --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/dd7d81.wgsl.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_dd7d81 "textureStore_dd7d81" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 3D 0 0 0 2 Rgba8Snorm +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %18 = OpConstantNull %v3int +%_ptr_Function_v3int = OpTypePointer Function %v3int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_dd7d81 = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v3int Function %18 + %arg_2 = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_1 %18 + OpStore %arg_2 %5 + %24 = OpLoad %11 %arg_0 + %25 = OpLoad %v3int %arg_1 + %26 = OpLoad %v4float %arg_2 + OpImageWrite %24 %25 %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %textureStore_dd7d81 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureStore_dd7d81 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %39 = OpLabel + %40 = OpFunctionCall %void %textureStore_dd7d81 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/dd7d81.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/dd7d81.wgsl.expected.wgsl new file mode 100644 index 0000000000..5aa55d7343 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/dd7d81.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureStore_dd7d81() { + var arg_1 = vec3(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_dd7d81(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_dd7d81(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_dd7d81(); +} diff --git a/test/tint/builtins/gen/var/textureStore/dde364.wgsl b/test/tint/builtins/gen/var/textureStore/dde364.wgsl new file mode 100644 index 0000000000..13f1d5942a --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/dde364.wgsl @@ -0,0 +1,49 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureStore(texture: texture_storage_2d_array, coords: vec2, array_index: i32, value: vec4) +fn textureStore_dde364() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = vec4(); + textureStore(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_dde364(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_dde364(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_dde364(); +} diff --git a/test/tint/builtins/gen/var/textureStore/dde364.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/dde364.wgsl.expected.glsl new file mode 100644 index 0000000000..30fc1380d6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/dde364.wgsl.expected.glsl @@ -0,0 +1,84 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32ui) uniform highp writeonly uimage2DArray arg_0; +void textureStore_dde364() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + uvec4 arg_3 = uvec4(0u); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +vec4 vertex_main() { + textureStore_dde364(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32ui) uniform highp writeonly uimage2DArray arg_0; +void textureStore_dde364() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + uvec4 arg_3 = uvec4(0u); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +void fragment_main() { + textureStore_dde364(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32ui) uniform highp writeonly uimage2DArray arg_0; +void textureStore_dde364() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + uvec4 arg_3 = uvec4(0u); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +void compute_main() { + textureStore_dde364(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureStore/dde364.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/dde364.wgsl.expected.hlsl new file mode 100644 index 0000000000..8bda58b0d5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/dde364.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_dde364() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + uint4 arg_3 = (0u).xxxx; + arg_0[int3(arg_1, arg_2)] = arg_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_dde364(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_dde364(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_dde364(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/dde364.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/dde364.wgsl.expected.msl new file mode 100644 index 0000000000..8ac8d03c8a --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/dde364.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureStore_dde364(texture2d_array tint_symbol_1) { + int2 arg_1 = int2(0); + int arg_2 = 1; + uint4 arg_3 = uint4(0u); + tint_symbol_1.write(arg_3, uint2(arg_1), arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureStore_dde364(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureStore_dde364(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureStore_dde364(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/dde364.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/dde364.wgsl.expected.spvasm new file mode 100644 index 0000000000..39505fa9cb --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/dde364.wgsl.expected.spvasm @@ -0,0 +1,96 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 53 +; Schema: 0 + OpCapability Shader + OpCapability StorageImageExtendedFormats + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_dde364 "textureStore_dde364" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 1 0 2 Rg32ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %19 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %25 = OpConstantNull %int + %v4uint = OpTypeVector %uint 4 + %27 = OpConstantNull %v4uint +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %v3int = OpTypeVector %int 3 + %39 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_dde364 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %19 + %arg_2 = OpVariable %_ptr_Function_int Function %25 + %arg_3 = OpVariable %_ptr_Function_v4uint Function %27 + OpStore %arg_1 %19 + OpStore %arg_2 %int_1 + OpStore %arg_3 %27 + %31 = OpLoad %11 %arg_0 + %33 = OpLoad %v2int %arg_1 + %34 = OpCompositeExtract %int %33 0 + %35 = OpCompositeExtract %int %33 1 + %36 = OpLoad %int %arg_2 + %37 = OpCompositeConstruct %v3int %34 %35 %36 + %38 = OpLoad %v4uint %arg_3 + OpImageWrite %31 %37 %38 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %39 + %41 = OpLabel + %42 = OpFunctionCall %void %textureStore_dde364 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %44 = OpLabel + %45 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %45 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %48 = OpLabel + %49 = OpFunctionCall %void %textureStore_dde364 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %51 = OpLabel + %52 = OpFunctionCall %void %textureStore_dde364 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/dde364.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/dde364.wgsl.expected.wgsl new file mode 100644 index 0000000000..61c414056b --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/dde364.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureStore_dde364() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = vec4(); + textureStore(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_dde364(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_dde364(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_dde364(); +} diff --git a/test/tint/builtins/gen/var/textureStore/e885e8.wgsl b/test/tint/builtins/gen/var/textureStore/e885e8.wgsl new file mode 100644 index 0000000000..dc7a9afd90 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/e885e8.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureStore(texture: texture_storage_1d, coords: i32, value: vec4) +fn textureStore_e885e8() { + var arg_1 = 1; + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_e885e8(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_e885e8(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_e885e8(); +} diff --git a/test/tint/builtins/gen/var/textureStore/e885e8.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/e885e8.wgsl.expected.glsl new file mode 100644 index 0000000000..ceee356612 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/e885e8.wgsl.expected.glsl @@ -0,0 +1,84 @@ +SKIP: FAILED + +#version 310 es + +layout(rgba16f) uniform highp writeonly image1D arg_0; +void textureStore_e885e8() { + int arg_1 = 1; + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_e885e8(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rgba16f) uniform highp writeonly image1D arg_0; +void textureStore_e885e8() { + int arg_1 = 1; + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_e885e8(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rgba16f) uniform highp writeonly image1D arg_0; +void textureStore_e885e8() { + int arg_1 = 1; + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_e885e8(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureStore/e885e8.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/e885e8.wgsl.expected.hlsl new file mode 100644 index 0000000000..3a6acf9920 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/e885e8.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_e885e8() { + int arg_1 = 1; + float4 arg_2 = (0.0f).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_e885e8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_e885e8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_e885e8(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/e885e8.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/e885e8.wgsl.expected.msl new file mode 100644 index 0000000000..67de77cde1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/e885e8.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_e885e8(texture1d tint_symbol_1) { + int arg_1 = 1; + float4 arg_2 = float4(0.0f); + tint_symbol_1.write(arg_2, uint(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureStore_e885e8(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureStore_e885e8(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureStore_e885e8(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/e885e8.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/e885e8.wgsl.expected.spvasm new file mode 100644 index 0000000000..de6672d838 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/e885e8.wgsl.expected.spvasm @@ -0,0 +1,82 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpCapability Image1D + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_e885e8 "textureStore_e885e8" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 1D 0 0 0 2 Rgba16f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %20 = OpConstantNull %int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_e885e8 = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %20 + %arg_2 = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_1 %int_1 + OpStore %arg_2 %5 + %24 = OpLoad %11 %arg_0 + %25 = OpLoad %int %arg_1 + %26 = OpLoad %v4float %arg_2 + OpImageWrite %24 %25 %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %textureStore_e885e8 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureStore_e885e8 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %39 = OpLabel + %40 = OpFunctionCall %void %textureStore_e885e8 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/e885e8.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/e885e8.wgsl.expected.wgsl new file mode 100644 index 0000000000..27bd62e700 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/e885e8.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureStore_e885e8() { + var arg_1 = 1; + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_e885e8(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_e885e8(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_e885e8(); +} diff --git a/test/tint/builtins/gen/var/textureStore/eb702f.wgsl b/test/tint/builtins/gen/var/textureStore/eb702f.wgsl new file mode 100644 index 0000000000..bee128311b --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/eb702f.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureStore(texture: texture_storage_3d, coords: vec3, value: vec4) +fn textureStore_eb702f() { + var arg_1 = vec3(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_eb702f(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_eb702f(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_eb702f(); +} diff --git a/test/tint/builtins/gen/var/textureStore/eb702f.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/eb702f.wgsl.expected.glsl new file mode 100644 index 0000000000..5dfa23db7b --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/eb702f.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +layout(r32f) uniform highp writeonly image3D arg_0; +void textureStore_eb702f() { + ivec3 arg_1 = ivec3(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_eb702f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(r32f) uniform highp writeonly image3D arg_0; +void textureStore_eb702f() { + ivec3 arg_1 = ivec3(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_eb702f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(r32f) uniform highp writeonly image3D arg_0; +void textureStore_eb702f() { + ivec3 arg_1 = ivec3(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_eb702f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/eb702f.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/eb702f.wgsl.expected.hlsl new file mode 100644 index 0000000000..55d4e79233 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/eb702f.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_eb702f() { + int3 arg_1 = (0).xxx; + float4 arg_2 = (0.0f).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_eb702f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_eb702f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_eb702f(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/eb702f.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/eb702f.wgsl.expected.msl new file mode 100644 index 0000000000..9926e894f2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/eb702f.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_eb702f(texture3d tint_symbol_1) { + int3 arg_1 = int3(0); + float4 arg_2 = float4(0.0f); + tint_symbol_1.write(arg_2, uint3(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureStore_eb702f(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureStore_eb702f(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureStore_eb702f(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/eb702f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/eb702f.wgsl.expected.spvasm new file mode 100644 index 0000000000..8d9bddbc03 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/eb702f.wgsl.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_eb702f "textureStore_eb702f" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 3D 0 0 0 2 R32f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %18 = OpConstantNull %v3int +%_ptr_Function_v3int = OpTypePointer Function %v3int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_eb702f = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v3int Function %18 + %arg_2 = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_1 %18 + OpStore %arg_2 %5 + %24 = OpLoad %11 %arg_0 + %25 = OpLoad %v3int %arg_1 + %26 = OpLoad %v4float %arg_2 + OpImageWrite %24 %25 %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %textureStore_eb702f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureStore_eb702f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %39 = OpLabel + %40 = OpFunctionCall %void %textureStore_eb702f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/eb702f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/eb702f.wgsl.expected.wgsl new file mode 100644 index 0000000000..dcb0776c50 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/eb702f.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureStore_eb702f() { + var arg_1 = vec3(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_eb702f(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_eb702f(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_eb702f(); +} diff --git a/test/tint/builtins/gen/var/textureStore/eb78b9.wgsl b/test/tint/builtins/gen/var/textureStore/eb78b9.wgsl new file mode 100644 index 0000000000..564a7b13a1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/eb78b9.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureStore(texture: texture_storage_3d, coords: vec3, value: vec4) +fn textureStore_eb78b9() { + var arg_1 = vec3(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_eb78b9(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_eb78b9(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_eb78b9(); +} diff --git a/test/tint/builtins/gen/var/textureStore/eb78b9.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/eb78b9.wgsl.expected.glsl new file mode 100644 index 0000000000..7a6aa1221e --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/eb78b9.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +layout(r32i) uniform highp writeonly iimage3D arg_0; +void textureStore_eb78b9() { + ivec3 arg_1 = ivec3(0); + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_eb78b9(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(r32i) uniform highp writeonly iimage3D arg_0; +void textureStore_eb78b9() { + ivec3 arg_1 = ivec3(0); + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_eb78b9(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(r32i) uniform highp writeonly iimage3D arg_0; +void textureStore_eb78b9() { + ivec3 arg_1 = ivec3(0); + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_eb78b9(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/eb78b9.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/eb78b9.wgsl.expected.hlsl new file mode 100644 index 0000000000..c798708dd7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/eb78b9.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_eb78b9() { + int3 arg_1 = (0).xxx; + int4 arg_2 = (0).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_eb78b9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_eb78b9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_eb78b9(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/eb78b9.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/eb78b9.wgsl.expected.msl new file mode 100644 index 0000000000..e5b872f51c --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/eb78b9.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_eb78b9(texture3d tint_symbol_1) { + int3 arg_1 = int3(0); + int4 arg_2 = int4(0); + tint_symbol_1.write(arg_2, uint3(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureStore_eb78b9(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureStore_eb78b9(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureStore_eb78b9(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/eb78b9.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/eb78b9.wgsl.expected.spvasm new file mode 100644 index 0000000000..ca55182024 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/eb78b9.wgsl.expected.spvasm @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_eb78b9 "textureStore_eb78b9" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 3D 0 0 0 2 R32i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v3int = OpTypeVector %int 3 + %18 = OpConstantNull %v3int +%_ptr_Function_v3int = OpTypePointer Function %v3int + %v4int = OpTypeVector %int 4 + %22 = OpConstantNull %v4int +%_ptr_Function_v4int = OpTypePointer Function %v4int + %29 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_eb78b9 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v3int Function %18 + %arg_2 = OpVariable %_ptr_Function_v4int Function %22 + OpStore %arg_1 %18 + OpStore %arg_2 %22 + %26 = OpLoad %11 %arg_0 + %27 = OpLoad %v3int %arg_1 + %28 = OpLoad %v4int %arg_2 + OpImageWrite %26 %27 %28 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %29 + %31 = OpLabel + %32 = OpFunctionCall %void %textureStore_eb78b9 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %35 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %38 = OpLabel + %39 = OpFunctionCall %void %textureStore_eb78b9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %41 = OpLabel + %42 = OpFunctionCall %void %textureStore_eb78b9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/eb78b9.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/eb78b9.wgsl.expected.wgsl new file mode 100644 index 0000000000..a19c531b12 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/eb78b9.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureStore_eb78b9() { + var arg_1 = vec3(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_eb78b9(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_eb78b9(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_eb78b9(); +} diff --git a/test/tint/builtins/gen/var/textureStore/ee6acc.wgsl b/test/tint/builtins/gen/var/textureStore/ee6acc.wgsl new file mode 100644 index 0000000000..5dd4ca3ea4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/ee6acc.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureStore(texture: texture_storage_3d, coords: vec3, value: vec4) +fn textureStore_ee6acc() { + var arg_1 = vec3(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_ee6acc(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_ee6acc(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_ee6acc(); +} diff --git a/test/tint/builtins/gen/var/textureStore/ee6acc.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/ee6acc.wgsl.expected.glsl new file mode 100644 index 0000000000..bce0c58279 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/ee6acc.wgsl.expected.glsl @@ -0,0 +1,81 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32f) uniform highp writeonly image3D arg_0; +void textureStore_ee6acc() { + ivec3 arg_1 = ivec3(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_ee6acc(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32f) uniform highp writeonly image3D arg_0; +void textureStore_ee6acc() { + ivec3 arg_1 = ivec3(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_ee6acc(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32f) uniform highp writeonly image3D arg_0; +void textureStore_ee6acc() { + ivec3 arg_1 = ivec3(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_ee6acc(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureStore/ee6acc.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/ee6acc.wgsl.expected.hlsl new file mode 100644 index 0000000000..a6ce8c7b0f --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/ee6acc.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_ee6acc() { + int3 arg_1 = (0).xxx; + float4 arg_2 = (0.0f).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_ee6acc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_ee6acc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_ee6acc(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/ee6acc.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/ee6acc.wgsl.expected.msl new file mode 100644 index 0000000000..9b5c9220e9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/ee6acc.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_ee6acc(texture3d tint_symbol_1) { + int3 arg_1 = int3(0); + float4 arg_2 = float4(0.0f); + tint_symbol_1.write(arg_2, uint3(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureStore_ee6acc(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureStore_ee6acc(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureStore_ee6acc(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/ee6acc.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/ee6acc.wgsl.expected.spvasm new file mode 100644 index 0000000000..bc3df6dbd5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/ee6acc.wgsl.expected.spvasm @@ -0,0 +1,82 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpCapability StorageImageExtendedFormats + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_ee6acc "textureStore_ee6acc" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 3D 0 0 0 2 Rg32f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %18 = OpConstantNull %v3int +%_ptr_Function_v3int = OpTypePointer Function %v3int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_ee6acc = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v3int Function %18 + %arg_2 = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_1 %18 + OpStore %arg_2 %5 + %24 = OpLoad %11 %arg_0 + %25 = OpLoad %v3int %arg_1 + %26 = OpLoad %v4float %arg_2 + OpImageWrite %24 %25 %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %textureStore_ee6acc + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureStore_ee6acc + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %39 = OpLabel + %40 = OpFunctionCall %void %textureStore_ee6acc + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/ee6acc.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/ee6acc.wgsl.expected.wgsl new file mode 100644 index 0000000000..aec0e264bc --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/ee6acc.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureStore_ee6acc() { + var arg_1 = vec3(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_ee6acc(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_ee6acc(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_ee6acc(); +} diff --git a/test/tint/builtins/gen/var/textureStore/ef9f2f.wgsl b/test/tint/builtins/gen/var/textureStore/ef9f2f.wgsl new file mode 100644 index 0000000000..988c3a7667 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/ef9f2f.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureStore(texture: texture_storage_3d, coords: vec3, value: vec4) +fn textureStore_ef9f2f() { + var arg_1 = vec3(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_ef9f2f(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_ef9f2f(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_ef9f2f(); +} diff --git a/test/tint/builtins/gen/var/textureStore/ef9f2f.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/ef9f2f.wgsl.expected.glsl new file mode 100644 index 0000000000..040973d2dc --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/ef9f2f.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +layout(r32ui) uniform highp writeonly uimage3D arg_0; +void textureStore_ef9f2f() { + ivec3 arg_1 = ivec3(0); + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_ef9f2f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(r32ui) uniform highp writeonly uimage3D arg_0; +void textureStore_ef9f2f() { + ivec3 arg_1 = ivec3(0); + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_ef9f2f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(r32ui) uniform highp writeonly uimage3D arg_0; +void textureStore_ef9f2f() { + ivec3 arg_1 = ivec3(0); + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_ef9f2f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/ef9f2f.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/ef9f2f.wgsl.expected.hlsl new file mode 100644 index 0000000000..ded9f9515a --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/ef9f2f.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_ef9f2f() { + int3 arg_1 = (0).xxx; + uint4 arg_2 = (0u).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_ef9f2f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_ef9f2f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_ef9f2f(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/ef9f2f.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/ef9f2f.wgsl.expected.msl new file mode 100644 index 0000000000..9c6a6bdac6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/ef9f2f.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_ef9f2f(texture3d tint_symbol_1) { + int3 arg_1 = int3(0); + uint4 arg_2 = uint4(0u); + tint_symbol_1.write(arg_2, uint3(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureStore_ef9f2f(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureStore_ef9f2f(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureStore_ef9f2f(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/ef9f2f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/ef9f2f.wgsl.expected.spvasm new file mode 100644 index 0000000000..4148955254 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/ef9f2f.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_ef9f2f "textureStore_ef9f2f" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 3D 0 0 0 2 R32ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %19 = OpConstantNull %v3int +%_ptr_Function_v3int = OpTypePointer Function %v3int + %v4uint = OpTypeVector %uint 4 + %23 = OpConstantNull %v4uint +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %30 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_ef9f2f = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v3int Function %19 + %arg_2 = OpVariable %_ptr_Function_v4uint Function %23 + OpStore %arg_1 %19 + OpStore %arg_2 %23 + %27 = OpLoad %11 %arg_0 + %28 = OpLoad %v3int %arg_1 + %29 = OpLoad %v4uint %arg_2 + OpImageWrite %27 %28 %29 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %textureStore_ef9f2f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %36 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %39 = OpLabel + %40 = OpFunctionCall %void %textureStore_ef9f2f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %42 = OpLabel + %43 = OpFunctionCall %void %textureStore_ef9f2f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/ef9f2f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/ef9f2f.wgsl.expected.wgsl new file mode 100644 index 0000000000..596115c241 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/ef9f2f.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureStore_ef9f2f() { + var arg_1 = vec3(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_ef9f2f(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_ef9f2f(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_ef9f2f(); +} diff --git a/test/tint/builtins/gen/var/textureStore/f8dead.wgsl b/test/tint/builtins/gen/var/textureStore/f8dead.wgsl new file mode 100644 index 0000000000..afc180084e --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/f8dead.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureStore(texture: texture_storage_3d, coords: vec3, value: vec4) +fn textureStore_f8dead() { + var arg_1 = vec3(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_f8dead(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_f8dead(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_f8dead(); +} diff --git a/test/tint/builtins/gen/var/textureStore/f8dead.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/f8dead.wgsl.expected.glsl new file mode 100644 index 0000000000..3583671c2f --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/f8dead.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +layout(rgba8ui) uniform highp writeonly uimage3D arg_0; +void textureStore_f8dead() { + ivec3 arg_1 = ivec3(0); + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_f8dead(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8ui) uniform highp writeonly uimage3D arg_0; +void textureStore_f8dead() { + ivec3 arg_1 = ivec3(0); + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_f8dead(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8ui) uniform highp writeonly uimage3D arg_0; +void textureStore_f8dead() { + ivec3 arg_1 = ivec3(0); + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_f8dead(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/f8dead.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/f8dead.wgsl.expected.hlsl new file mode 100644 index 0000000000..94111fb252 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/f8dead.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_f8dead() { + int3 arg_1 = (0).xxx; + uint4 arg_2 = (0u).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_f8dead(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_f8dead(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_f8dead(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/f8dead.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/f8dead.wgsl.expected.msl new file mode 100644 index 0000000000..4e6da981dc --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/f8dead.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_f8dead(texture3d tint_symbol_1) { + int3 arg_1 = int3(0); + uint4 arg_2 = uint4(0u); + tint_symbol_1.write(arg_2, uint3(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureStore_f8dead(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureStore_f8dead(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureStore_f8dead(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/f8dead.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/f8dead.wgsl.expected.spvasm new file mode 100644 index 0000000000..2a9e3e8e2e --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/f8dead.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_f8dead "textureStore_f8dead" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 3D 0 0 0 2 Rgba8ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %19 = OpConstantNull %v3int +%_ptr_Function_v3int = OpTypePointer Function %v3int + %v4uint = OpTypeVector %uint 4 + %23 = OpConstantNull %v4uint +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %30 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_f8dead = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v3int Function %19 + %arg_2 = OpVariable %_ptr_Function_v4uint Function %23 + OpStore %arg_1 %19 + OpStore %arg_2 %23 + %27 = OpLoad %11 %arg_0 + %28 = OpLoad %v3int %arg_1 + %29 = OpLoad %v4uint %arg_2 + OpImageWrite %27 %28 %29 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %textureStore_f8dead + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %36 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %39 = OpLabel + %40 = OpFunctionCall %void %textureStore_f8dead + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %42 = OpLabel + %43 = OpFunctionCall %void %textureStore_f8dead + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/f8dead.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/f8dead.wgsl.expected.wgsl new file mode 100644 index 0000000000..4ba27c6a26 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/f8dead.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureStore_f8dead() { + var arg_1 = vec3(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_f8dead(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_f8dead(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_f8dead(); +} diff --git a/test/tint/builtins/gen/var/textureStore/f9be83.wgsl b/test/tint/builtins/gen/var/textureStore/f9be83.wgsl new file mode 100644 index 0000000000..fe6e874441 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/f9be83.wgsl @@ -0,0 +1,49 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureStore(texture: texture_storage_2d_array, coords: vec2, array_index: i32, value: vec4) +fn textureStore_f9be83() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = vec4(); + textureStore(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_f9be83(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_f9be83(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_f9be83(); +} diff --git a/test/tint/builtins/gen/var/textureStore/f9be83.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/f9be83.wgsl.expected.glsl new file mode 100644 index 0000000000..60b3e0b612 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/f9be83.wgsl.expected.glsl @@ -0,0 +1,84 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32i) uniform highp writeonly iimage2DArray arg_0; +void textureStore_f9be83() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + ivec4 arg_3 = ivec4(0); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +vec4 vertex_main() { + textureStore_f9be83(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32i) uniform highp writeonly iimage2DArray arg_0; +void textureStore_f9be83() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + ivec4 arg_3 = ivec4(0); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +void fragment_main() { + textureStore_f9be83(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32i) uniform highp writeonly iimage2DArray arg_0; +void textureStore_f9be83() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + ivec4 arg_3 = ivec4(0); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +void compute_main() { + textureStore_f9be83(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureStore/f9be83.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/f9be83.wgsl.expected.hlsl new file mode 100644 index 0000000000..129bfb8de6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/f9be83.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_f9be83() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + int4 arg_3 = (0).xxxx; + arg_0[int3(arg_1, arg_2)] = arg_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_f9be83(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_f9be83(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_f9be83(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/f9be83.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/f9be83.wgsl.expected.msl new file mode 100644 index 0000000000..0217d28a2f --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/f9be83.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureStore_f9be83(texture2d_array tint_symbol_1) { + int2 arg_1 = int2(0); + int arg_2 = 1; + int4 arg_3 = int4(0); + tint_symbol_1.write(arg_3, uint2(arg_1), arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureStore_f9be83(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureStore_f9be83(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureStore_f9be83(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/f9be83.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/f9be83.wgsl.expected.spvasm new file mode 100644 index 0000000000..c7ee036056 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/f9be83.wgsl.expected.spvasm @@ -0,0 +1,95 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 52 +; Schema: 0 + OpCapability Shader + OpCapability StorageImageExtendedFormats + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_f9be83 "textureStore_f9be83" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 1 0 2 Rg32i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v2int = OpTypeVector %int 2 + %18 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int + %v4int = OpTypeVector %int 4 + %26 = OpConstantNull %v4int +%_ptr_Function_v4int = OpTypePointer Function %v4int + %v3int = OpTypeVector %int 3 + %38 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_f9be83 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %18 + %arg_2 = OpVariable %_ptr_Function_int Function %24 + %arg_3 = OpVariable %_ptr_Function_v4int Function %26 + OpStore %arg_1 %18 + OpStore %arg_2 %int_1 + OpStore %arg_3 %26 + %30 = OpLoad %11 %arg_0 + %32 = OpLoad %v2int %arg_1 + %33 = OpCompositeExtract %int %32 0 + %34 = OpCompositeExtract %int %32 1 + %35 = OpLoad %int %arg_2 + %36 = OpCompositeConstruct %v3int %33 %34 %35 + %37 = OpLoad %v4int %arg_3 + OpImageWrite %30 %36 %37 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %38 + %40 = OpLabel + %41 = OpFunctionCall %void %textureStore_f9be83 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %43 = OpLabel + %44 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %44 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %47 = OpLabel + %48 = OpFunctionCall %void %textureStore_f9be83 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %50 = OpLabel + %51 = OpFunctionCall %void %textureStore_f9be83 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/f9be83.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/f9be83.wgsl.expected.wgsl new file mode 100644 index 0000000000..b5ade7c184 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/f9be83.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureStore_f9be83() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = vec4(); + textureStore(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_f9be83(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_f9be83(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_f9be83(); +} diff --git a/test/tint/builtins/gen/var/textureStore/fb9a8f.wgsl b/test/tint/builtins/gen/var/textureStore/fb9a8f.wgsl new file mode 100644 index 0000000000..08f79474cc --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/fb9a8f.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureStore(texture: texture_storage_1d, coords: i32, value: vec4) +fn textureStore_fb9a8f() { + var arg_1 = 1; + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_fb9a8f(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_fb9a8f(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_fb9a8f(); +} diff --git a/test/tint/builtins/gen/var/textureStore/fb9a8f.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/fb9a8f.wgsl.expected.glsl new file mode 100644 index 0000000000..9976dc1c49 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/fb9a8f.wgsl.expected.glsl @@ -0,0 +1,84 @@ +SKIP: FAILED + +#version 310 es + +layout(rgba32ui) uniform highp writeonly uimage1D arg_0; +void textureStore_fb9a8f() { + int arg_1 = 1; + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_fb9a8f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'uimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rgba32ui) uniform highp writeonly uimage1D arg_0; +void textureStore_fb9a8f() { + int arg_1 = 1; + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_fb9a8f(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'uimage1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rgba32ui) uniform highp writeonly uimage1D arg_0; +void textureStore_fb9a8f() { + int arg_1 = 1; + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_fb9a8f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'uimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureStore/fb9a8f.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/fb9a8f.wgsl.expected.hlsl new file mode 100644 index 0000000000..7e5b23d042 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/fb9a8f.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_fb9a8f() { + int arg_1 = 1; + uint4 arg_2 = (0u).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_fb9a8f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_fb9a8f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_fb9a8f(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/fb9a8f.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/fb9a8f.wgsl.expected.msl new file mode 100644 index 0000000000..a808ba3fd7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/fb9a8f.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_fb9a8f(texture1d tint_symbol_1) { + int arg_1 = 1; + uint4 arg_2 = uint4(0u); + tint_symbol_1.write(arg_2, uint(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureStore_fb9a8f(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureStore_fb9a8f(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureStore_fb9a8f(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/fb9a8f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/fb9a8f.wgsl.expected.spvasm new file mode 100644 index 0000000000..708e2397fa --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/fb9a8f.wgsl.expected.spvasm @@ -0,0 +1,85 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpCapability Image1D + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_fb9a8f "textureStore_fb9a8f" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 1D 0 0 0 2 Rgba32ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %v4uint = OpTypeVector %uint 4 + %23 = OpConstantNull %v4uint +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %30 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_fb9a8f = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %21 + %arg_2 = OpVariable %_ptr_Function_v4uint Function %23 + OpStore %arg_1 %int_1 + OpStore %arg_2 %23 + %27 = OpLoad %11 %arg_0 + %28 = OpLoad %int %arg_1 + %29 = OpLoad %v4uint %arg_2 + OpImageWrite %27 %28 %29 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %textureStore_fb9a8f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %36 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %39 = OpLabel + %40 = OpFunctionCall %void %textureStore_fb9a8f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %42 = OpLabel + %43 = OpFunctionCall %void %textureStore_fb9a8f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/fb9a8f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/fb9a8f.wgsl.expected.wgsl new file mode 100644 index 0000000000..63241f2471 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/fb9a8f.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureStore_fb9a8f() { + var arg_1 = 1; + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_fb9a8f(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_fb9a8f(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_fb9a8f(); +} diff --git a/test/tint/builtins/gen/var/textureStore/fbf53f.wgsl b/test/tint/builtins/gen/var/textureStore/fbf53f.wgsl new file mode 100644 index 0000000000..388220d720 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/fbf53f.wgsl @@ -0,0 +1,49 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureStore(texture: texture_storage_2d_array, coords: vec2, array_index: i32, value: vec4) +fn textureStore_fbf53f() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = vec4(); + textureStore(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_fbf53f(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_fbf53f(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_fbf53f(); +} diff --git a/test/tint/builtins/gen/var/textureStore/fbf53f.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/fbf53f.wgsl.expected.glsl new file mode 100644 index 0000000000..c36d4950da --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/fbf53f.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +layout(rgba8i) uniform highp writeonly iimage2DArray arg_0; +void textureStore_fbf53f() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + ivec4 arg_3 = ivec4(0); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +vec4 vertex_main() { + textureStore_fbf53f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8i) uniform highp writeonly iimage2DArray arg_0; +void textureStore_fbf53f() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + ivec4 arg_3 = ivec4(0); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +void fragment_main() { + textureStore_fbf53f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8i) uniform highp writeonly iimage2DArray arg_0; +void textureStore_fbf53f() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + ivec4 arg_3 = ivec4(0); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +void compute_main() { + textureStore_fbf53f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/fbf53f.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/fbf53f.wgsl.expected.hlsl new file mode 100644 index 0000000000..46a154da23 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/fbf53f.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_fbf53f() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + int4 arg_3 = (0).xxxx; + arg_0[int3(arg_1, arg_2)] = arg_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_fbf53f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_fbf53f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_fbf53f(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/fbf53f.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/fbf53f.wgsl.expected.msl new file mode 100644 index 0000000000..7d00e81d24 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/fbf53f.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureStore_fbf53f(texture2d_array tint_symbol_1) { + int2 arg_1 = int2(0); + int arg_2 = 1; + int4 arg_3 = int4(0); + tint_symbol_1.write(arg_3, uint2(arg_1), arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureStore_fbf53f(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureStore_fbf53f(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureStore_fbf53f(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/fbf53f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/fbf53f.wgsl.expected.spvasm new file mode 100644 index 0000000000..037b3ee220 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/fbf53f.wgsl.expected.spvasm @@ -0,0 +1,94 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 52 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_fbf53f "textureStore_fbf53f" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 1 0 2 Rgba8i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v2int = OpTypeVector %int 2 + %18 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int + %v4int = OpTypeVector %int 4 + %26 = OpConstantNull %v4int +%_ptr_Function_v4int = OpTypePointer Function %v4int + %v3int = OpTypeVector %int 3 + %38 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_fbf53f = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %18 + %arg_2 = OpVariable %_ptr_Function_int Function %24 + %arg_3 = OpVariable %_ptr_Function_v4int Function %26 + OpStore %arg_1 %18 + OpStore %arg_2 %int_1 + OpStore %arg_3 %26 + %30 = OpLoad %11 %arg_0 + %32 = OpLoad %v2int %arg_1 + %33 = OpCompositeExtract %int %32 0 + %34 = OpCompositeExtract %int %32 1 + %35 = OpLoad %int %arg_2 + %36 = OpCompositeConstruct %v3int %33 %34 %35 + %37 = OpLoad %v4int %arg_3 + OpImageWrite %30 %36 %37 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %38 + %40 = OpLabel + %41 = OpFunctionCall %void %textureStore_fbf53f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %43 = OpLabel + %44 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %44 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %47 = OpLabel + %48 = OpFunctionCall %void %textureStore_fbf53f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %50 = OpLabel + %51 = OpFunctionCall %void %textureStore_fbf53f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/fbf53f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/fbf53f.wgsl.expected.wgsl new file mode 100644 index 0000000000..e1d54f5c6b --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/fbf53f.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureStore_fbf53f() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = vec4(); + textureStore(arg_0, arg_1, arg_2, arg_3); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + textureStore_fbf53f(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + textureStore_fbf53f(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + textureStore_fbf53f(); +} diff --git a/test/tint/builtins/gen/var/transpose/2585cd.wgsl b/test/tint/builtins/gen/var/transpose/2585cd.wgsl new file mode 100644 index 0000000000..4c3b60af7c --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/2585cd.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn transpose(mat<4, 3, f32>) -> mat<3, 4, f32> +fn transpose_2585cd() { + var arg_0 = mat4x3(); + var res: mat3x4 = transpose(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + transpose_2585cd(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + transpose_2585cd(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + transpose_2585cd(); +} diff --git a/test/tint/builtins/gen/var/transpose/2585cd.wgsl.expected.glsl b/test/tint/builtins/gen/var/transpose/2585cd.wgsl.expected.glsl new file mode 100644 index 0000000000..121bc40af5 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/2585cd.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void transpose_2585cd() { + mat4x3 arg_0 = mat4x3(vec3(0.0f), vec3(0.0f), vec3(0.0f), vec3(0.0f)); + mat3x4 res = transpose(arg_0); +} + +vec4 vertex_main() { + transpose_2585cd(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void transpose_2585cd() { + mat4x3 arg_0 = mat4x3(vec3(0.0f), vec3(0.0f), vec3(0.0f), vec3(0.0f)); + mat3x4 res = transpose(arg_0); +} + +void fragment_main() { + transpose_2585cd(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void transpose_2585cd() { + mat4x3 arg_0 = mat4x3(vec3(0.0f), vec3(0.0f), vec3(0.0f), vec3(0.0f)); + mat3x4 res = transpose(arg_0); +} + +void compute_main() { + transpose_2585cd(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/2585cd.wgsl.expected.hlsl b/test/tint/builtins/gen/var/transpose/2585cd.wgsl.expected.hlsl new file mode 100644 index 0000000000..1dad91c813 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/2585cd.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void transpose_2585cd() { + float4x3 arg_0 = float4x3((0.0f).xxx, (0.0f).xxx, (0.0f).xxx, (0.0f).xxx); + float3x4 res = transpose(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_2585cd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_2585cd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_2585cd(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/2585cd.wgsl.expected.msl b/test/tint/builtins/gen/var/transpose/2585cd.wgsl.expected.msl new file mode 100644 index 0000000000..7e6823babf --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/2585cd.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void transpose_2585cd() { + float4x3 arg_0 = float4x3(float3(0.0f), float3(0.0f), float3(0.0f), float3(0.0f)); + float3x4 res = transpose(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + transpose_2585cd(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + transpose_2585cd(); + return; +} + +kernel void compute_main() { + transpose_2585cd(); + return; +} + diff --git a/test/tint/builtins/gen/var/transpose/2585cd.wgsl.expected.spvasm b/test/tint/builtins/gen/var/transpose/2585cd.wgsl.expected.spvasm new file mode 100644 index 0000000000..b818932c1d --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/2585cd.wgsl.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %transpose_2585cd "transpose_2585cd" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 +%mat4v3float = OpTypeMatrix %v3float 4 + %15 = OpConstantNull %mat4v3float +%_ptr_Function_mat4v3float = OpTypePointer Function %mat4v3float +%mat3v4float = OpTypeMatrix %v4float 3 +%_ptr_Function_mat3v4float = OpTypePointer Function %mat3v4float + %23 = OpConstantNull %mat3v4float + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%transpose_2585cd = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_mat4v3float Function %15 + %res = OpVariable %_ptr_Function_mat3v4float Function %23 + OpStore %arg_0 %15 + %20 = OpLoad %mat4v3float %arg_0 + %18 = OpTranspose %mat3v4float %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %transpose_2585cd + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %transpose_2585cd + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %transpose_2585cd + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/transpose/2585cd.wgsl.expected.wgsl b/test/tint/builtins/gen/var/transpose/2585cd.wgsl.expected.wgsl new file mode 100644 index 0000000000..52f8c693d3 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/2585cd.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn transpose_2585cd() { + var arg_0 = mat4x3(); + var res : mat3x4 = transpose(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + transpose_2585cd(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + transpose_2585cd(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + transpose_2585cd(); +} diff --git a/test/tint/builtins/gen/var/transpose/31d679.wgsl b/test/tint/builtins/gen/var/transpose/31d679.wgsl new file mode 100644 index 0000000000..c94a0ac7cd --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/31d679.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn transpose(mat<2, 2, f32>) -> mat<2, 2, f32> +fn transpose_31d679() { + var arg_0 = mat2x2(); + var res: mat2x2 = transpose(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + transpose_31d679(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + transpose_31d679(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + transpose_31d679(); +} diff --git a/test/tint/builtins/gen/var/transpose/31d679.wgsl.expected.glsl b/test/tint/builtins/gen/var/transpose/31d679.wgsl.expected.glsl new file mode 100644 index 0000000000..2a5e13cba7 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/31d679.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void transpose_31d679() { + mat2 arg_0 = mat2(vec2(0.0f), vec2(0.0f)); + mat2 res = transpose(arg_0); +} + +vec4 vertex_main() { + transpose_31d679(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void transpose_31d679() { + mat2 arg_0 = mat2(vec2(0.0f), vec2(0.0f)); + mat2 res = transpose(arg_0); +} + +void fragment_main() { + transpose_31d679(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void transpose_31d679() { + mat2 arg_0 = mat2(vec2(0.0f), vec2(0.0f)); + mat2 res = transpose(arg_0); +} + +void compute_main() { + transpose_31d679(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/31d679.wgsl.expected.hlsl b/test/tint/builtins/gen/var/transpose/31d679.wgsl.expected.hlsl new file mode 100644 index 0000000000..c777bd0397 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/31d679.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void transpose_31d679() { + float2x2 arg_0 = float2x2((0.0f).xx, (0.0f).xx); + float2x2 res = transpose(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_31d679(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_31d679(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_31d679(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/31d679.wgsl.expected.msl b/test/tint/builtins/gen/var/transpose/31d679.wgsl.expected.msl new file mode 100644 index 0000000000..060209218e --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/31d679.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void transpose_31d679() { + float2x2 arg_0 = float2x2(float2(0.0f), float2(0.0f)); + float2x2 res = transpose(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + transpose_31d679(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + transpose_31d679(); + return; +} + +kernel void compute_main() { + transpose_31d679(); + return; +} + diff --git a/test/tint/builtins/gen/var/transpose/31d679.wgsl.expected.spvasm b/test/tint/builtins/gen/var/transpose/31d679.wgsl.expected.spvasm new file mode 100644 index 0000000000..10ee30e721 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/31d679.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %transpose_31d679 "transpose_31d679" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%mat2v2float = OpTypeMatrix %v2float 2 + %15 = OpConstantNull %mat2v2float +%_ptr_Function_mat2v2float = OpTypePointer Function %mat2v2float + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%transpose_31d679 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_mat2v2float Function %15 + %res = OpVariable %_ptr_Function_mat2v2float Function %15 + OpStore %arg_0 %15 + %19 = OpLoad %mat2v2float %arg_0 + %18 = OpTranspose %mat2v2float %19 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %transpose_31d679 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %transpose_31d679 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %transpose_31d679 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/transpose/31d679.wgsl.expected.wgsl b/test/tint/builtins/gen/var/transpose/31d679.wgsl.expected.wgsl new file mode 100644 index 0000000000..f40121a9b6 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/31d679.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn transpose_31d679() { + var arg_0 = mat2x2(); + var res : mat2x2 = transpose(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + transpose_31d679(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + transpose_31d679(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + transpose_31d679(); +} diff --git a/test/tint/builtins/gen/var/transpose/31e37e.wgsl b/test/tint/builtins/gen/var/transpose/31e37e.wgsl new file mode 100644 index 0000000000..a7b48bfee3 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/31e37e.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn transpose(mat<4, 2, f32>) -> mat<2, 4, f32> +fn transpose_31e37e() { + var arg_0 = mat4x2(); + var res: mat2x4 = transpose(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + transpose_31e37e(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + transpose_31e37e(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + transpose_31e37e(); +} diff --git a/test/tint/builtins/gen/var/transpose/31e37e.wgsl.expected.glsl b/test/tint/builtins/gen/var/transpose/31e37e.wgsl.expected.glsl new file mode 100644 index 0000000000..46f50d579b --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/31e37e.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void transpose_31e37e() { + mat4x2 arg_0 = mat4x2(vec2(0.0f), vec2(0.0f), vec2(0.0f), vec2(0.0f)); + mat2x4 res = transpose(arg_0); +} + +vec4 vertex_main() { + transpose_31e37e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void transpose_31e37e() { + mat4x2 arg_0 = mat4x2(vec2(0.0f), vec2(0.0f), vec2(0.0f), vec2(0.0f)); + mat2x4 res = transpose(arg_0); +} + +void fragment_main() { + transpose_31e37e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void transpose_31e37e() { + mat4x2 arg_0 = mat4x2(vec2(0.0f), vec2(0.0f), vec2(0.0f), vec2(0.0f)); + mat2x4 res = transpose(arg_0); +} + +void compute_main() { + transpose_31e37e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/31e37e.wgsl.expected.hlsl b/test/tint/builtins/gen/var/transpose/31e37e.wgsl.expected.hlsl new file mode 100644 index 0000000000..c3edf30d28 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/31e37e.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void transpose_31e37e() { + float4x2 arg_0 = float4x2((0.0f).xx, (0.0f).xx, (0.0f).xx, (0.0f).xx); + float2x4 res = transpose(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_31e37e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_31e37e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_31e37e(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/31e37e.wgsl.expected.msl b/test/tint/builtins/gen/var/transpose/31e37e.wgsl.expected.msl new file mode 100644 index 0000000000..16ec8c1798 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/31e37e.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void transpose_31e37e() { + float4x2 arg_0 = float4x2(float2(0.0f), float2(0.0f), float2(0.0f), float2(0.0f)); + float2x4 res = transpose(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + transpose_31e37e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + transpose_31e37e(); + return; +} + +kernel void compute_main() { + transpose_31e37e(); + return; +} + diff --git a/test/tint/builtins/gen/var/transpose/31e37e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/transpose/31e37e.wgsl.expected.spvasm new file mode 100644 index 0000000000..d7a07e4396 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/31e37e.wgsl.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %transpose_31e37e "transpose_31e37e" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%mat4v2float = OpTypeMatrix %v2float 4 + %15 = OpConstantNull %mat4v2float +%_ptr_Function_mat4v2float = OpTypePointer Function %mat4v2float +%mat2v4float = OpTypeMatrix %v4float 2 +%_ptr_Function_mat2v4float = OpTypePointer Function %mat2v4float + %23 = OpConstantNull %mat2v4float + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%transpose_31e37e = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_mat4v2float Function %15 + %res = OpVariable %_ptr_Function_mat2v4float Function %23 + OpStore %arg_0 %15 + %20 = OpLoad %mat4v2float %arg_0 + %18 = OpTranspose %mat2v4float %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %transpose_31e37e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %transpose_31e37e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %transpose_31e37e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/transpose/31e37e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/transpose/31e37e.wgsl.expected.wgsl new file mode 100644 index 0000000000..4215819720 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/31e37e.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn transpose_31e37e() { + var arg_0 = mat4x2(); + var res : mat2x4 = transpose(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + transpose_31e37e(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + transpose_31e37e(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + transpose_31e37e(); +} diff --git a/test/tint/builtins/gen/var/transpose/4ce359.wgsl b/test/tint/builtins/gen/var/transpose/4ce359.wgsl new file mode 100644 index 0000000000..a4d84b47c3 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/4ce359.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn transpose(mat<2, 4, f32>) -> mat<4, 2, f32> +fn transpose_4ce359() { + var arg_0 = mat2x4(); + var res: mat4x2 = transpose(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + transpose_4ce359(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + transpose_4ce359(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + transpose_4ce359(); +} diff --git a/test/tint/builtins/gen/var/transpose/4ce359.wgsl.expected.glsl b/test/tint/builtins/gen/var/transpose/4ce359.wgsl.expected.glsl new file mode 100644 index 0000000000..e8afc4a9c7 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/4ce359.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void transpose_4ce359() { + mat2x4 arg_0 = mat2x4(vec4(0.0f), vec4(0.0f)); + mat4x2 res = transpose(arg_0); +} + +vec4 vertex_main() { + transpose_4ce359(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void transpose_4ce359() { + mat2x4 arg_0 = mat2x4(vec4(0.0f), vec4(0.0f)); + mat4x2 res = transpose(arg_0); +} + +void fragment_main() { + transpose_4ce359(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void transpose_4ce359() { + mat2x4 arg_0 = mat2x4(vec4(0.0f), vec4(0.0f)); + mat4x2 res = transpose(arg_0); +} + +void compute_main() { + transpose_4ce359(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/4ce359.wgsl.expected.hlsl b/test/tint/builtins/gen/var/transpose/4ce359.wgsl.expected.hlsl new file mode 100644 index 0000000000..6c67d928be --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/4ce359.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void transpose_4ce359() { + float2x4 arg_0 = float2x4((0.0f).xxxx, (0.0f).xxxx); + float4x2 res = transpose(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_4ce359(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_4ce359(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_4ce359(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/4ce359.wgsl.expected.msl b/test/tint/builtins/gen/var/transpose/4ce359.wgsl.expected.msl new file mode 100644 index 0000000000..9ee08d482b --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/4ce359.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void transpose_4ce359() { + float2x4 arg_0 = float2x4(float4(0.0f), float4(0.0f)); + float4x2 res = transpose(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + transpose_4ce359(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + transpose_4ce359(); + return; +} + +kernel void compute_main() { + transpose_4ce359(); + return; +} + diff --git a/test/tint/builtins/gen/var/transpose/4ce359.wgsl.expected.spvasm b/test/tint/builtins/gen/var/transpose/4ce359.wgsl.expected.spvasm new file mode 100644 index 0000000000..17e7eb3c87 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/4ce359.wgsl.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %transpose_4ce359 "transpose_4ce359" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%mat2v4float = OpTypeMatrix %v4float 2 + %14 = OpConstantNull %mat2v4float +%_ptr_Function_mat2v4float = OpTypePointer Function %mat2v4float + %v2float = OpTypeVector %float 2 +%mat4v2float = OpTypeMatrix %v2float 4 +%_ptr_Function_mat4v2float = OpTypePointer Function %mat4v2float + %23 = OpConstantNull %mat4v2float + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%transpose_4ce359 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_mat2v4float Function %14 + %res = OpVariable %_ptr_Function_mat4v2float Function %23 + OpStore %arg_0 %14 + %20 = OpLoad %mat2v4float %arg_0 + %17 = OpTranspose %mat4v2float %20 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %transpose_4ce359 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %transpose_4ce359 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %transpose_4ce359 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/transpose/4ce359.wgsl.expected.wgsl b/test/tint/builtins/gen/var/transpose/4ce359.wgsl.expected.wgsl new file mode 100644 index 0000000000..bf5218542f --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/4ce359.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn transpose_4ce359() { + var arg_0 = mat2x4(); + var res : mat4x2 = transpose(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + transpose_4ce359(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + transpose_4ce359(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + transpose_4ce359(); +} diff --git a/test/tint/builtins/gen/var/transpose/4dc9a1.wgsl b/test/tint/builtins/gen/var/transpose/4dc9a1.wgsl new file mode 100644 index 0000000000..bd7be8cbeb --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/4dc9a1.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn transpose(mat<2, 3, f32>) -> mat<3, 2, f32> +fn transpose_4dc9a1() { + var arg_0 = mat2x3(); + var res: mat3x2 = transpose(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + transpose_4dc9a1(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + transpose_4dc9a1(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + transpose_4dc9a1(); +} diff --git a/test/tint/builtins/gen/var/transpose/4dc9a1.wgsl.expected.glsl b/test/tint/builtins/gen/var/transpose/4dc9a1.wgsl.expected.glsl new file mode 100644 index 0000000000..1e05e4c6e8 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/4dc9a1.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void transpose_4dc9a1() { + mat2x3 arg_0 = mat2x3(vec3(0.0f), vec3(0.0f)); + mat3x2 res = transpose(arg_0); +} + +vec4 vertex_main() { + transpose_4dc9a1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void transpose_4dc9a1() { + mat2x3 arg_0 = mat2x3(vec3(0.0f), vec3(0.0f)); + mat3x2 res = transpose(arg_0); +} + +void fragment_main() { + transpose_4dc9a1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void transpose_4dc9a1() { + mat2x3 arg_0 = mat2x3(vec3(0.0f), vec3(0.0f)); + mat3x2 res = transpose(arg_0); +} + +void compute_main() { + transpose_4dc9a1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/4dc9a1.wgsl.expected.hlsl b/test/tint/builtins/gen/var/transpose/4dc9a1.wgsl.expected.hlsl new file mode 100644 index 0000000000..129d6ca1df --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/4dc9a1.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void transpose_4dc9a1() { + float2x3 arg_0 = float2x3((0.0f).xxx, (0.0f).xxx); + float3x2 res = transpose(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_4dc9a1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_4dc9a1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_4dc9a1(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/4dc9a1.wgsl.expected.msl b/test/tint/builtins/gen/var/transpose/4dc9a1.wgsl.expected.msl new file mode 100644 index 0000000000..b2e422f2de --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/4dc9a1.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void transpose_4dc9a1() { + float2x3 arg_0 = float2x3(float3(0.0f), float3(0.0f)); + float3x2 res = transpose(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + transpose_4dc9a1(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + transpose_4dc9a1(); + return; +} + +kernel void compute_main() { + transpose_4dc9a1(); + return; +} + diff --git a/test/tint/builtins/gen/var/transpose/4dc9a1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/transpose/4dc9a1.wgsl.expected.spvasm new file mode 100644 index 0000000000..6ec41694a7 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/4dc9a1.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %transpose_4dc9a1 "transpose_4dc9a1" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 +%mat2v3float = OpTypeMatrix %v3float 2 + %15 = OpConstantNull %mat2v3float +%_ptr_Function_mat2v3float = OpTypePointer Function %mat2v3float + %v2float = OpTypeVector %float 2 +%mat3v2float = OpTypeMatrix %v2float 3 +%_ptr_Function_mat3v2float = OpTypePointer Function %mat3v2float + %24 = OpConstantNull %mat3v2float + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%transpose_4dc9a1 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_mat2v3float Function %15 + %res = OpVariable %_ptr_Function_mat3v2float Function %24 + OpStore %arg_0 %15 + %21 = OpLoad %mat2v3float %arg_0 + %18 = OpTranspose %mat3v2float %21 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %transpose_4dc9a1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %transpose_4dc9a1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %transpose_4dc9a1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/transpose/4dc9a1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/transpose/4dc9a1.wgsl.expected.wgsl new file mode 100644 index 0000000000..817b4f2092 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/4dc9a1.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn transpose_4dc9a1() { + var arg_0 = mat2x3(); + var res : mat3x2 = transpose(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + transpose_4dc9a1(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + transpose_4dc9a1(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + transpose_4dc9a1(); +} diff --git a/test/tint/builtins/gen/var/transpose/854336.wgsl b/test/tint/builtins/gen/var/transpose/854336.wgsl new file mode 100644 index 0000000000..3158b4f471 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/854336.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn transpose(mat<3, 3, f32>) -> mat<3, 3, f32> +fn transpose_854336() { + var arg_0 = mat3x3(); + var res: mat3x3 = transpose(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + transpose_854336(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + transpose_854336(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + transpose_854336(); +} diff --git a/test/tint/builtins/gen/var/transpose/854336.wgsl.expected.glsl b/test/tint/builtins/gen/var/transpose/854336.wgsl.expected.glsl new file mode 100644 index 0000000000..c4d23d60b7 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/854336.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void transpose_854336() { + mat3 arg_0 = mat3(vec3(0.0f), vec3(0.0f), vec3(0.0f)); + mat3 res = transpose(arg_0); +} + +vec4 vertex_main() { + transpose_854336(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void transpose_854336() { + mat3 arg_0 = mat3(vec3(0.0f), vec3(0.0f), vec3(0.0f)); + mat3 res = transpose(arg_0); +} + +void fragment_main() { + transpose_854336(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void transpose_854336() { + mat3 arg_0 = mat3(vec3(0.0f), vec3(0.0f), vec3(0.0f)); + mat3 res = transpose(arg_0); +} + +void compute_main() { + transpose_854336(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/854336.wgsl.expected.hlsl b/test/tint/builtins/gen/var/transpose/854336.wgsl.expected.hlsl new file mode 100644 index 0000000000..a4fa125515 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/854336.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void transpose_854336() { + float3x3 arg_0 = float3x3((0.0f).xxx, (0.0f).xxx, (0.0f).xxx); + float3x3 res = transpose(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_854336(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_854336(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_854336(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/854336.wgsl.expected.msl b/test/tint/builtins/gen/var/transpose/854336.wgsl.expected.msl new file mode 100644 index 0000000000..0548fab67b --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/854336.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void transpose_854336() { + float3x3 arg_0 = float3x3(float3(0.0f), float3(0.0f), float3(0.0f)); + float3x3 res = transpose(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + transpose_854336(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + transpose_854336(); + return; +} + +kernel void compute_main() { + transpose_854336(); + return; +} + diff --git a/test/tint/builtins/gen/var/transpose/854336.wgsl.expected.spvasm b/test/tint/builtins/gen/var/transpose/854336.wgsl.expected.spvasm new file mode 100644 index 0000000000..9c37bf3d59 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/854336.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %transpose_854336 "transpose_854336" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 +%mat3v3float = OpTypeMatrix %v3float 3 + %15 = OpConstantNull %mat3v3float +%_ptr_Function_mat3v3float = OpTypePointer Function %mat3v3float + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%transpose_854336 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_mat3v3float Function %15 + %res = OpVariable %_ptr_Function_mat3v3float Function %15 + OpStore %arg_0 %15 + %19 = OpLoad %mat3v3float %arg_0 + %18 = OpTranspose %mat3v3float %19 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %transpose_854336 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %transpose_854336 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %transpose_854336 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/transpose/854336.wgsl.expected.wgsl b/test/tint/builtins/gen/var/transpose/854336.wgsl.expected.wgsl new file mode 100644 index 0000000000..4321df3929 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/854336.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn transpose_854336() { + var arg_0 = mat3x3(); + var res : mat3x3 = transpose(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + transpose_854336(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + transpose_854336(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + transpose_854336(); +} diff --git a/test/tint/builtins/gen/var/transpose/c1b600.wgsl b/test/tint/builtins/gen/var/transpose/c1b600.wgsl new file mode 100644 index 0000000000..64a03ea692 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/c1b600.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn transpose(mat<4, 4, f32>) -> mat<4, 4, f32> +fn transpose_c1b600() { + var arg_0 = mat4x4(); + var res: mat4x4 = transpose(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + transpose_c1b600(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + transpose_c1b600(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + transpose_c1b600(); +} diff --git a/test/tint/builtins/gen/var/transpose/c1b600.wgsl.expected.glsl b/test/tint/builtins/gen/var/transpose/c1b600.wgsl.expected.glsl new file mode 100644 index 0000000000..d828caba01 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/c1b600.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void transpose_c1b600() { + mat4 arg_0 = mat4(vec4(0.0f), vec4(0.0f), vec4(0.0f), vec4(0.0f)); + mat4 res = transpose(arg_0); +} + +vec4 vertex_main() { + transpose_c1b600(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void transpose_c1b600() { + mat4 arg_0 = mat4(vec4(0.0f), vec4(0.0f), vec4(0.0f), vec4(0.0f)); + mat4 res = transpose(arg_0); +} + +void fragment_main() { + transpose_c1b600(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void transpose_c1b600() { + mat4 arg_0 = mat4(vec4(0.0f), vec4(0.0f), vec4(0.0f), vec4(0.0f)); + mat4 res = transpose(arg_0); +} + +void compute_main() { + transpose_c1b600(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/c1b600.wgsl.expected.hlsl b/test/tint/builtins/gen/var/transpose/c1b600.wgsl.expected.hlsl new file mode 100644 index 0000000000..eb1524a143 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/c1b600.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void transpose_c1b600() { + float4x4 arg_0 = float4x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx); + float4x4 res = transpose(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_c1b600(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_c1b600(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_c1b600(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/c1b600.wgsl.expected.msl b/test/tint/builtins/gen/var/transpose/c1b600.wgsl.expected.msl new file mode 100644 index 0000000000..6125d3fec1 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/c1b600.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void transpose_c1b600() { + float4x4 arg_0 = float4x4(float4(0.0f), float4(0.0f), float4(0.0f), float4(0.0f)); + float4x4 res = transpose(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + transpose_c1b600(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + transpose_c1b600(); + return; +} + +kernel void compute_main() { + transpose_c1b600(); + return; +} + diff --git a/test/tint/builtins/gen/var/transpose/c1b600.wgsl.expected.spvasm b/test/tint/builtins/gen/var/transpose/c1b600.wgsl.expected.spvasm new file mode 100644 index 0000000000..375945abc1 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/c1b600.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %transpose_c1b600 "transpose_c1b600" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%mat4v4float = OpTypeMatrix %v4float 4 + %14 = OpConstantNull %mat4v4float +%_ptr_Function_mat4v4float = OpTypePointer Function %mat4v4float + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%transpose_c1b600 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_mat4v4float Function %14 + %res = OpVariable %_ptr_Function_mat4v4float Function %14 + OpStore %arg_0 %14 + %18 = OpLoad %mat4v4float %arg_0 + %17 = OpTranspose %mat4v4float %18 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %transpose_c1b600 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %transpose_c1b600 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %transpose_c1b600 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/transpose/c1b600.wgsl.expected.wgsl b/test/tint/builtins/gen/var/transpose/c1b600.wgsl.expected.wgsl new file mode 100644 index 0000000000..bca96211cc --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/c1b600.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn transpose_c1b600() { + var arg_0 = mat4x4(); + var res : mat4x4 = transpose(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + transpose_c1b600(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + transpose_c1b600(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + transpose_c1b600(); +} diff --git a/test/tint/builtins/gen/var/transpose/d8f8ba.wgsl b/test/tint/builtins/gen/var/transpose/d8f8ba.wgsl new file mode 100644 index 0000000000..6abd82fcf2 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/d8f8ba.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn transpose(mat<3, 4, f32>) -> mat<4, 3, f32> +fn transpose_d8f8ba() { + var arg_0 = mat3x4(); + var res: mat4x3 = transpose(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + transpose_d8f8ba(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + transpose_d8f8ba(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + transpose_d8f8ba(); +} diff --git a/test/tint/builtins/gen/var/transpose/d8f8ba.wgsl.expected.glsl b/test/tint/builtins/gen/var/transpose/d8f8ba.wgsl.expected.glsl new file mode 100644 index 0000000000..61d6d2b8ac --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/d8f8ba.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void transpose_d8f8ba() { + mat3x4 arg_0 = mat3x4(vec4(0.0f), vec4(0.0f), vec4(0.0f)); + mat4x3 res = transpose(arg_0); +} + +vec4 vertex_main() { + transpose_d8f8ba(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void transpose_d8f8ba() { + mat3x4 arg_0 = mat3x4(vec4(0.0f), vec4(0.0f), vec4(0.0f)); + mat4x3 res = transpose(arg_0); +} + +void fragment_main() { + transpose_d8f8ba(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void transpose_d8f8ba() { + mat3x4 arg_0 = mat3x4(vec4(0.0f), vec4(0.0f), vec4(0.0f)); + mat4x3 res = transpose(arg_0); +} + +void compute_main() { + transpose_d8f8ba(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/d8f8ba.wgsl.expected.hlsl b/test/tint/builtins/gen/var/transpose/d8f8ba.wgsl.expected.hlsl new file mode 100644 index 0000000000..2a984c8f8d --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/d8f8ba.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void transpose_d8f8ba() { + float3x4 arg_0 = float3x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx); + float4x3 res = transpose(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_d8f8ba(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_d8f8ba(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_d8f8ba(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/d8f8ba.wgsl.expected.msl b/test/tint/builtins/gen/var/transpose/d8f8ba.wgsl.expected.msl new file mode 100644 index 0000000000..5e674fd2c8 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/d8f8ba.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void transpose_d8f8ba() { + float3x4 arg_0 = float3x4(float4(0.0f), float4(0.0f), float4(0.0f)); + float4x3 res = transpose(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + transpose_d8f8ba(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + transpose_d8f8ba(); + return; +} + +kernel void compute_main() { + transpose_d8f8ba(); + return; +} + diff --git a/test/tint/builtins/gen/var/transpose/d8f8ba.wgsl.expected.spvasm b/test/tint/builtins/gen/var/transpose/d8f8ba.wgsl.expected.spvasm new file mode 100644 index 0000000000..946dd8c8a1 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/d8f8ba.wgsl.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %transpose_d8f8ba "transpose_d8f8ba" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%mat3v4float = OpTypeMatrix %v4float 3 + %14 = OpConstantNull %mat3v4float +%_ptr_Function_mat3v4float = OpTypePointer Function %mat3v4float + %v3float = OpTypeVector %float 3 +%mat4v3float = OpTypeMatrix %v3float 4 +%_ptr_Function_mat4v3float = OpTypePointer Function %mat4v3float + %23 = OpConstantNull %mat4v3float + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%transpose_d8f8ba = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_mat3v4float Function %14 + %res = OpVariable %_ptr_Function_mat4v3float Function %23 + OpStore %arg_0 %14 + %20 = OpLoad %mat3v4float %arg_0 + %17 = OpTranspose %mat4v3float %20 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %transpose_d8f8ba + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %transpose_d8f8ba + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %transpose_d8f8ba + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/transpose/d8f8ba.wgsl.expected.wgsl b/test/tint/builtins/gen/var/transpose/d8f8ba.wgsl.expected.wgsl new file mode 100644 index 0000000000..14f91f09e7 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/d8f8ba.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn transpose_d8f8ba() { + var arg_0 = mat3x4(); + var res : mat4x3 = transpose(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + transpose_d8f8ba(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + transpose_d8f8ba(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + transpose_d8f8ba(); +} diff --git a/test/tint/builtins/gen/var/transpose/ed4bdc.wgsl b/test/tint/builtins/gen/var/transpose/ed4bdc.wgsl new file mode 100644 index 0000000000..ed30d846f5 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/ed4bdc.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn transpose(mat<3, 2, f32>) -> mat<2, 3, f32> +fn transpose_ed4bdc() { + var arg_0 = mat3x2(); + var res: mat2x3 = transpose(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + transpose_ed4bdc(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + transpose_ed4bdc(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + transpose_ed4bdc(); +} diff --git a/test/tint/builtins/gen/var/transpose/ed4bdc.wgsl.expected.glsl b/test/tint/builtins/gen/var/transpose/ed4bdc.wgsl.expected.glsl new file mode 100644 index 0000000000..37e1788aa8 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/ed4bdc.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void transpose_ed4bdc() { + mat3x2 arg_0 = mat3x2(vec2(0.0f), vec2(0.0f), vec2(0.0f)); + mat2x3 res = transpose(arg_0); +} + +vec4 vertex_main() { + transpose_ed4bdc(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void transpose_ed4bdc() { + mat3x2 arg_0 = mat3x2(vec2(0.0f), vec2(0.0f), vec2(0.0f)); + mat2x3 res = transpose(arg_0); +} + +void fragment_main() { + transpose_ed4bdc(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void transpose_ed4bdc() { + mat3x2 arg_0 = mat3x2(vec2(0.0f), vec2(0.0f), vec2(0.0f)); + mat2x3 res = transpose(arg_0); +} + +void compute_main() { + transpose_ed4bdc(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/ed4bdc.wgsl.expected.hlsl b/test/tint/builtins/gen/var/transpose/ed4bdc.wgsl.expected.hlsl new file mode 100644 index 0000000000..d3b65766bb --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/ed4bdc.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void transpose_ed4bdc() { + float3x2 arg_0 = float3x2((0.0f).xx, (0.0f).xx, (0.0f).xx); + float2x3 res = transpose(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_ed4bdc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_ed4bdc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_ed4bdc(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/ed4bdc.wgsl.expected.msl b/test/tint/builtins/gen/var/transpose/ed4bdc.wgsl.expected.msl new file mode 100644 index 0000000000..1aac4ca5e4 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/ed4bdc.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void transpose_ed4bdc() { + float3x2 arg_0 = float3x2(float2(0.0f), float2(0.0f), float2(0.0f)); + float2x3 res = transpose(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + transpose_ed4bdc(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + transpose_ed4bdc(); + return; +} + +kernel void compute_main() { + transpose_ed4bdc(); + return; +} + diff --git a/test/tint/builtins/gen/var/transpose/ed4bdc.wgsl.expected.spvasm b/test/tint/builtins/gen/var/transpose/ed4bdc.wgsl.expected.spvasm new file mode 100644 index 0000000000..2b1a390546 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/ed4bdc.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %transpose_ed4bdc "transpose_ed4bdc" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%mat3v2float = OpTypeMatrix %v2float 3 + %15 = OpConstantNull %mat3v2float +%_ptr_Function_mat3v2float = OpTypePointer Function %mat3v2float + %v3float = OpTypeVector %float 3 +%mat2v3float = OpTypeMatrix %v3float 2 +%_ptr_Function_mat2v3float = OpTypePointer Function %mat2v3float + %24 = OpConstantNull %mat2v3float + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%transpose_ed4bdc = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_mat3v2float Function %15 + %res = OpVariable %_ptr_Function_mat2v3float Function %24 + OpStore %arg_0 %15 + %21 = OpLoad %mat3v2float %arg_0 + %18 = OpTranspose %mat2v3float %21 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %transpose_ed4bdc + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %transpose_ed4bdc + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %transpose_ed4bdc + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/transpose/ed4bdc.wgsl.expected.wgsl b/test/tint/builtins/gen/var/transpose/ed4bdc.wgsl.expected.wgsl new file mode 100644 index 0000000000..bdc221e436 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/ed4bdc.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn transpose_ed4bdc() { + var arg_0 = mat3x2(); + var res : mat2x3 = transpose(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + transpose_ed4bdc(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + transpose_ed4bdc(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + transpose_ed4bdc(); +} diff --git a/test/tint/builtins/gen/var/trunc/562d05.wgsl b/test/tint/builtins/gen/var/trunc/562d05.wgsl new file mode 100644 index 0000000000..d805032b28 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/562d05.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn trunc(vec<3, f32>) -> vec<3, f32> +fn trunc_562d05() { + var arg_0 = vec3(); + var res: vec3 = trunc(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + trunc_562d05(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + trunc_562d05(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + trunc_562d05(); +} diff --git a/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.glsl b/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.glsl new file mode 100644 index 0000000000..a0cc091a46 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void trunc_562d05() { + vec3 arg_0 = vec3(0.0f); + vec3 res = trunc(arg_0); +} + +vec4 vertex_main() { + trunc_562d05(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void trunc_562d05() { + vec3 arg_0 = vec3(0.0f); + vec3 res = trunc(arg_0); +} + +void fragment_main() { + trunc_562d05(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void trunc_562d05() { + vec3 arg_0 = vec3(0.0f); + vec3 res = trunc(arg_0); +} + +void compute_main() { + trunc_562d05(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.hlsl b/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.hlsl new file mode 100644 index 0000000000..e7ac694bc9 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void trunc_562d05() { + float3 arg_0 = (0.0f).xxx; + float3 res = trunc(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + trunc_562d05(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + trunc_562d05(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + trunc_562d05(); + return; +} diff --git a/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.msl b/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.msl new file mode 100644 index 0000000000..a07446cc33 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void trunc_562d05() { + float3 arg_0 = float3(0.0f); + float3 res = trunc(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + trunc_562d05(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + trunc_562d05(); + return; +} + +kernel void compute_main() { + trunc_562d05(); + return; +} + diff --git a/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.spvasm b/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.spvasm new file mode 100644 index 0000000000..a689aae384 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %trunc_562d05 "trunc_562d05" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %14 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%trunc_562d05 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %14 + %res = OpVariable %_ptr_Function_v3float Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %v3float %arg_0 + %17 = OpExtInst %v3float %18 Trunc %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %trunc_562d05 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %trunc_562d05 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %trunc_562d05 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.wgsl b/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.wgsl new file mode 100644 index 0000000000..44ace1320d --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn trunc_562d05() { + var arg_0 = vec3(); + var res : vec3 = trunc(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + trunc_562d05(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + trunc_562d05(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + trunc_562d05(); +} diff --git a/test/tint/builtins/gen/var/trunc/e183aa.wgsl b/test/tint/builtins/gen/var/trunc/e183aa.wgsl new file mode 100644 index 0000000000..d6f67ed9d8 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/e183aa.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn trunc(vec<4, f32>) -> vec<4, f32> +fn trunc_e183aa() { + var arg_0 = vec4(); + var res: vec4 = trunc(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + trunc_e183aa(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + trunc_e183aa(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + trunc_e183aa(); +} diff --git a/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.glsl b/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.glsl new file mode 100644 index 0000000000..52576b2a57 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void trunc_e183aa() { + vec4 arg_0 = vec4(0.0f); + vec4 res = trunc(arg_0); +} + +vec4 vertex_main() { + trunc_e183aa(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void trunc_e183aa() { + vec4 arg_0 = vec4(0.0f); + vec4 res = trunc(arg_0); +} + +void fragment_main() { + trunc_e183aa(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void trunc_e183aa() { + vec4 arg_0 = vec4(0.0f); + vec4 res = trunc(arg_0); +} + +void compute_main() { + trunc_e183aa(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.hlsl b/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.hlsl new file mode 100644 index 0000000000..b69f9649eb --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void trunc_e183aa() { + float4 arg_0 = (0.0f).xxxx; + float4 res = trunc(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + trunc_e183aa(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + trunc_e183aa(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + trunc_e183aa(); + return; +} diff --git a/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.msl b/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.msl new file mode 100644 index 0000000000..e57c538b06 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void trunc_e183aa() { + float4 arg_0 = float4(0.0f); + float4 res = trunc(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + trunc_e183aa(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + trunc_e183aa(); + return; +} + +kernel void compute_main() { + trunc_e183aa(); + return; +} + diff --git a/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.spvasm b/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.spvasm new file mode 100644 index 0000000000..e6efcfdfa6 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %trunc_e183aa "trunc_e183aa" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%trunc_e183aa = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %5 + %17 = OpLoad %v4float %arg_0 + %15 = OpExtInst %v4float %16 Trunc %17 + OpStore %res %15 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %trunc_e183aa + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %trunc_e183aa + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %trunc_e183aa + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.wgsl b/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.wgsl new file mode 100644 index 0000000000..6e1a9a4251 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn trunc_e183aa() { + var arg_0 = vec4(); + var res : vec4 = trunc(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + trunc_e183aa(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + trunc_e183aa(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + trunc_e183aa(); +} diff --git a/test/tint/builtins/gen/var/trunc/eb83df.wgsl b/test/tint/builtins/gen/var/trunc/eb83df.wgsl new file mode 100644 index 0000000000..6b375b7556 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/eb83df.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn trunc(f32) -> f32 +fn trunc_eb83df() { + var arg_0 = 1.0; + var res: f32 = trunc(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + trunc_eb83df(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + trunc_eb83df(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + trunc_eb83df(); +} diff --git a/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.glsl b/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.glsl new file mode 100644 index 0000000000..57e9bd8e22 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void trunc_eb83df() { + float arg_0 = 1.0f; + float res = trunc(arg_0); +} + +vec4 vertex_main() { + trunc_eb83df(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void trunc_eb83df() { + float arg_0 = 1.0f; + float res = trunc(arg_0); +} + +void fragment_main() { + trunc_eb83df(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void trunc_eb83df() { + float arg_0 = 1.0f; + float res = trunc(arg_0); +} + +void compute_main() { + trunc_eb83df(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.hlsl b/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.hlsl new file mode 100644 index 0000000000..7f13d9aa9c --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void trunc_eb83df() { + float arg_0 = 1.0f; + float res = trunc(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + trunc_eb83df(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + trunc_eb83df(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + trunc_eb83df(); + return; +} diff --git a/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.msl b/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.msl new file mode 100644 index 0000000000..2408d6cc46 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void trunc_eb83df() { + float arg_0 = 1.0f; + float res = trunc(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + trunc_eb83df(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + trunc_eb83df(); + return; +} + +kernel void compute_main() { + trunc_eb83df(); + return; +} + diff --git a/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.spvasm b/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.spvasm new file mode 100644 index 0000000000..f5fa2a263e --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %trunc_eb83df "trunc_eb83df" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %20 = OpTypeFunction %v4float +%trunc_eb83df = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + %18 = OpLoad %float %arg_0 + %16 = OpExtInst %float %17 Trunc %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %trunc_eb83df + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %trunc_eb83df + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %trunc_eb83df + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.wgsl b/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.wgsl new file mode 100644 index 0000000000..183abed6f9 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn trunc_eb83df() { + var arg_0 = 1.0; + var res : f32 = trunc(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + trunc_eb83df(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + trunc_eb83df(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + trunc_eb83df(); +} diff --git a/test/tint/builtins/gen/var/trunc/f370d3.wgsl b/test/tint/builtins/gen/var/trunc/f370d3.wgsl new file mode 100644 index 0000000000..a5e40b46b1 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/f370d3.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn trunc(vec<2, f32>) -> vec<2, f32> +fn trunc_f370d3() { + var arg_0 = vec2(); + var res: vec2 = trunc(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + trunc_f370d3(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + trunc_f370d3(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + trunc_f370d3(); +} diff --git a/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.glsl b/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.glsl new file mode 100644 index 0000000000..218ac0aafe --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void trunc_f370d3() { + vec2 arg_0 = vec2(0.0f); + vec2 res = trunc(arg_0); +} + +vec4 vertex_main() { + trunc_f370d3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void trunc_f370d3() { + vec2 arg_0 = vec2(0.0f); + vec2 res = trunc(arg_0); +} + +void fragment_main() { + trunc_f370d3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void trunc_f370d3() { + vec2 arg_0 = vec2(0.0f); + vec2 res = trunc(arg_0); +} + +void compute_main() { + trunc_f370d3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.hlsl b/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.hlsl new file mode 100644 index 0000000000..79c0c0e8f5 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +void trunc_f370d3() { + float2 arg_0 = (0.0f).xx; + float2 res = trunc(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + trunc_f370d3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + trunc_f370d3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + trunc_f370d3(); + return; +} diff --git a/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.msl b/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.msl new file mode 100644 index 0000000000..9a020abae6 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void trunc_f370d3() { + float2 arg_0 = float2(0.0f); + float2 res = trunc(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + trunc_f370d3(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + trunc_f370d3(); + return; +} + +kernel void compute_main() { + trunc_f370d3(); + return; +} + diff --git a/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.spvasm new file mode 100644 index 0000000000..947d4967a0 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %trunc_f370d3 "trunc_f370d3" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %14 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%trunc_f370d3 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %14 + %res = OpVariable %_ptr_Function_v2float Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %v2float %arg_0 + %17 = OpExtInst %v2float %18 Trunc %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %trunc_f370d3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %trunc_f370d3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %trunc_f370d3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.wgsl new file mode 100644 index 0000000000..8f0468b65a --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn trunc_f370d3() { + var arg_0 = vec2(); + var res : vec2 = trunc(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + trunc_f370d3(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + trunc_f370d3(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + trunc_f370d3(); +} diff --git a/test/tint/builtins/gen/var/unpack2x16float/32a5cf.wgsl b/test/tint/builtins/gen/var/unpack2x16float/32a5cf.wgsl new file mode 100644 index 0000000000..c4a57a09e5 --- /dev/null +++ b/test/tint/builtins/gen/var/unpack2x16float/32a5cf.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn unpack2x16float(u32) -> vec2 +fn unpack2x16float_32a5cf() { + var arg_0 = 1u; + var res: vec2 = unpack2x16float(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + unpack2x16float_32a5cf(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + unpack2x16float_32a5cf(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + unpack2x16float_32a5cf(); +} diff --git a/test/tint/builtins/gen/var/unpack2x16float/32a5cf.wgsl.expected.glsl b/test/tint/builtins/gen/var/unpack2x16float/32a5cf.wgsl.expected.glsl new file mode 100644 index 0000000000..e88f3bcd96 --- /dev/null +++ b/test/tint/builtins/gen/var/unpack2x16float/32a5cf.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void unpack2x16float_32a5cf() { + uint arg_0 = 1u; + vec2 res = unpackHalf2x16(arg_0); +} + +vec4 vertex_main() { + unpack2x16float_32a5cf(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void unpack2x16float_32a5cf() { + uint arg_0 = 1u; + vec2 res = unpackHalf2x16(arg_0); +} + +void fragment_main() { + unpack2x16float_32a5cf(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void unpack2x16float_32a5cf() { + uint arg_0 = 1u; + vec2 res = unpackHalf2x16(arg_0); +} + +void compute_main() { + unpack2x16float_32a5cf(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/unpack2x16float/32a5cf.wgsl.expected.hlsl b/test/tint/builtins/gen/var/unpack2x16float/32a5cf.wgsl.expected.hlsl new file mode 100644 index 0000000000..1497db89b3 --- /dev/null +++ b/test/tint/builtins/gen/var/unpack2x16float/32a5cf.wgsl.expected.hlsl @@ -0,0 +1,36 @@ +float2 tint_unpack2x16float(uint param_0) { + uint i = param_0; + return f16tof32(uint2(i & 0xffff, i >> 16)); +} + +void unpack2x16float_32a5cf() { + uint arg_0 = 1u; + float2 res = tint_unpack2x16float(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + unpack2x16float_32a5cf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + unpack2x16float_32a5cf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + unpack2x16float_32a5cf(); + return; +} diff --git a/test/tint/builtins/gen/var/unpack2x16float/32a5cf.wgsl.expected.msl b/test/tint/builtins/gen/var/unpack2x16float/32a5cf.wgsl.expected.msl new file mode 100644 index 0000000000..9bd1c579f2 --- /dev/null +++ b/test/tint/builtins/gen/var/unpack2x16float/32a5cf.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void unpack2x16float_32a5cf() { + uint arg_0 = 1u; + float2 res = float2(as_type(arg_0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + unpack2x16float_32a5cf(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + unpack2x16float_32a5cf(); + return; +} + +kernel void compute_main() { + unpack2x16float_32a5cf(); + return; +} + diff --git a/test/tint/builtins/gen/var/unpack2x16float/32a5cf.wgsl.expected.spvasm b/test/tint/builtins/gen/var/unpack2x16float/32a5cf.wgsl.expected.spvasm new file mode 100644 index 0000000000..1abc4ab13f --- /dev/null +++ b/test/tint/builtins/gen/var/unpack2x16float/32a5cf.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %unpack2x16float_32a5cf "unpack2x16float_32a5cf" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %17 = OpConstantNull %uint + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %24 = OpConstantNull %v2float + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%unpack2x16float_32a5cf = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_uint Function %17 + %res = OpVariable %_ptr_Function_v2float Function %24 + OpStore %arg_0 %uint_1 + %21 = OpLoad %uint %arg_0 + %18 = OpExtInst %v2float %20 UnpackHalf2x16 %21 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %unpack2x16float_32a5cf + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %unpack2x16float_32a5cf + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %unpack2x16float_32a5cf + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/unpack2x16float/32a5cf.wgsl.expected.wgsl b/test/tint/builtins/gen/var/unpack2x16float/32a5cf.wgsl.expected.wgsl new file mode 100644 index 0000000000..1e475e3842 --- /dev/null +++ b/test/tint/builtins/gen/var/unpack2x16float/32a5cf.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn unpack2x16float_32a5cf() { + var arg_0 = 1u; + var res : vec2 = unpack2x16float(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + unpack2x16float_32a5cf(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + unpack2x16float_32a5cf(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + unpack2x16float_32a5cf(); +} diff --git a/test/tint/builtins/gen/var/unpack2x16snorm/b4aea6.wgsl b/test/tint/builtins/gen/var/unpack2x16snorm/b4aea6.wgsl new file mode 100644 index 0000000000..ca0db328fe --- /dev/null +++ b/test/tint/builtins/gen/var/unpack2x16snorm/b4aea6.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn unpack2x16snorm(u32) -> vec2 +fn unpack2x16snorm_b4aea6() { + var arg_0 = 1u; + var res: vec2 = unpack2x16snorm(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + unpack2x16snorm_b4aea6(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + unpack2x16snorm_b4aea6(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + unpack2x16snorm_b4aea6(); +} diff --git a/test/tint/builtins/gen/var/unpack2x16snorm/b4aea6.wgsl.expected.glsl b/test/tint/builtins/gen/var/unpack2x16snorm/b4aea6.wgsl.expected.glsl new file mode 100644 index 0000000000..bb3b180e66 --- /dev/null +++ b/test/tint/builtins/gen/var/unpack2x16snorm/b4aea6.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void unpack2x16snorm_b4aea6() { + uint arg_0 = 1u; + vec2 res = unpackSnorm2x16(arg_0); +} + +vec4 vertex_main() { + unpack2x16snorm_b4aea6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void unpack2x16snorm_b4aea6() { + uint arg_0 = 1u; + vec2 res = unpackSnorm2x16(arg_0); +} + +void fragment_main() { + unpack2x16snorm_b4aea6(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void unpack2x16snorm_b4aea6() { + uint arg_0 = 1u; + vec2 res = unpackSnorm2x16(arg_0); +} + +void compute_main() { + unpack2x16snorm_b4aea6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/unpack2x16snorm/b4aea6.wgsl.expected.hlsl b/test/tint/builtins/gen/var/unpack2x16snorm/b4aea6.wgsl.expected.hlsl new file mode 100644 index 0000000000..ab650e8f52 --- /dev/null +++ b/test/tint/builtins/gen/var/unpack2x16snorm/b4aea6.wgsl.expected.hlsl @@ -0,0 +1,37 @@ +float2 tint_unpack2x16snorm(uint param_0) { + int j = int(param_0); + int2 i = int2(j << 16, j) >> 16; + return clamp(float2(i) / 32767.0, -1.0, 1.0); +} + +void unpack2x16snorm_b4aea6() { + uint arg_0 = 1u; + float2 res = tint_unpack2x16snorm(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + unpack2x16snorm_b4aea6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + unpack2x16snorm_b4aea6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + unpack2x16snorm_b4aea6(); + return; +} diff --git a/test/tint/builtins/gen/var/unpack2x16snorm/b4aea6.wgsl.expected.msl b/test/tint/builtins/gen/var/unpack2x16snorm/b4aea6.wgsl.expected.msl new file mode 100644 index 0000000000..f3290ba722 --- /dev/null +++ b/test/tint/builtins/gen/var/unpack2x16snorm/b4aea6.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void unpack2x16snorm_b4aea6() { + uint arg_0 = 1u; + float2 res = unpack_snorm2x16_to_float(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + unpack2x16snorm_b4aea6(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + unpack2x16snorm_b4aea6(); + return; +} + +kernel void compute_main() { + unpack2x16snorm_b4aea6(); + return; +} + diff --git a/test/tint/builtins/gen/var/unpack2x16snorm/b4aea6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/unpack2x16snorm/b4aea6.wgsl.expected.spvasm new file mode 100644 index 0000000000..9f93655432 --- /dev/null +++ b/test/tint/builtins/gen/var/unpack2x16snorm/b4aea6.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %unpack2x16snorm_b4aea6 "unpack2x16snorm_b4aea6" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %17 = OpConstantNull %uint + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %24 = OpConstantNull %v2float + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%unpack2x16snorm_b4aea6 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_uint Function %17 + %res = OpVariable %_ptr_Function_v2float Function %24 + OpStore %arg_0 %uint_1 + %21 = OpLoad %uint %arg_0 + %18 = OpExtInst %v2float %20 UnpackSnorm2x16 %21 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %unpack2x16snorm_b4aea6 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %unpack2x16snorm_b4aea6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %unpack2x16snorm_b4aea6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/unpack2x16snorm/b4aea6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/unpack2x16snorm/b4aea6.wgsl.expected.wgsl new file mode 100644 index 0000000000..f27c905170 --- /dev/null +++ b/test/tint/builtins/gen/var/unpack2x16snorm/b4aea6.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn unpack2x16snorm_b4aea6() { + var arg_0 = 1u; + var res : vec2 = unpack2x16snorm(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + unpack2x16snorm_b4aea6(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + unpack2x16snorm_b4aea6(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + unpack2x16snorm_b4aea6(); +} diff --git a/test/tint/builtins/gen/var/unpack2x16unorm/7699c0.wgsl b/test/tint/builtins/gen/var/unpack2x16unorm/7699c0.wgsl new file mode 100644 index 0000000000..382b2d65c7 --- /dev/null +++ b/test/tint/builtins/gen/var/unpack2x16unorm/7699c0.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn unpack2x16unorm(u32) -> vec2 +fn unpack2x16unorm_7699c0() { + var arg_0 = 1u; + var res: vec2 = unpack2x16unorm(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + unpack2x16unorm_7699c0(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + unpack2x16unorm_7699c0(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + unpack2x16unorm_7699c0(); +} diff --git a/test/tint/builtins/gen/var/unpack2x16unorm/7699c0.wgsl.expected.glsl b/test/tint/builtins/gen/var/unpack2x16unorm/7699c0.wgsl.expected.glsl new file mode 100644 index 0000000000..500c304196 --- /dev/null +++ b/test/tint/builtins/gen/var/unpack2x16unorm/7699c0.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void unpack2x16unorm_7699c0() { + uint arg_0 = 1u; + vec2 res = unpackUnorm2x16(arg_0); +} + +vec4 vertex_main() { + unpack2x16unorm_7699c0(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void unpack2x16unorm_7699c0() { + uint arg_0 = 1u; + vec2 res = unpackUnorm2x16(arg_0); +} + +void fragment_main() { + unpack2x16unorm_7699c0(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void unpack2x16unorm_7699c0() { + uint arg_0 = 1u; + vec2 res = unpackUnorm2x16(arg_0); +} + +void compute_main() { + unpack2x16unorm_7699c0(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/unpack2x16unorm/7699c0.wgsl.expected.hlsl b/test/tint/builtins/gen/var/unpack2x16unorm/7699c0.wgsl.expected.hlsl new file mode 100644 index 0000000000..acf38cabbc --- /dev/null +++ b/test/tint/builtins/gen/var/unpack2x16unorm/7699c0.wgsl.expected.hlsl @@ -0,0 +1,37 @@ +float2 tint_unpack2x16unorm(uint param_0) { + uint j = param_0; + uint2 i = uint2(j & 0xffff, j >> 16); + return float2(i) / 65535.0; +} + +void unpack2x16unorm_7699c0() { + uint arg_0 = 1u; + float2 res = tint_unpack2x16unorm(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + unpack2x16unorm_7699c0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + unpack2x16unorm_7699c0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + unpack2x16unorm_7699c0(); + return; +} diff --git a/test/tint/builtins/gen/var/unpack2x16unorm/7699c0.wgsl.expected.msl b/test/tint/builtins/gen/var/unpack2x16unorm/7699c0.wgsl.expected.msl new file mode 100644 index 0000000000..9c935ce1f0 --- /dev/null +++ b/test/tint/builtins/gen/var/unpack2x16unorm/7699c0.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void unpack2x16unorm_7699c0() { + uint arg_0 = 1u; + float2 res = unpack_unorm2x16_to_float(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + unpack2x16unorm_7699c0(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + unpack2x16unorm_7699c0(); + return; +} + +kernel void compute_main() { + unpack2x16unorm_7699c0(); + return; +} + diff --git a/test/tint/builtins/gen/var/unpack2x16unorm/7699c0.wgsl.expected.spvasm b/test/tint/builtins/gen/var/unpack2x16unorm/7699c0.wgsl.expected.spvasm new file mode 100644 index 0000000000..d73b4479a5 --- /dev/null +++ b/test/tint/builtins/gen/var/unpack2x16unorm/7699c0.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %unpack2x16unorm_7699c0 "unpack2x16unorm_7699c0" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %17 = OpConstantNull %uint + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %24 = OpConstantNull %v2float + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%unpack2x16unorm_7699c0 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_uint Function %17 + %res = OpVariable %_ptr_Function_v2float Function %24 + OpStore %arg_0 %uint_1 + %21 = OpLoad %uint %arg_0 + %18 = OpExtInst %v2float %20 UnpackUnorm2x16 %21 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %unpack2x16unorm_7699c0 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %unpack2x16unorm_7699c0 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %unpack2x16unorm_7699c0 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/unpack2x16unorm/7699c0.wgsl.expected.wgsl b/test/tint/builtins/gen/var/unpack2x16unorm/7699c0.wgsl.expected.wgsl new file mode 100644 index 0000000000..15f75059fa --- /dev/null +++ b/test/tint/builtins/gen/var/unpack2x16unorm/7699c0.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn unpack2x16unorm_7699c0() { + var arg_0 = 1u; + var res : vec2 = unpack2x16unorm(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + unpack2x16unorm_7699c0(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + unpack2x16unorm_7699c0(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + unpack2x16unorm_7699c0(); +} diff --git a/test/tint/builtins/gen/var/unpack4x8snorm/523fb3.wgsl b/test/tint/builtins/gen/var/unpack4x8snorm/523fb3.wgsl new file mode 100644 index 0000000000..eda71e05c6 --- /dev/null +++ b/test/tint/builtins/gen/var/unpack4x8snorm/523fb3.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn unpack4x8snorm(u32) -> vec4 +fn unpack4x8snorm_523fb3() { + var arg_0 = 1u; + var res: vec4 = unpack4x8snorm(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + unpack4x8snorm_523fb3(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + unpack4x8snorm_523fb3(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + unpack4x8snorm_523fb3(); +} diff --git a/test/tint/builtins/gen/var/unpack4x8snorm/523fb3.wgsl.expected.glsl b/test/tint/builtins/gen/var/unpack4x8snorm/523fb3.wgsl.expected.glsl new file mode 100644 index 0000000000..2f7c01bf80 --- /dev/null +++ b/test/tint/builtins/gen/var/unpack4x8snorm/523fb3.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void unpack4x8snorm_523fb3() { + uint arg_0 = 1u; + vec4 res = unpackSnorm4x8(arg_0); +} + +vec4 vertex_main() { + unpack4x8snorm_523fb3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void unpack4x8snorm_523fb3() { + uint arg_0 = 1u; + vec4 res = unpackSnorm4x8(arg_0); +} + +void fragment_main() { + unpack4x8snorm_523fb3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void unpack4x8snorm_523fb3() { + uint arg_0 = 1u; + vec4 res = unpackSnorm4x8(arg_0); +} + +void compute_main() { + unpack4x8snorm_523fb3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/unpack4x8snorm/523fb3.wgsl.expected.hlsl b/test/tint/builtins/gen/var/unpack4x8snorm/523fb3.wgsl.expected.hlsl new file mode 100644 index 0000000000..b7cc7308a4 --- /dev/null +++ b/test/tint/builtins/gen/var/unpack4x8snorm/523fb3.wgsl.expected.hlsl @@ -0,0 +1,37 @@ +float4 tint_unpack4x8snorm(uint param_0) { + int j = int(param_0); + int4 i = int4(j << 24, j << 16, j << 8, j) >> 24; + return clamp(float4(i) / 127.0, -1.0, 1.0); +} + +void unpack4x8snorm_523fb3() { + uint arg_0 = 1u; + float4 res = tint_unpack4x8snorm(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + unpack4x8snorm_523fb3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + unpack4x8snorm_523fb3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + unpack4x8snorm_523fb3(); + return; +} diff --git a/test/tint/builtins/gen/var/unpack4x8snorm/523fb3.wgsl.expected.msl b/test/tint/builtins/gen/var/unpack4x8snorm/523fb3.wgsl.expected.msl new file mode 100644 index 0000000000..364d8ea43a --- /dev/null +++ b/test/tint/builtins/gen/var/unpack4x8snorm/523fb3.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void unpack4x8snorm_523fb3() { + uint arg_0 = 1u; + float4 res = unpack_snorm4x8_to_float(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + unpack4x8snorm_523fb3(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + unpack4x8snorm_523fb3(); + return; +} + +kernel void compute_main() { + unpack4x8snorm_523fb3(); + return; +} + diff --git a/test/tint/builtins/gen/var/unpack4x8snorm/523fb3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/unpack4x8snorm/523fb3.wgsl.expected.spvasm new file mode 100644 index 0000000000..3ce5456522 --- /dev/null +++ b/test/tint/builtins/gen/var/unpack4x8snorm/523fb3.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %unpack4x8snorm_523fb3 "unpack4x8snorm_523fb3" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %17 = OpConstantNull %uint +%_ptr_Function_v4float = OpTypePointer Function %v4float + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%unpack4x8snorm_523fb3 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_uint Function %17 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %uint_1 + %20 = OpLoad %uint %arg_0 + %18 = OpExtInst %v4float %19 UnpackSnorm4x8 %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %unpack4x8snorm_523fb3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %unpack4x8snorm_523fb3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %unpack4x8snorm_523fb3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/unpack4x8snorm/523fb3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/unpack4x8snorm/523fb3.wgsl.expected.wgsl new file mode 100644 index 0000000000..5cb2171818 --- /dev/null +++ b/test/tint/builtins/gen/var/unpack4x8snorm/523fb3.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn unpack4x8snorm_523fb3() { + var arg_0 = 1u; + var res : vec4 = unpack4x8snorm(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + unpack4x8snorm_523fb3(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + unpack4x8snorm_523fb3(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + unpack4x8snorm_523fb3(); +} diff --git a/test/tint/builtins/gen/var/unpack4x8unorm/750c74.wgsl b/test/tint/builtins/gen/var/unpack4x8unorm/750c74.wgsl new file mode 100644 index 0000000000..be79632c96 --- /dev/null +++ b/test/tint/builtins/gen/var/unpack4x8unorm/750c74.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn unpack4x8unorm(u32) -> vec4 +fn unpack4x8unorm_750c74() { + var arg_0 = 1u; + var res: vec4 = unpack4x8unorm(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + unpack4x8unorm_750c74(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + unpack4x8unorm_750c74(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + unpack4x8unorm_750c74(); +} diff --git a/test/tint/builtins/gen/var/unpack4x8unorm/750c74.wgsl.expected.glsl b/test/tint/builtins/gen/var/unpack4x8unorm/750c74.wgsl.expected.glsl new file mode 100644 index 0000000000..b7d4334532 --- /dev/null +++ b/test/tint/builtins/gen/var/unpack4x8unorm/750c74.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void unpack4x8unorm_750c74() { + uint arg_0 = 1u; + vec4 res = unpackUnorm4x8(arg_0); +} + +vec4 vertex_main() { + unpack4x8unorm_750c74(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void unpack4x8unorm_750c74() { + uint arg_0 = 1u; + vec4 res = unpackUnorm4x8(arg_0); +} + +void fragment_main() { + unpack4x8unorm_750c74(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void unpack4x8unorm_750c74() { + uint arg_0 = 1u; + vec4 res = unpackUnorm4x8(arg_0); +} + +void compute_main() { + unpack4x8unorm_750c74(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/unpack4x8unorm/750c74.wgsl.expected.hlsl b/test/tint/builtins/gen/var/unpack4x8unorm/750c74.wgsl.expected.hlsl new file mode 100644 index 0000000000..8cbb85395a --- /dev/null +++ b/test/tint/builtins/gen/var/unpack4x8unorm/750c74.wgsl.expected.hlsl @@ -0,0 +1,37 @@ +float4 tint_unpack4x8unorm(uint param_0) { + uint j = param_0; + uint4 i = uint4(j & 0xff, (j >> 8) & 0xff, (j >> 16) & 0xff, j >> 24); + return float4(i) / 255.0; +} + +void unpack4x8unorm_750c74() { + uint arg_0 = 1u; + float4 res = tint_unpack4x8unorm(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + unpack4x8unorm_750c74(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + unpack4x8unorm_750c74(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + unpack4x8unorm_750c74(); + return; +} diff --git a/test/tint/builtins/gen/var/unpack4x8unorm/750c74.wgsl.expected.msl b/test/tint/builtins/gen/var/unpack4x8unorm/750c74.wgsl.expected.msl new file mode 100644 index 0000000000..a1bf4ae5c1 --- /dev/null +++ b/test/tint/builtins/gen/var/unpack4x8unorm/750c74.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void unpack4x8unorm_750c74() { + uint arg_0 = 1u; + float4 res = unpack_unorm4x8_to_float(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + unpack4x8unorm_750c74(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + unpack4x8unorm_750c74(); + return; +} + +kernel void compute_main() { + unpack4x8unorm_750c74(); + return; +} + diff --git a/test/tint/builtins/gen/var/unpack4x8unorm/750c74.wgsl.expected.spvasm b/test/tint/builtins/gen/var/unpack4x8unorm/750c74.wgsl.expected.spvasm new file mode 100644 index 0000000000..962a06f20a --- /dev/null +++ b/test/tint/builtins/gen/var/unpack4x8unorm/750c74.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %unpack4x8unorm_750c74 "unpack4x8unorm_750c74" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %17 = OpConstantNull %uint +%_ptr_Function_v4float = OpTypePointer Function %v4float + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%unpack4x8unorm_750c74 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_uint Function %17 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %uint_1 + %20 = OpLoad %uint %arg_0 + %18 = OpExtInst %v4float %19 UnpackUnorm4x8 %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %unpack4x8unorm_750c74 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %unpack4x8unorm_750c74 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %unpack4x8unorm_750c74 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/unpack4x8unorm/750c74.wgsl.expected.wgsl b/test/tint/builtins/gen/var/unpack4x8unorm/750c74.wgsl.expected.wgsl new file mode 100644 index 0000000000..ad2faae0af --- /dev/null +++ b/test/tint/builtins/gen/var/unpack4x8unorm/750c74.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn unpack4x8unorm_750c74() { + var arg_0 = 1u; + var res : vec4 = unpack4x8unorm(arg_0); +} + +@stage(vertex) +fn vertex_main() -> @builtin(position) vec4 { + unpack4x8unorm_750c74(); + return vec4(); +} + +@stage(fragment) +fn fragment_main() { + unpack4x8unorm_750c74(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + unpack4x8unorm_750c74(); +} diff --git a/test/tint/builtins/gen/var/workgroupBarrier/a17f7f.wgsl b/test/tint/builtins/gen/var/workgroupBarrier/a17f7f.wgsl new file mode 100644 index 0000000000..3b3f3272a3 --- /dev/null +++ b/test/tint/builtins/gen/var/workgroupBarrier/a17f7f.wgsl @@ -0,0 +1,34 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/intrinsic-gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// and the intrinsic defintion file: +// src/tint/intrinsics.def +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn workgroupBarrier() +fn workgroupBarrier_a17f7f() { + workgroupBarrier(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + workgroupBarrier_a17f7f(); +} diff --git a/test/tint/builtins/gen/var/workgroupBarrier/a17f7f.wgsl.expected.glsl b/test/tint/builtins/gen/var/workgroupBarrier/a17f7f.wgsl.expected.glsl new file mode 100644 index 0000000000..677f05bcc3 --- /dev/null +++ b/test/tint/builtins/gen/var/workgroupBarrier/a17f7f.wgsl.expected.glsl @@ -0,0 +1,15 @@ +#version 310 es + +void workgroupBarrier_a17f7f() { + barrier(); +} + +void compute_main() { + workgroupBarrier_a17f7f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/workgroupBarrier/a17f7f.wgsl.expected.hlsl b/test/tint/builtins/gen/var/workgroupBarrier/a17f7f.wgsl.expected.hlsl new file mode 100644 index 0000000000..8879f79963 --- /dev/null +++ b/test/tint/builtins/gen/var/workgroupBarrier/a17f7f.wgsl.expected.hlsl @@ -0,0 +1,9 @@ +void workgroupBarrier_a17f7f() { + GroupMemoryBarrierWithGroupSync(); +} + +[numthreads(1, 1, 1)] +void compute_main() { + workgroupBarrier_a17f7f(); + return; +} diff --git a/test/tint/builtins/gen/var/workgroupBarrier/a17f7f.wgsl.expected.msl b/test/tint/builtins/gen/var/workgroupBarrier/a17f7f.wgsl.expected.msl new file mode 100644 index 0000000000..ed5ed22355 --- /dev/null +++ b/test/tint/builtins/gen/var/workgroupBarrier/a17f7f.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +void workgroupBarrier_a17f7f() { + threadgroup_barrier(mem_flags::mem_threadgroup); +} + +kernel void compute_main() { + workgroupBarrier_a17f7f(); + return; +} + diff --git a/test/tint/builtins/gen/var/workgroupBarrier/a17f7f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/workgroupBarrier/a17f7f.wgsl.expected.spvasm new file mode 100644 index 0000000000..dfea5e8a20 --- /dev/null +++ b/test/tint/builtins/gen/var/workgroupBarrier/a17f7f.wgsl.expected.spvasm @@ -0,0 +1,26 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 12 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %workgroupBarrier_a17f7f "workgroupBarrier_a17f7f" + OpName %compute_main "compute_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 + %uint_264 = OpConstant %uint 264 +%workgroupBarrier_a17f7f = OpFunction %void None %1 + %4 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %1 + %10 = OpLabel + %11 = OpFunctionCall %void %workgroupBarrier_a17f7f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/workgroupBarrier/a17f7f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/workgroupBarrier/a17f7f.wgsl.expected.wgsl new file mode 100644 index 0000000000..34db6c85a0 --- /dev/null +++ b/test/tint/builtins/gen/var/workgroupBarrier/a17f7f.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +fn workgroupBarrier_a17f7f() { + workgroupBarrier(); +} + +@stage(compute) @workgroup_size(1) +fn compute_main() { + workgroupBarrier_a17f7f(); +} diff --git a/tools/src/cmd/intrinsic-gen/ast/ast.go b/tools/src/cmd/intrinsic-gen/ast/ast.go index 55e7cc0e6e..f127dc8bd3 100644 --- a/tools/src/cmd/intrinsic-gen/ast/ast.go +++ b/tools/src/cmd/intrinsic-gen/ast/ast.go @@ -173,6 +173,7 @@ func (l Parameters) Format(w fmt.State, verb rune) { if i > 0 { fmt.Fprintf(w, ", ") } + p.Attributes.Format(w, verb) p.Format(w, verb) } fmt.Fprintf(w, ")") @@ -180,9 +181,10 @@ func (l Parameters) Format(w fmt.State, verb rune) { // Parameter describes a single parameter of a function type Parameter struct { - Source tok.Source - Name string // Optional - Type TemplatedName + Source tok.Source + Attributes Attributes + Name string // Optional + Type TemplatedName } // Format implements the fmt.Formatter interface @@ -303,14 +305,11 @@ type Attributes []Attribute // Format implements the fmt.Formatter interface func (l Attributes) Format(w fmt.State, verb rune) { - fmt.Fprint(w, "[[") - for i, d := range l { - if i > 0 { - fmt.Fprintf(w, ", ") - } + for _, d := range l { + fmt.Fprint(w, "@") d.Format(w, verb) + fmt.Fprint(w, " ") } - fmt.Fprint(w, "]]") } // Take looks up the attribute with the given name. If the attribute is found diff --git a/tools/src/cmd/intrinsic-gen/gen/permutate.go b/tools/src/cmd/intrinsic-gen/gen/permutate.go index 9a8bab4dca..fbc390b395 100644 --- a/tools/src/cmd/intrinsic-gen/gen/permutate.go +++ b/tools/src/cmd/intrinsic-gen/gen/permutate.go @@ -83,8 +83,9 @@ func (p *Permuter) Permute(overload *sem.Overload) ([]Permutation, error) { return nil } o.Parameters = append(o.Parameters, sem.Parameter{ - Name: p.Name, - Type: ty, + Name: p.Name, + Type: ty, + IsConst: p.IsConst, }) } if overload.ReturnType != nil { diff --git a/tools/src/cmd/intrinsic-gen/parser/parser.go b/tools/src/cmd/intrinsic-gen/parser/parser.go index b1a87f187b..84f816db16 100644 --- a/tools/src/cmd/intrinsic-gen/parser/parser.go +++ b/tools/src/cmd/intrinsic-gen/parser/parser.go @@ -251,21 +251,24 @@ func (p *parser) parameters() ast.Parameters { } func (p *parser) parameter() ast.Parameter { + attributes := p.attributes() if p.peekIs(1, tok.Colon) { // name type name := p.expect(tok.Identifier, "parameter name") p.expect(tok.Colon, "parameter type") return ast.Parameter{ - Source: name.Source, - Name: string(name.Runes), - Type: p.templatedName(), + Source: name.Source, + Name: string(name.Runes), + Attributes: attributes, + Type: p.templatedName(), } } // type ty := p.templatedName() return ast.Parameter{ - Source: ty.Source, - Type: ty, + Source: ty.Source, + Attributes: attributes, + Type: ty, } } diff --git a/tools/src/cmd/intrinsic-gen/parser/parser_test.go b/tools/src/cmd/intrinsic-gen/parser/parser_test.go index 405aad2d5e..43c95615b5 100644 --- a/tools/src/cmd/intrinsic-gen/parser/parser_test.go +++ b/tools/src/cmd/intrinsic-gen/parser/parser_test.go @@ -304,6 +304,20 @@ func TestParser(t *testing.T) { }, }}, }, + }, { /////////////////////////////////////////////////////////////////// + utils.ThisLine(), + "op F(@blah a)", + ast.AST{ + Operators: []ast.IntrinsicDecl{{ + Kind: ast.Operator, + Name: "F", + Parameters: ast.Parameters{ + { + Attributes: ast.Attributes{{Name: "blah", Values: []string{}}}, + Type: ast.TemplatedName{Name: "a"}}, + }, + }}, + }, }, { /////////////////////////////////////////////////////////////////// utils.ThisLine(), "op F(a: T)", diff --git a/tools/src/cmd/intrinsic-gen/resolver/resolve.go b/tools/src/cmd/intrinsic-gen/resolver/resolve.go index 8dc038fd03..9044d2a590 100644 --- a/tools/src/cmd/intrinsic-gen/resolver/resolve.go +++ b/tools/src/cmd/intrinsic-gen/resolver/resolve.go @@ -374,9 +374,17 @@ func (r *resolver) intrinsic( if err != nil { return err } + isConst := false + if attribute := p.Attributes.Take("const"); attribute != nil { + isConst = true + } + if len(p.Attributes) != 0 { + return fmt.Errorf("%v unknown attribute", p.Attributes[0].Source) + } overload.Parameters[i] = sem.Parameter{ - Name: p.Name, - Type: usage, + Name: p.Name, + Type: usage, + IsConst: isConst, } } diff --git a/tools/src/cmd/intrinsic-gen/sem/sem.go b/tools/src/cmd/intrinsic-gen/sem/sem.go index 0e7d4c6ae6..82d08b7dc5 100644 --- a/tools/src/cmd/intrinsic-gen/sem/sem.go +++ b/tools/src/cmd/intrinsic-gen/sem/sem.go @@ -211,12 +211,16 @@ func (o Overload) Format(w fmt.State, verb rune) { // Parameter describes a single parameter of a function overload type Parameter struct { - Name string - Type FullyQualifiedName + Name string + Type FullyQualifiedName + IsConst bool // Did this parameter have a @const attribute? } // Format implements the fmt.Formatter interface func (p Parameter) Format(w fmt.State, verb rune) { + if p.IsConst { + fmt.Fprint(w, "@const ") + } if p.Name != "" { fmt.Fprintf(w, "%v: ", p.Name) }